tf.compat.v1.saved_model.simple_save
Stay organized with collections
Save and categorize content based on your preferences.
Convenience function to build a SavedModel suitable for serving. (deprecated)
tf.compat.v1.saved_model.simple_save(
session, export_dir, inputs, outputs, legacy_init_op=None
)
Used in the notebooks
In many common cases, saving models for serving will be as simple as:
simple_save(session,
export_dir,
inputs={"x": x, "y": y},
outputs={"z": z})
Although in many cases it's not necessary to understand all of the many ways
to configure a SavedModel, this method has a few practical implications:
- It will be treated as a graph for inference / serving (i.e. uses the tag
saved_model.SERVING
)
- The SavedModel will load in TensorFlow Serving and supports the
Predict
API.
To use the Classify, Regress, or MultiInference APIs, please see the
SavedModel
APIs.
- Some TensorFlow ops depend on information on disk or other information
called "assets". These are generally handled automatically by adding the
assets to the
GraphKeys.ASSET_FILEPATHS
collection. Only assets in that
collection are exported; if you need more custom behavior, you'll need to
use the
SavedModelBuilder.
More information about SavedModel and signatures can be found here:
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/saved_model/README.md
Args |
session
|
The TensorFlow session from which to save the meta graph and
variables.
|
export_dir
|
The path to which the SavedModel will be stored.
|
inputs
|
dict mapping string input names to tensors. These are added
to the SignatureDef as the inputs.
|
outputs
|
dict mapping string output names to tensors. These are added
to the SignatureDef as the outputs.
|
legacy_init_op
|
Legacy support for op or group of ops to execute after the
restore op upon a load.
|
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 2024-04-26 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 2024-04-26 UTC."],[],[]]