View source on GitHub |
Loads the model from a SavedModel as specified by tags. (deprecated)
tf.compat.v1.saved_model.load(
sess, tags, export_dir, import_scope=None, **saver_kwargs
)
Migrate to TF2
tf.compat.v1.saved_model.load
or tf.compat.v1.saved_model.loader.load
is
not compatible with eager execution. Please use tf.saved_model.load
instead
to load your model. You can refer to the SavedModel guide for more information as well as
"Importing SavedModels from TensorFlow 1.x" in the tf.saved_model.load
docstring.
How to Map Arguments
TF1 Arg Name | TF2 Arg Name | Note |
---|---|---|
sess |
Not supported | - |
tags |
tags |
- |
export_dir |
export_dir |
- |
import_scope
|
Not supported | Name scopes are not needed. By default, variables are associated with the loaded object and function names are deduped. |
saver_kwargs |
Not supported | - |
Before & After Usage Example
Before:
with tf.compat.v1.Session(graph=tf.Graph()) as sess:
tf.compat.v1.saved_model.loader.load(sess, ["foo-tag"], export_dir)
After:
model = tf.saved_model.load(export_dir, tags=["foo-tag"])
Description
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. |