1) loading model topology from json (this will eventually come
from metagraph).
2) loading model weights from checkpoint.
Example:
importtensorflowastf# Create a tf.keras model.model=tf.keras.Sequential()model.add(tf.keras.layers.Dense(1,input_shape=[10]))model.summary()# Save the tf.keras model in the SavedModel format.path='/tmp/simple_keras_model'tf.keras.experimental.export_saved_model(model,path)# Load the saved keras model back.new_model=tf.keras.experimental.load_from_saved_model(path)new_model.summary()
Args
saved_model_path
a string specifying the path to an existing SavedModel.
custom_objects
Optional dictionary mapping names
(strings) to custom classes or functions to be
considered during deserialization.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.keras.experimental.load_from_saved_model\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/saving/saved_model_experimental.py#L373-L428) |\n\nLoads a keras Model from a SavedModel created by `export_saved_model()`. (deprecated)\n\n#### View aliases\n\n\n**Main aliases**\n\n\\`tf.contrib.saved_model.load_keras_model\\`\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.keras.experimental.load_from_saved_model`](/api_docs/python/tf/compat/v1/keras/experimental/load_from_saved_model), \\`tf.compat.v2.keras.experimental.load_from_saved_model\\`\n\n\u003cbr /\u003e\n\n tf.keras.experimental.load_from_saved_model(\n saved_model_path, custom_objects=None\n )\n\n| **Warning:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: The experimental save and load functions have been deprecated. Please switch to [`tf.keras.models.load_model`](../../../tf/keras/models/load_model).\n\nThis function reinstantiates model state by:\n\n1) loading model topology from json (this will eventually come\nfrom metagraph).\n2) loading model weights from checkpoint.\n\n#### Example:\n\n import tensorflow as tf\n\n # Create a tf.keras model.\n model = tf.keras.Sequential()\n model.add(tf.keras.layers.Dense(1, input_shape=[10]))\n model.summary()\n\n # Save the tf.keras model in the SavedModel format.\n path = '/tmp/simple_keras_model'\n tf.keras.experimental.export_saved_model(model, path)\n\n # Load the saved keras model back.\n new_model = tf.keras.experimental.load_from_saved_model(path)\n new_model.summary()\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------------------|---------------------------------------------------------------------------------------------------------------------|\n| `saved_model_path` | a string specifying the path to an existing SavedModel. |\n| `custom_objects` | Optional dictionary mapping names (strings) to custom classes or functions to be considered during deserialization. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| a keras.Model instance. ||\n\n\u003cbr /\u003e"]]