aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/debug
diff options
context:
space:
mode:
authorGravatar Yifei Feng <yifeif@google.com>2018-04-23 21:19:14 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-04-23 21:21:38 -0700
commit22f3a97b8b089202f60bb0c7697feb0c8e0713cc (patch)
treed16f95826e4be15bbb3b0f22bed0ca25d3eb5897 /tensorflow/python/debug
parent24b7c9a800ab5086d45a7d83ebcd6218424dc9e3 (diff)
Merge changes from github.
PiperOrigin-RevId: 194031845
Diffstat (limited to 'tensorflow/python/debug')
-rw-r--r--tensorflow/python/debug/cli/readline_ui.py8
-rw-r--r--tensorflow/python/debug/wrappers/grpc_wrapper.py11
-rw-r--r--tensorflow/python/debug/wrappers/hooks.py17
3 files changed, 17 insertions, 19 deletions
diff --git a/tensorflow/python/debug/cli/readline_ui.py b/tensorflow/python/debug/cli/readline_ui.py
index 151638789f..3296e45d07 100644
--- a/tensorflow/python/debug/cli/readline_ui.py
+++ b/tensorflow/python/debug/cli/readline_ui.py
@@ -19,6 +19,8 @@ from __future__ import print_function
import readline
+import six
+
from tensorflow.python.debug.cli import base_ui
from tensorflow.python.debug.cli import debugger_cli_common
@@ -39,11 +41,7 @@ class ReadlineUI(base_ui.BaseUI):
readline.set_completer(self._readline_complete)
readline.parse_and_bind("tab: complete")
- # For Python 2-3 compatibility.
- try:
- self._input = raw_input
- except NameError:
- self._input = input
+ self._input = six.moves.input
def _readline_complete(self, text, state):
context, prefix, except_last_word = self._analyze_tab_complete_input(text)
diff --git a/tensorflow/python/debug/wrappers/grpc_wrapper.py b/tensorflow/python/debug/wrappers/grpc_wrapper.py
index fb9494f576..1f9c8fa5a9 100644
--- a/tensorflow/python/debug/wrappers/grpc_wrapper.py
+++ b/tensorflow/python/debug/wrappers/grpc_wrapper.py
@@ -21,6 +21,8 @@ import signal
import sys
import traceback
+import six
+
# Google-internal import(s).
from tensorflow.python.debug.lib import common
from tensorflow.python.debug.wrappers import framework
@@ -140,14 +142,9 @@ class GrpcDebugWrapperSession(framework.NonInteractiveDebugWrapperSession):
def _signal_handler(unused_signal, unused_frame):
- try:
- input_func = raw_input
- except NameError:
- # Python 3 does not have raw_input.
- input_func = input
-
while True:
- response = input_func("\nSIGINT received. Quit program? (Y/n): ").strip()
+ response = six.moves.input(
+ "\nSIGINT received. Quit program? (Y/n): ").strip()
if response in ("", "Y", "y"):
sys.exit(0)
elif response in ("N", "n"):
diff --git a/tensorflow/python/debug/wrappers/hooks.py b/tensorflow/python/debug/wrappers/hooks.py
index 6705cd31e2..5e4604fda4 100644
--- a/tensorflow/python/debug/wrappers/hooks.py
+++ b/tensorflow/python/debug/wrappers/hooks.py
@@ -31,15 +31,18 @@ from tensorflow.python.training import session_run_hook
class LocalCLIDebugHook(session_run_hook.SessionRunHook):
"""Command-line-interface debugger hook.
- Can be used as a monitor/hook for `tf.train.MonitoredSession`s and
- `tf.contrib.learn`'s `Estimator`s and `Experiment`s.
+ Can be used as a hook for `tf.train.MonitoredSession`s and
+ `tf.estimator.Estimator`s. Provides a substitute for
+ `tfdbg.LocalCLIDebugWrapperSession` in cases where the session is not directly
+ available.
"""
def __init__(self, ui_type="curses", dump_root=None, thread_name_filter=None):
"""Create a local debugger command-line interface (CLI) hook.
Args:
- ui_type: (str) user-interface type.
+ ui_type: (`str`) requested user-interface type. Currently supported:
+ (curses | readline).
dump_root: (`str`) optional path to the dump root directory. Must be a
directory that does not exist or an empty directory. If the directory
does not exist, it will be created by the debugger core during debug
@@ -153,8 +156,8 @@ class LocalCLIDebugHook(session_run_hook.SessionRunHook):
class DumpingDebugHook(session_run_hook.SessionRunHook):
"""A debugger hook that dumps debug data to filesystem.
- Can be used as a monitor/hook for `tf.train.MonitoredSession`s and
- `tf.contrib.learn`'s `Estimator`s and `Experiment`s.
+ Can be used as a hook for `tf.train.MonitoredSession`s and
+ `tf.estimator.Estimator`s.
"""
def __init__(self,
@@ -229,8 +232,8 @@ class GrpcDebugHook(session_run_hook.SessionRunHook):
When the arguments of debug_utils.watch_graph changes, strongly consider
changing arguments here too so that features are available to tflearn users.
- Can be used as a monitor/hook for `tf.train.MonitoredSession`s and
- `tf.contrib.learn`'s `Estimator`s and `Experiment`s.
+ Can be used as a hook for `tf.train.MonitoredSession`s and
+ `tf.estimator.Estimator`s.
"""
def __init__(self,