Fixed PReLU for Theano backend
@@ -118,6 +118,10 @@ class PReLU(Layer):
def call(self, inputs, mask=None):
pos = K.relu(inputs)
+ if K.backend() == 'theano':
+ neg = (K.pattern_broadcast(self.alpha, self.param_broadcast) *
+ (inputs - K.abs(inputs)) * 0.5)
+ else:
neg = -self.alpha * K.relu(-inputs)
return pos + neg
