fix inequalities in HardClip

oldest trick in the book
This commit is contained in:
Connor Olding 2018-03-10 04:06:42 +01:00
parent a6519f5455
commit 91cdea3b26

View file

@ -219,4 +219,4 @@ class HardClip(Layer): # aka HardTanh when at default settings
return np.clip(X, self.lower, self.upper) return np.clip(X, self.lower, self.upper)
def backward(self, dY): def backward(self, dY):
return dY * ((self.X <= self.lower) & (self.X >= self.upper)) return dY * ((self.X >= self.lower) & (self.X <= self.upper))