Defined in tensorflow/python/debug/lib/

See the guide: TensorFlow Debugger > Functions for adding debug watches

Add watch on a Tensor to RunOptions.

N.B.: 1. Under certain circumstances, the Tensor may not get actually watched (e.g., if the node of the Tensor is constant-folded during runtime). 2. For debugging purposes, the parallel_iteration attribute of all tf.while_loops in the graph are set to 1 to prevent any node from being executed multiple times concurrently. This change does not affect subsequent non-debugged runs of the same tf.while_loops.


  • run_options: An instance of config_pb2.RunOptions to be modified.
  • node_name: (str) name of the node to watch.
  • output_slot: (int) output slot index of the tensor from the watched node.
  • debug_ops: (str or list of str) name(s) of the debug op(s). Can be a list of str or a single str. The latter case is equivalent to a list of str with only one element. For debug op types with customizable attributes, each debug op string can optionally contain a list of attribute names, in the syntax of: debug_op_name(attr_name_1=attr_value_1;attr_name_2=attr_value_2;...)
  • debug_urls: (str or list of str) URL(s) to send debug values to, e.g., file:///tmp/tfdbg_dump_1, grpc://localhost:12345.
  • tolerate_debug_op_creation_failures: (bool) Whether to tolerate debug op creation failures by not throwing exceptions.
  • global_step: (int) Optional global_step count for this debug tensor watch.