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:
Mark Daoust 2019-04-16 10:46:39 -07:00 committed by TensorFlower Gardener
parent b5d97a2590
commit ec1effdb69
6 changed files with 23 additions and 23 deletions

View File

@ -64,9 +64,9 @@ class _SavedModelBuilder(object):
Typical usage for the `SavedModelBuilder`: Typical usage for the `SavedModelBuilder`:
```python ```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, builder.add_meta_graph_and_variables(sess,
["foo-tag"], ["foo-tag"],
@ -74,7 +74,7 @@ class _SavedModelBuilder(object):
assets_list=foo_assets) 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"]) 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 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 not be run automatically when the graph is loaded, instead saved in
a SignatureDef accessible through the exported MetaGraph. a SignatureDef accessible through the exported MetaGraph.
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
metagraph. If None, a sharded Saver that restores all variables will the metagraph. If None, a sharded Saver that restores all variables will
be used. be used.
Raises: Raises:
@ -332,7 +332,7 @@ class _SavedModelBuilder(object):
strip_default_attrs: Boolean. If `True`, default-valued attributes will be strip_default_attrs: Boolean. If `True`, default-valued attributes will be
removed from the NodeDefs. For a detailed guide, see 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). [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 metagraph and save variables. If None, a sharded Saver that restores
all variables will be used. all variables will be used.
@ -441,7 +441,7 @@ class SavedModelBuilder(_SavedModelBuilder):
Args: Args:
assets_collection_to_add: The collection where the asset paths are setup. 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. # graph.
asset_filename_map = _maybe_save_assets(_add_asset_to_collection, asset_filename_map = _maybe_save_assets(_add_asset_to_collection,
assets_collection_to_add) assets_collection_to_add)

View File

@ -33,9 +33,9 @@ Typical usage:
```python ```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, builder.add_meta_graph_and_variables(sess,
["foo-tag"], ["foo-tag"],
@ -43,7 +43,7 @@ with tf.Session(graph=tf.Graph()) as sess:
assets_collection=foo_assets) 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"], builder.add_meta_graph(["bar-tag", "baz-tag"],
assets_collection=bar_baz_assets) assets_collection=bar_baz_assets)
@ -52,8 +52,8 @@ with tf.Session(graph=tf.Graph()) as sess:
builder.save() builder.save()
... ...
with tf.Session(graph=tf.Graph()) as sess: with tf.compat.v1.Session(graph=tf.Graph()) as sess:
tf.saved_model.loader.load(sess, ["foo-tag"], export_dir) tf.compat.v1.saved_model.loader.load(sess, ["foo-tag"], export_dir)
... ...
``` ```

View File

@ -353,10 +353,10 @@ class SavedModelLoader(object):
"""Restore SavedModel variable values into the session. """Restore SavedModel variable values into the session.
Args: Args:
sess: tf.Session to restore variable values. sess: tf.compat.v1.Session to restore variable values.
saver: a tf.train.Saver object. Can be None if there are no variables in saver: a tf.compat.v1.train.Saver object. Can be None if there are no
graph. This may be the saver returned by the load_graph() function, or a variables in graph. This may be the saver returned by the load_graph()
default `tf.train.Saver()`. function, or a default `tf.compat.v1.train.Saver()`.
import_scope: Optional `string` -- if specified, prepend this string import_scope: Optional `string` -- if specified, prepend this string
followed by '/' to all loaded tensor names. This scope is applied to followed by '/' to all loaded tensor names. This scope is applied to
tensor instances loaded into the passed session, but it is *not* written 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`. """Run initialization ops defined in the `MetaGraphDef`.
Args: 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. tags: a set of string tags identifying a MetaGraphDef.
import_scope: Optional `string` -- if specified, prepend this string import_scope: Optional `string` -- if specified, prepend this string
followed by '/' to all loaded tensor names. This scope is applied to 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. """Load the MetaGraphDef graph and restore variable values into the session.
Args: 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. tags: a set of string tags identifying a MetaGraphDef.
import_scope: Optional `string` -- if specified, prepend this string import_scope: Optional `string` -- if specified, prepend this string
followed by '/' to all loaded tensor names. This scope is applied to followed by '/' to all loaded tensor names. This scope is applied to

View File

@ -79,7 +79,7 @@ def build_all_signature_defs(receiver_tensors,
additional serving signatures, which may be used to feed inputs at additional serving signatures, which may be used to feed inputs at
different points within the input receiver subgraph. A typical usage is different points within the input receiver subgraph. A typical usage is
to allow feeding raw feature `Tensor`s *downstream* of the 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 serving_only: boolean; if true, resulting signature defs will only include
valid serving signatures. If false, all requested signatures will be valid serving signatures. If false, all requested signatures will be
returned. returned.

View File

@ -773,9 +773,9 @@ def save(obj, export_dir, signatures=None):
@compatibility(eager) @compatibility(eager)
Not well supported when graph building. From TensorFlow 1.x, Not well supported when graph building. From TensorFlow 1.x,
`tf.enable_eager_execution()` should run first. Calling tf.saved_model.save in `tf.compat.v1.enable_eager_execution()` should run first. Calling
a loop when graph building from TensorFlow 1.x will add new save operations to tf.saved_model.save in a loop when graph building from TensorFlow 1.x will
the default graph each iteration. add new save operations to the default graph each iteration.
May not be called from within a function body. May not be called from within a function body.
@end_compatibility @end_compatibility

View File

@ -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 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: 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 - 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 - The SavedModel will load in TensorFlow Serving and supports the
[Predict [Predict
API](https://github.com/tensorflow/serving/blob/master/tensorflow_serving/apis/predict.proto). API](https://github.com/tensorflow/serving/blob/master/tensorflow_serving/apis/predict.proto).