def _bprop(self,dZ,Z,X): if dZ is None: return None S = sm.sign(X) S = sm.maximum(-self.slope,S) # where X<0 dZ*slope, otherwise dZ*1 return dZ*abs(S)
def _bprop(self, dZ, Z): return dZ * sm.sign( Z) if dZ is not None else None # sign(Z) will be 0 or +1, never -1
def _bprop(self,dZ,Z): return dZ*sm.sign(Z) if dZ is not None else None # sign(Z) will be 0 or +1, never -1 class rectify(relu):
def _bprop(self, dZ, Z, X): if dZ is None: return None S = sm.sign(X) S = sm.maximum(-self.slope, S) # where X<0 dZ*slope, otherwise dZ*1 return dZ * abs(S)