code: def testAutoProfiling(self):
      ops.reset_default_graph()
      time_dir = os.path.join(test.get_temp_dir(), "time")
      memory_dir = os.path.join(test.get_temp_dir(), "memory")
      profile_dir = os.path.join(
          test.get_temp_dir(), "dir/dir2/profile"
      )
      # TODO(xpan): Should we create parent directory for them?
      gfile.MkDir(time_dir)
      gfile.MkDir(memory_dir)
  
      time_opts = (
          builder(builder.time_and_memory())
          .with_file_output(os.path.join(time_dir, "profile"))
          .select(["micros"])
          .build()
      )
      memory_opts = (
          builder(builder.time_and_memory())
          .with_file_output(os.path.join(memory_dir, "profile"))
          .select(["bytes"])
          .build()
      )
  
      time_steps = [2, 3]
      memory_steps = [1, 3]
      dump_steps = [3, 4]
  
      x = lib.BuildSmallModel()
      with profile_context.ProfileContext(
          profile_dir, trace_steps=[1, 2, 3], dump_steps=[3, 4]
      ) as pctx:
          pctx.add_auto_profiling("scope", time_opts, time_steps)
          pctx.add_auto_profiling("scope", memory_opts, memory_steps)
  
          self._trainLoop(
              x,
              10,
              time_dir,
              time_steps,
              memory_dir,
              memory_steps,
              profile_dir,
              dump_steps,
          )
  
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 16 for calling the PrintModelAnalysisTest obj's underlying member method code with example usage: obj.testAutoProfiling() without return types