Esempio n. 1
0
 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)
Esempio n. 2
0
 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
Esempio n. 3
0
    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):
Esempio n. 4
0
 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)