docstr: Create and run a TensorFlow Graph with a while loop to generate dumps.
docstr_tok: ["Create","and","run","a","TensorFlow","Graph","with","a","while","loop","to","generate","dumps","."]
code: def createAndRunGraphWithWhileLoop(self):
      """Create and run a TensorFlow Graph with a while loop to generate dumps."""
  
      self.dump_root = self.get_temp_dir()
      self.curr_file_path = os.path.abspath(
          tf_inspect.getfile(tf_inspect.currentframe())
      )
  
      # Run a simple TF graph to generate some debug dumps that can be used in
      # source annotation.
      with session.Session() as sess:
          loop_body = lambda i: math_ops.add(i, 2)
          self.traceback_first_line = line_number_above()
  
          loop_cond = lambda i: math_ops.less(i, 16)
  
          i = constant_op.constant(10, name="i")
          loop = while_loop.while_loop(loop_cond, loop_body, [i])
  
          run_options = config_pb2.RunOptions(
              output_partition_graphs=True
          )
          debug_utils.watch_graph(
              run_options,
              sess.graph,
              debug_urls=["file://%s" % self.dump_root],
          )
          run_metadata = config_pb2.RunMetadata()
          sess.run(loop, options=run_options, run_metadata=run_metadata)
  
          self.dump = debug_data.DebugDumpDir(
              self.dump_root,
              partition_graphs=run_metadata.partition_graphs,
          )
          self.dump.set_python_graph(sess.graph)
  
imports: import ast
  import os
  import sys
  import tempfile
  import zipfile
  import numpy
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.python.client import session
  from tensorflow.python.debug.lib import debug_data
  from tensorflow.python.debug.lib import debug_utils
  from tensorflow.python.debug.lib import source_utils
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.lib.io import file_io
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.ops import while_loop
  from tensorflow.python.platform import googletest
  from tensorflow.python.util import tf_inspect
label_desc: Use image node_id 1 for calling the ListSourceAgainstDumpTest obj's underlying member method code with example usage: obj.createAndRunGraphWithWhileLoop() without return types