Set of string tags to identify the required MetaGraphDef. These should
correspond to the tags used when saving the variables using the
SavedModel save() API.
export_dir
Directory in which the SavedModel protocol buffer and variables
to be loaded are located.
import_scope
Optional string -- if specified, prepend this string
followed by '/' to all loaded tensor names. This scope is applied to
tensor instances loaded into the passed session, but it is not written
through to the static MetaGraphDef protocol buffer that is returned.
**saver_kwargs
Optional keyword arguments passed through to Saver.
Returns
The MetaGraphDef protocol buffer loaded in the provided session. This
can be used to further extract signature-defs, collection-defs, etc.
Raises
RuntimeError
MetaGraphDef associated with the tags cannot be found.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf.compat.v1.saved_model.load\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/saved_model/loader_impl.py#L273-L340) |\n\nLoads the model from a SavedModel as specified by tags. (deprecated)\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.saved_model.loader.load`](https://www.tensorflow.org/api_docs/python/tf/compat/v1/saved_model/load)\n\n\u003cbr /\u003e\n\n tf.compat.v1.saved_model.load(\n sess, tags, export_dir, import_scope=None, **saver_kwargs\n )\n\n\u003cbr /\u003e\n\nMigrate to TF2\n--------------\n\n\u003cbr /\u003e\n\n| **Caution:** This API was designed for TensorFlow v1. Continue reading for details on how to migrate from this API to a native TensorFlow v2 equivalent. See the [TensorFlow v1 to TensorFlow v2 migration guide](https://www.tensorflow.org/guide/migrate) for instructions on how to migrate the rest of your code.\n\n[`tf.compat.v1.saved_model.load`](../../../../tf/compat/v1/saved_model/load) or [`tf.compat.v1.saved_model.loader.load`](../../../../tf/compat/v1/saved_model/load) is\nnot compatible with eager execution. Please use [`tf.saved_model.load`](../../../../tf/saved_model/load) instead\nto load your model. You can refer to the [SavedModel guide](https://www.tensorflow.org/guide/saved_model) for more information as well as\n\"Importing SavedModels from TensorFlow 1.x\" in the [`tf.saved_model.load`](https://www.tensorflow.org/api_docs/python/tf/saved_model/load) docstring.\n\n#### How to Map Arguments\n\n| TF1 Arg Name | TF2 Arg Name | Note |\n|----------------|---------------|-------------------------------------------------------------------------------------------------------------------------|\n| `sess` | Not supported | - |\n| `tags` | `tags` | - |\n| `export_dir` | `export_dir` | - |\n| `import_scope` | Not supported | Name scopes are not needed. By default, variables are associated with the loaded object and function names are deduped. |\n| `saver_kwargs` | Not supported | - |\n\n#### Before \\& After Usage Example\n\nBefore: \n\n with tf.compat.v1.Session(graph=tf.Graph()) as sess:\n tf.compat.v1.saved_model.loader.load(sess, [\"foo-tag\"], export_dir)\n\nAfter: \n\n model = tf.saved_model.load(export_dir, tags=[\"foo-tag\"])\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nDescription\n-----------\n\n### Used in the notebooks\n\n| Used in the guide |\n|-------------------------------------------------------------------------------------------|\n| - [Migrate the SavedModel workflow](https://www.tensorflow.org/guide/migrate/saved_model) |\n\n| **Deprecated:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use [`tf.saved_model.load`](../../../../tf/saved_model/load) instead.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `sess` | The TensorFlow session to restore the variables. |\n| `tags` | Set of string tags to identify the required MetaGraphDef. These should correspond to the tags used when saving the variables using the SavedModel `save()` API. |\n| `export_dir` | Directory in which the SavedModel protocol buffer and variables to be loaded are located. |\n| `import_scope` | Optional `string` -- if specified, prepend this string followed by '/' to all loaded tensor names. This scope is applied to tensor instances loaded into the passed session, but it is *not* written through to the static `MetaGraphDef` protocol buffer that is returned. |\n| `**saver_kwargs` | Optional keyword arguments passed through to Saver. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| The `MetaGraphDef` protocol buffer loaded in the provided session. This can be used to further extract signature-defs, collection-defs, etc. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|----------------|--------------------------------------------------------|\n| `RuntimeError` | MetaGraphDef associated with the tags cannot be found. |\n\n\u003cbr /\u003e"]]