aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/debug
diff options
context:
space:
mode:
authorGravatar Shanqing Cai <cais@google.com>2018-01-29 07:11:29 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-01-29 07:15:57 -0800
commitad37b47be884b1b897cc4505b856c0f9c51591a1 (patch)
tree20550f9bb83bb80e0340440d6c6ec241969b4d15 /tensorflow/python/debug
parenta6ed38feb42021c7fdf4a76587c1bbf75f3248d1 (diff)
tfdbg: add tensorboard debugger plugin option to three existing examples
PiperOrigin-RevId: 183661140
Diffstat (limited to 'tensorflow/python/debug')
-rw-r--r--tensorflow/python/debug/examples/debug_fibonacci.py17
-rw-r--r--tensorflow/python/debug/examples/debug_mnist.py17
-rw-r--r--tensorflow/python/debug/examples/debug_tflearn_iris.py18
3 files changed, 48 insertions, 4 deletions
diff --git a/tensorflow/python/debug/examples/debug_fibonacci.py b/tensorflow/python/debug/examples/debug_fibonacci.py
index 704dbda357..3821b393ec 100644
--- a/tensorflow/python/debug/examples/debug_fibonacci.py
+++ b/tensorflow/python/debug/examples/debug_fibonacci.py
@@ -44,6 +44,10 @@ def main(_):
sess.run(tf.global_variables_initializer())
# Wrap the TensorFlow Session object for debugging.
+ if FLAGS.debug and FLAGS.tensorboard_debug_address:
+ raise ValueError(
+ "The --debug and --tensorboard_debug_address flags are mutually "
+ "exclusive.")
if FLAGS.debug:
sess = tf_debug.LocalCLIDebugWrapperSession(sess)
@@ -52,6 +56,9 @@ def main(_):
sess.add_tensor_filter("has_inf_or_nan", tf_debug.has_inf_or_nan)
sess.add_tensor_filter("has_negative", has_negative)
+ elif FLAGS.tensorboard_debug_address:
+ sess = tf_debug.TensorBoardDebugWrapperSession(
+ sess, FLAGS.tensorboard_debug_address)
print("Fibonacci number at position %d:\n%s" %
(FLAGS.length, sess.run(n1)))
@@ -82,7 +89,15 @@ if __name__ == "__main__":
"--debug",
dest="debug",
action="store_true",
- help="Use TensorFlow Debugger (tfdbg).")
+ help="Use TensorFlow Debugger (tfdbg). Mutually exclusive with the "
+ "--tensorboard_debug_address flag.")
+ parser.add_argument(
+ "--tensorboard_debug_address",
+ type=str,
+ default=None,
+ help="Connect to the TensorBoard Debugger Plugin backend specified by "
+ "the gRPC address (e.g., localhost:1234). Mutually exclusive with the "
+ "--debug flag.")
FLAGS, unparsed = parser.parse_known_args()
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
diff --git a/tensorflow/python/debug/examples/debug_mnist.py b/tensorflow/python/debug/examples/debug_mnist.py
index 0a6dbf311d..ab1c90371c 100644
--- a/tensorflow/python/debug/examples/debug_mnist.py
+++ b/tensorflow/python/debug/examples/debug_mnist.py
@@ -120,8 +120,15 @@ def main(_):
sess.run(tf.global_variables_initializer())
+ if FLAGS.debug and FLAGS.tensorboard_debug_address:
+ raise ValueError(
+ "The --debug and --tensorboard_debug_address flags are mutually "
+ "exclusive.")
if FLAGS.debug:
sess = tf_debug.LocalCLIDebugWrapperSession(sess, ui_type=FLAGS.ui_type)
+ elif FLAGS.tensorboard_debug_address:
+ sess = tf_debug.TensorBoardDebugWrapperSession(
+ sess, FLAGS.tensorboard_debug_address)
# Add this point, sess is a debug wrapper around the actual Session if
# FLAGS.debug is true. In that case, calling run() will launch the CLI.
@@ -173,6 +180,14 @@ if __name__ == "__main__":
nargs="?",
const=True,
default=False,
- help="Use debugger to track down bad values during training")
+ help="Use debugger to track down bad values during training. "
+ "Mutually exclusive with the --tensorboard_debug_address flag.")
+ parser.add_argument(
+ "--tensorboard_debug_address",
+ type=str,
+ default=None,
+ help="Connect to the TensorBoard Debugger Plugin backend specified by "
+ "the gRPC address (e.g., localhost:1234). Mutually exclusive with the "
+ "--debug flag.")
FLAGS, unparsed = parser.parse_known_args()
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
diff --git a/tensorflow/python/debug/examples/debug_tflearn_iris.py b/tensorflow/python/debug/examples/debug_tflearn_iris.py
index 92314d8dd9..4f4666ee4f 100644
--- a/tensorflow/python/debug/examples/debug_tflearn_iris.py
+++ b/tensorflow/python/debug/examples/debug_tflearn_iris.py
@@ -110,10 +110,16 @@ def main(_):
model_dir=model_dir)
hooks = None
+ if FLAGS.debug and FLAGS.tensorboard_debug_address:
+ raise ValueError(
+ "The --debug and --tensorboard_debug_address flags are mutually "
+ "exclusive.")
if FLAGS.debug:
debug_hook = tf_debug.LocalCLIDebugHook(ui_type=FLAGS.ui_type,
dump_root=FLAGS.dump_root)
- hooks = [debug_hook]
+ elif FLAGS.tensorboard_debug_address:
+ debug_hook = tf_debug.TensorBoardDebugHook(FLAGS.tensorboard_debug_address)
+ hooks = [debug_hook]
if not FLAGS.use_experiment:
# Fit model.
@@ -185,11 +191,19 @@ if __name__ == "__main__":
nargs="?",
const=True,
default=False,
- help="Use debugger to track down bad values during training")
+ help="Use debugger to track down bad values during training. "
+ "Mutually exclusive with the --tensorboard_debug_address flag.")
parser.add_argument(
"--dump_root",
type=str,
default="",
help="Optional custom root directory for temporary debug dump data")
+ parser.add_argument(
+ "--tensorboard_debug_address",
+ type=str,
+ default=None,
+ help="Connect to the TensorBoard Debugger Plugin backend specified by "
+ "the gRPC address (e.g., localhost:1234). Mutually exclusive with the "
+ "--debug flag.")
FLAGS, unparsed = parser.parse_known_args()
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)