Skip to content

Instantly share code, notes, and snippets.

@seahrh
Last active February 13, 2021 03:33
Show Gist options
  • Save seahrh/4c068bb3d10b1ac0f2026ef2998cc65a to your computer and use it in GitHub Desktop.
Save seahrh/4c068bb3d10b1ac0f2026ef2998cc65a to your computer and use it in GitHub Desktop.
Faster than Keras model.predict. If you are using tf.keras.Model and predicting via the functional call (as done in Jane Street: Neural Network Starter and other Notebooks), try using:
model.call = tf.function(model.call, experimental_relax_shapes=True)
for (test_df, pred_df) in tqdm(env.iter_test()):
pred = model(data, training = False).numpy()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment