Created
June 14, 2017 00:33
-
-
Save asimshankar/0a3b1a2ae6d5c421286a1e56fe1966fe to your computer and use it in GitHub Desktop.
Keras Model to TF SavedModel format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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