Skip to content

Instantly share code, notes, and snippets.

@asimshankar
Created June 14, 2017 00:33
Show Gist options
  • Save asimshankar/0a3b1a2ae6d5c421286a1e56fe1966fe to your computer and use it in GitHub Desktop.
Save asimshankar/0a3b1a2ae6d5c421286a1e56fe1966fe to your computer and use it in GitHub Desktop.
Keras Model to TF SavedModel format
export_path = "./tf"
builder = tf.saved_model.builder.SavedModelBuilder(export_path)
signature = tf.saved_model.signature_def_utils.predict_signature_def(
inputs={"input": mod.input},
outputs={"output": mod.output})
with K.get_session() as sess:
builder.add_meta_graph_and_variables(sess=sess,
tags=[tag_constants.SERVING],
signature_def_map={"predict": signature, "serving_default": signature},
legacy_init_op=legacy_init_op)
builder.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment