mirror of
https://github.com/wassname/keras-contrib.git
synced 2026-07-31 12:30:18 +08:00
Simplify pelu
This commit is contained in:
@@ -69,10 +69,10 @@ class PELU(Layer):
|
||||
pos = K.relu(x) * (K.pattern_broadcast(self.alphas, self.param_broadcast) /
|
||||
K.pattern_broadcast(self.betas, self.param_broadcast))
|
||||
neg = (K.pattern_broadcast(self.alphas, self.param_broadcast) *
|
||||
(K.exp(((x - K.abs(x)) * 0.5) / K.pattern_broadcast(self.betas, self.param_broadcast)) - 1))
|
||||
(K.exp(K.relu(-x) / K.pattern_broadcast(self.betas, self.param_broadcast)) - 1))
|
||||
else:
|
||||
pos = K.relu(x) * self.alphas / self.betas
|
||||
neg = self.alphas * (K.exp(((x - K.abs(x)) * 0.5) / self.betas) - 1)
|
||||
neg = self.alphas * (K.exp(K.relu(-x) / self.betas) - 1)
|
||||
return neg + pos
|
||||
|
||||
def get_config(self):
|
||||
|
||||
Reference in New Issue
Block a user