Skip to content

Commit

Permalink
fix to load model saved from old keras version
Browse files Browse the repository at this point in the history
  • Loading branch information
akeshavan authored Feb 3, 2018
1 parent ad00676 commit 10d6a2b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion keras/layers/advanced_activations.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ class LeakyReLU(Layer):
def __init__(self, alpha=0.3, **kwargs):
super(LeakyReLU, self).__init__(**kwargs)
self.supports_masking = True
self.alpha = K.cast_to_floatx(alpha)
# fix from https://github.com/keras-team/keras/pull/7784
if isinstance(alpha, dict):
self.alpha = K.cast_to_floatx(alpha['value'])
else:
self.alpha = K.cast_to_floatx(alpha)

def call(self, inputs):
return K.relu(inputs, alpha=self.alpha)
Expand Down

0 comments on commit 10d6a2b

Please sign in to comment.