Theano fix for saving models
backend support for saving models
clean code
simplify backend check
simplify backend check bug fix
@@ -138,6 +138,13 @@ def save_model(model, filepath, overwrite=True):
weight_values = K.batch_get_value(symbolic_weights)
weight_names = []
for i, (w, val) in enumerate(zip(symbolic_weights, weight_values)):
+ # Default values of symbolic_weights is /variable for theano
+ if K.backend() == 'theano':
+ if hasattr(w, 'name') and w.name != "/variable":
+ name = str(w.name)
+ else:
+ name = 'param_' + str(i)
+ else:
if hasattr(w, 'name') and w.name:
name = str(w.name)
else:
