Apply tf1->tf2 name replaces to doc-strings and comments in tensorflow.

No code changes, only doc-strings and comments.

PiperOrigin-RevId: 243819553
This commit is contained in:
Mark Daoust 2019-04-16 09:15:46 -07:00 committed by TensorFlower Gardener
parent e350128d64
commit 1d92ee8e3d
10 changed files with 22 additions and 20 deletions

View File

@ -947,7 +947,8 @@ class DebugDumpDir(object):
3) The parallel_iteration attribute of while-loop Enter ops are set to 1. 3) The parallel_iteration attribute of while-loop Enter ops are set to 1.
Returns: Returns:
A dict mapping device names (`str`s) to reconstructed `tf.GraphDef`s. A dict mapping device names (`str`s) to reconstructed
`tf.compat.v1.GraphDef`s.
""" """
non_debug_graphs = {} non_debug_graphs = {}
for key in self._debug_graphs: for key in self._debug_graphs:

View File

@ -132,7 +132,7 @@ class GradientsDebugger(object):
# Create a train op under the grad_debugger context. # Create a train op under the grad_debugger context.
with grad_debugger: with grad_debugger:
train_op = tf.train.GradientDescentOptimizer(z) train_op = tf.compat.v1.train.GradientDescentOptimizer(z)
# Now we can reflect through grad_debugger to get the gradient tensor # Now we can reflect through grad_debugger to get the gradient tensor
# with respect to y. # with respect to y.
@ -195,7 +195,7 @@ class GradientsDebugger(object):
# Create a train op under the grad_debugger context. # Create a train op under the grad_debugger context.
grad_debugger = tf_debug.GradientsDebugger() grad_debugger = tf_debug.GradientsDebugger()
with grad_debugger.watch_gradients_by_tensors(y): with grad_debugger.watch_gradients_by_tensors(y):
train_op = tf.train.GradientDescentOptimizer(z) train_op = tf.compat.v1.train.GradientDescentOptimizer(z)
# Now we can reflect through grad_debugger to get the gradient tensor # Now we can reflect through grad_debugger to get the gradient tensor
# with respect to y. # with respect to y.
@ -247,7 +247,7 @@ class GradientsDebugger(object):
# Create a train op under the grad_debugger context. # Create a train op under the grad_debugger context.
grad_debugger = tf_debug.GradientsDebugger() grad_debugger = tf_debug.GradientsDebugger()
with grad_debugger.watch_gradients_by_tensor_names(r"(x|y):0$"): with grad_debugger.watch_gradients_by_tensor_names(r"(x|y):0$"):
train_op = tf.train.GradientDescentOptimizer(z) train_op = tf.compat.v1.train.GradientDescentOptimizer(z)
# Now we can reflect through grad_debugger to get the gradient tensor # Now we can reflect through grad_debugger to get the gradient tensor
# with respect to x and y. # with respect to x and y.

View File

@ -482,8 +482,8 @@ class DebugGraph(object):
def reconstruct_non_debug_graph_def(debug_graph_def): def reconstruct_non_debug_graph_def(debug_graph_def):
"""Reconstruct original (non-debugger-decorated) partition GraphDef. """Reconstruct original (non-debugger-decorated) partition GraphDef.
This method strips the input `tf.GraphDef` of the Copy* and Debug*-type nodes This method strips the input `tf.compat.v1.GraphDef` of the Copy* and
inserted by the debugger. Debug*-type nodes inserted by the debugger.
The reconstructed partition graph is identical to the original (i.e., The reconstructed partition graph is identical to the original (i.e.,
non-debugger-decorated) partition graph except in the following respects: non-debugger-decorated) partition graph except in the following respects:
@ -494,10 +494,11 @@ def reconstruct_non_debug_graph_def(debug_graph_def):
3) The parallel_iteration attribute of while-loop Enter ops are set to 1. 3) The parallel_iteration attribute of while-loop Enter ops are set to 1.
Args: Args:
debug_graph_def: The debugger-decorated `tf.GraphDef`, with the debug_graph_def: The debugger-decorated `tf.compat.v1.GraphDef`, with the
debugger-inserted Copy* and Debug* nodes. debugger-inserted Copy* and Debug* nodes.
Returns: Returns:
The reconstructed `tf.GraphDef` stripped of the debugger-inserted nodes. The reconstructed `tf.compat.v1.GraphDef` stripped of the debugger-inserted
nodes.
""" """
return DebugGraph(debug_graph_def).non_debug_graph_def return DebugGraph(debug_graph_def).non_debug_graph_def

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# ============================================================================== # ==============================================================================
"""Tests for debugger functionalities in tf.Session with grpc:// URLs. """Tests for debugger functionalities in tf.compat.v1.Session with grpc:// URLs.
This test focus on grpc:// debugging of distributed (gRPC) sessions. This test focus on grpc:// debugging of distributed (gRPC) sessions.
""" """

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# ============================================================================== # ==============================================================================
"""Tests for debugger functionalities in tf.Session with grpc:// URLs. """Tests for debugger functionalities in tf.compat.v1.Session with grpc:// URLs.
This test file focuses on the grpc:// debugging of local (non-distributed) This test file focuses on the grpc:// debugging of local (non-distributed)
tf.Sessions. tf.Sessions.

View File

@ -134,7 +134,7 @@ class SessionDebugTestBase(test_util.TensorFlowTestCase):
"""Run fetches with debugging and obtain DebugDumpDir. """Run fetches with debugging and obtain DebugDumpDir.
Args: Args:
sess: the tf.Session to be used. sess: the tf.compat.v1.Session to be used.
fetches: fetches of the Session.run(). fetches: fetches of the Session.run().
feed_dict: feed dict for the Session.run(). feed_dict: feed dict for the Session.run().
debug_ops: name(s) of the debug ops to be used. debug_ops: name(s) of the debug ops to be used.

View File

@ -128,8 +128,8 @@ def _send_call_tracebacks(destinations,
call_key: The key of the execution call, as a string. For graph execution, call_key: The key of the execution call, as a string. For graph execution,
this is a string describing the feeds, fetches (and targets) names of the this is a string describing the feeds, fetches (and targets) names of the
`tf.Session.run` call. For eager execution, this is ignored. `tf.Session.run` call. For eager execution, this is ignored.
graph: A Python `tf.Graph` object (i.e., *not* a `tf.GraphDef`), which graph: A Python `tf.Graph` object (i.e., *not* a `tf.compat.v1.GraphDef`),
contains op tracebacks, if applicable. which contains op tracebacks, if applicable.
send_source: Whether the source files involved in the op tracebacks but send_source: Whether the source files involved in the op tracebacks but
outside the TensorFlow library are to be sent. outside the TensorFlow library are to be sent.
""" """
@ -199,8 +199,8 @@ def send_graph_tracebacks(destinations,
run_key: A string describing the feeds, fetches (and targets) names of the run_key: A string describing the feeds, fetches (and targets) names of the
`tf.Session.run` call. `tf.Session.run` call.
origin_stack: The traceback of the `tf.Session.run()` invocation. origin_stack: The traceback of the `tf.Session.run()` invocation.
graph: A Python `tf.Graph` object (i.e., *not* a `tf.GraphDef`), which graph: A Python `tf.Graph` object (i.e., *not* a `tf.compat.v1.GraphDef`),
contains op tracebacks. which contains op tracebacks.
send_source: Whether the source files involved in the op tracebacks but send_source: Whether the source files involved in the op tracebacks but
outside the TensorFlow library are to be sent. outside the TensorFlow library are to be sent.
""" """

View File

@ -97,7 +97,7 @@ class NodeStepper(object):
c = tf.add(a, b, name="c") c = tf.add(a, b, name="c")
d = tf.multiply(a, c, name="d") d = tf.multiply(a, c, name="d")
sess = tf.Session() sess = tf.compat.v1.Session()
sess.run(tf.initialize_all_varialbes()) sess.run(tf.initialize_all_varialbes())
stepper = NodeStepper(sess, d) stepper = NodeStepper(sess, d)

View File

@ -180,7 +180,7 @@ class TensorBoardDebugWrapperSession(GrpcDebugWrapperSession):
"""Constructor of TensorBoardDebugWrapperSession. """Constructor of TensorBoardDebugWrapperSession.
Args: Args:
sess: The `tf.Session` instance to be wrapped. sess: The `tf.compat.v1.Session` instance to be wrapped.
grpc_debug_server_addresses: gRPC address(es) of debug server(s), as a grpc_debug_server_addresses: gRPC address(es) of debug server(s), as a
`str` or a `list` of `str`s. E.g., "localhost:2333", `str` or a `list` of `str`s. E.g., "localhost:2333",
"grpc://localhost:2333", ["192.168.0.7:2333", "192.168.0.8:2333"]. "grpc://localhost:2333", ["192.168.0.7:2333", "192.168.0.8:2333"].

View File

@ -31,7 +31,7 @@ from tensorflow.python.training import session_run_hook
class LocalCLIDebugHook(session_run_hook.SessionRunHook): class LocalCLIDebugHook(session_run_hook.SessionRunHook):
"""Command-line-interface debugger hook. """Command-line-interface debugger hook.
Can be used as a hook for `tf.train.MonitoredSession`s and Can be used as a hook for `tf.compat.v1.train.MonitoredSession`s and
`tf.estimator.Estimator`s. Provides a substitute for `tf.estimator.Estimator`s. Provides a substitute for
`tfdbg.LocalCLIDebugWrapperSession` in cases where the session is not directly `tfdbg.LocalCLIDebugWrapperSession` in cases where the session is not directly
available. available.
@ -156,7 +156,7 @@ class LocalCLIDebugHook(session_run_hook.SessionRunHook):
class DumpingDebugHook(session_run_hook.SessionRunHook): class DumpingDebugHook(session_run_hook.SessionRunHook):
"""A debugger hook that dumps debug data to filesystem. """A debugger hook that dumps debug data to filesystem.
Can be used as a hook for `tf.train.MonitoredSession`s and Can be used as a hook for `tf.compat.v1.train.MonitoredSession`s and
`tf.estimator.Estimator`s. `tf.estimator.Estimator`s.
""" """
@ -235,7 +235,7 @@ class GrpcDebugHook(session_run_hook.SessionRunHook):
When the arguments of debug_utils.watch_graph changes, strongly consider When the arguments of debug_utils.watch_graph changes, strongly consider
changing arguments here too so that features are available to tflearn users. changing arguments here too so that features are available to tflearn users.
Can be used as a hook for `tf.train.MonitoredSession`s and Can be used as a hook for `tf.compat.v1.train.MonitoredSession`s and
`tf.estimator.Estimator`s. `tf.estimator.Estimator`s.
""" """