Apply tf1->tf2 name replaces to doc-strings and comments in tensorflow.
No code changes, only doc-strings and comments. PiperOrigin-RevId: 243837271
This commit is contained in:
parent
b5d97a2590
commit
ec1effdb69
@ -64,9 +64,9 @@ class _SavedModelBuilder(object):
|
||||
Typical usage for the `SavedModelBuilder`:
|
||||
```python
|
||||
...
|
||||
builder = tf.saved_model.Builder(export_dir)
|
||||
builder = tf.compat.v1.saved_model.Builder(export_dir)
|
||||
|
||||
with tf.Session(graph=tf.Graph()) as sess:
|
||||
with tf.compat.v1.Session(graph=tf.Graph()) as sess:
|
||||
...
|
||||
builder.add_meta_graph_and_variables(sess,
|
||||
["foo-tag"],
|
||||
@ -74,7 +74,7 @@ class _SavedModelBuilder(object):
|
||||
assets_list=foo_assets)
|
||||
...
|
||||
|
||||
with tf.Session(graph=tf.Graph()) as sess:
|
||||
with tf.compat.v1.Session(graph=tf.Graph()) as sess:
|
||||
...
|
||||
builder.add_meta_graph(["bar-tag", "baz-tag"])
|
||||
...
|
||||
@ -252,8 +252,8 @@ class _SavedModelBuilder(object):
|
||||
train_op: Op or group of opts that trains the model when run. This will
|
||||
not be run automatically when the graph is loaded, instead saved in
|
||||
a SignatureDef accessible through the exported MetaGraph.
|
||||
saver: An instance of tf.train.Saver that will be used to export the
|
||||
metagraph. If None, a sharded Saver that restores all variables will
|
||||
saver: An instance of tf.compat.v1.train.Saver that will be used to export
|
||||
the metagraph. If None, a sharded Saver that restores all variables will
|
||||
be used.
|
||||
|
||||
Raises:
|
||||
@ -332,7 +332,7 @@ class _SavedModelBuilder(object):
|
||||
strip_default_attrs: Boolean. If `True`, default-valued attributes will be
|
||||
removed from the NodeDefs. For a detailed guide, see
|
||||
[Stripping Default-Valued Attributes](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/saved_model/README.md#stripping-default-valued-attributes).
|
||||
saver: An instance of tf.train.Saver that will be used to export the
|
||||
saver: An instance of tf.compat.v1.train.Saver that will be used to export the
|
||||
metagraph and save variables. If None, a sharded Saver that restores
|
||||
all variables will be used.
|
||||
|
||||
@ -441,7 +441,7 @@ class SavedModelBuilder(_SavedModelBuilder):
|
||||
Args:
|
||||
assets_collection_to_add: The collection where the asset paths are setup.
|
||||
"""
|
||||
# Add assets to the collection with key `constants.ASSETS_KEY`, in the
|
||||
# Add assets to the collection with key `saved_model.ASSETS_KEY`, in the
|
||||
# graph.
|
||||
asset_filename_map = _maybe_save_assets(_add_asset_to_collection,
|
||||
assets_collection_to_add)
|
||||
|
@ -33,9 +33,9 @@ Typical usage:
|
||||
|
||||
```python
|
||||
...
|
||||
builder = tf.saved_model.builder.SavedModelBuilder(export_dir)
|
||||
builder = tf.compat.v1.saved_model.builder.SavedModelBuilder(export_dir)
|
||||
|
||||
with tf.Session(graph=tf.Graph()) as sess:
|
||||
with tf.compat.v1.Session(graph=tf.Graph()) as sess:
|
||||
...
|
||||
builder.add_meta_graph_and_variables(sess,
|
||||
["foo-tag"],
|
||||
@ -43,7 +43,7 @@ with tf.Session(graph=tf.Graph()) as sess:
|
||||
assets_collection=foo_assets)
|
||||
...
|
||||
|
||||
with tf.Session(graph=tf.Graph()) as sess:
|
||||
with tf.compat.v1.Session(graph=tf.Graph()) as sess:
|
||||
...
|
||||
builder.add_meta_graph(["bar-tag", "baz-tag"],
|
||||
assets_collection=bar_baz_assets)
|
||||
@ -52,8 +52,8 @@ with tf.Session(graph=tf.Graph()) as sess:
|
||||
builder.save()
|
||||
|
||||
...
|
||||
with tf.Session(graph=tf.Graph()) as sess:
|
||||
tf.saved_model.loader.load(sess, ["foo-tag"], export_dir)
|
||||
with tf.compat.v1.Session(graph=tf.Graph()) as sess:
|
||||
tf.compat.v1.saved_model.loader.load(sess, ["foo-tag"], export_dir)
|
||||
...
|
||||
|
||||
```
|
||||
|
@ -353,10 +353,10 @@ class SavedModelLoader(object):
|
||||
"""Restore SavedModel variable values into the session.
|
||||
|
||||
Args:
|
||||
sess: tf.Session to restore variable values.
|
||||
saver: a tf.train.Saver object. Can be None if there are no variables in
|
||||
graph. This may be the saver returned by the load_graph() function, or a
|
||||
default `tf.train.Saver()`.
|
||||
sess: tf.compat.v1.Session to restore variable values.
|
||||
saver: a tf.compat.v1.train.Saver object. Can be None if there are no
|
||||
variables in graph. This may be the saver returned by the load_graph()
|
||||
function, or a default `tf.compat.v1.train.Saver()`.
|
||||
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
|
||||
@ -383,7 +383,7 @@ class SavedModelLoader(object):
|
||||
"""Run initialization ops defined in the `MetaGraphDef`.
|
||||
|
||||
Args:
|
||||
sess: tf.Session to restore variable values.
|
||||
sess: tf.compat.v1.Session to restore variable values.
|
||||
tags: a set of string tags identifying a MetaGraphDef.
|
||||
import_scope: Optional `string` -- if specified, prepend this string
|
||||
followed by '/' to all loaded tensor names. This scope is applied to
|
||||
@ -404,7 +404,7 @@ class SavedModelLoader(object):
|
||||
"""Load the MetaGraphDef graph and restore variable values into the session.
|
||||
|
||||
Args:
|
||||
sess: tf.Session to restore variable values.
|
||||
sess: tf.compat.v1.Session to restore variable values.
|
||||
tags: a set of string tags identifying a MetaGraphDef.
|
||||
import_scope: Optional `string` -- if specified, prepend this string
|
||||
followed by '/' to all loaded tensor names. This scope is applied to
|
||||
|
@ -79,7 +79,7 @@ def build_all_signature_defs(receiver_tensors,
|
||||
additional serving signatures, which may be used to feed inputs at
|
||||
different points within the input receiver subgraph. A typical usage is
|
||||
to allow feeding raw feature `Tensor`s *downstream* of the
|
||||
tf.parse_example() op. Defaults to None.
|
||||
tf.io.parse_example() op. Defaults to None.
|
||||
serving_only: boolean; if true, resulting signature defs will only include
|
||||
valid serving signatures. If false, all requested signatures will be
|
||||
returned.
|
||||
|
@ -773,9 +773,9 @@ def save(obj, export_dir, signatures=None):
|
||||
|
||||
@compatibility(eager)
|
||||
Not well supported when graph building. From TensorFlow 1.x,
|
||||
`tf.enable_eager_execution()` should run first. Calling tf.saved_model.save in
|
||||
a loop when graph building from TensorFlow 1.x will add new save operations to
|
||||
the default graph each iteration.
|
||||
`tf.compat.v1.enable_eager_execution()` should run first. Calling
|
||||
tf.saved_model.save in a loop when graph building from TensorFlow 1.x will
|
||||
add new save operations to the default graph each iteration.
|
||||
|
||||
May not be called from within a function body.
|
||||
@end_compatibility
|
||||
|
@ -45,7 +45,7 @@ def simple_save(session, export_dir, inputs, outputs, legacy_init_op=None):
|
||||
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
|
||||
`tag_constants.SERVING`)
|
||||
`saved_model.SERVING`)
|
||||
- The SavedModel will load in TensorFlow Serving and supports the
|
||||
[Predict
|
||||
API](https://github.com/tensorflow/serving/blob/master/tensorflow_serving/apis/predict.proto).
|
||||
|
Loading…
Reference in New Issue
Block a user