tf.compat.v1.saved_model.load
Stay organized with collections
Save and categorize content based on your preferences.
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
)
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
for instructions on how to migrate the rest of your code.
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
Deprecated: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use tf.saved_model.load
instead.
Args
sess
The TensorFlow session to restore the variables.
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.
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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license .
Last updated 2023-10-06 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2023-10-06 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[],[]]