Skip to content

Instantly share code, notes, and snippets.

@leondz
Last active September 29, 2016 11:46
Show Gist options
  • Save leondz/e546dd2ce4aa8ab64c805d1fb996ec21 to your computer and use it in GitHub Desktop.
Save leondz/e546dd2ce4aa8ab64c805d1fb996ec21 to your computer and use it in GitHub Desktop.
Demonstrate failure to load with custom metrics defined
from keras.models import load_model, Sequential
from keras.layers import Dense
def x(y_true, y_pred):
return 0.0 * y_pred
model = Sequential([
Dense(1, input_dim=1),
])
model.compile(optimizer='rmsprop',
loss='categorical_crossentropy',
metrics=[x])
model.save('somefile')
break_here = load_model('somefile')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment