code: def testTraceLoopBytes(self):
      if not test.is_gpu_available():
          return
      ops.reset_default_graph()
      steps = 100
  
      with ops.device("/gpu:0"):
          x = array_ops.ones((100, 100), dtype=dtypes.float32)
          n = array_ops.constant(steps, dtype=dtypes.int32)
          x1 = array_ops.ones((100, 100))
  
          x *= x1
  
          def loop_body(i, x):
              x *= x
              return i + 1, x
  
          _, y = while_loop.while_loop(
              lambda i, x: i < n, loop_body, [array_ops.constant(0), x]
          )
  
      grad = gradients.gradients(y, [x1])
  
      with session.Session(
          config=self._no_rewrite_session_config()
      ) as sess:
          run_options = config_pb2.RunOptions(
              trace_level=config_pb2.RunOptions.FULL_TRACE
          )
          run_metadata = config_pb2.RunMetadata()
          sess.run(grad, options=run_options, run_metadata=run_metadata)
  
          options = (
              option_builder.ProfileOptionBuilder.time_and_memory()
          )
          options["min_bytes"] = 0
          options["min_micros"] = 0
          options["select"] = (
              "bytes",
              "peak_bytes",
              "output_bytes",
              "residual_bytes",
          )
          options["output"] = "none"
          ret_pb = model_analyzer.profile(
              sess.graph,
              run_meta=run_metadata,
              cmd="scope",
              options=options,
          )
          self.assertGreater(ret_pb.total_requested_bytes, 1000000)
  
imports: import gzip
  import io
  import os
  import random
  import re
  import numpy
  from tensorflow.core.profiler import profile_pb2
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.core.protobuf import rewriter_config_pb2
  from tensorflow.python.client import session
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gradients
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.ops import while_loop
  from tensorflow.python.platform import gfile
  from tensorflow.python.platform import test
  from tensorflow.python.profiler import model_analyzer
  from tensorflow.python.profiler import option_builder
  from tensorflow.python.profiler import profile_context
  from tensorflow.python.profiler.internal import model_analyzer_testlib
  from tensorflow.python.util import compat
label_desc: Use image node_id 20 for calling the PrintModelAnalysisTest obj's underlying member method code with example usage: obj.testTraceLoopBytes() and returns: unknown,  x