code: def _run_model():
      x = random_ops.random_normal(shape=[1, SIZE])
      w = random_ops.random_normal(shape=[SIZE, 2 * SIZE])
      y = math_ops.matmul(x, w)
  
      config = config_pb2.ConfigProto()
      config.graph_options.rewrite_options.arithmetic_optimization = (
          rewriter_config_pb2.RewriterConfig.OFF
      )
      with session.Session(config=config) as sess:
          run_metadata = config_pb2.RunMetadata()
          opts = builder.time_and_memory()
          opts["min_micros"] = 0
          opts["min_bytes"] = 0
          opts["order_by"] = "name"
          opts["output"] = "none"
          _ = sess.run(
              y,
              options=config_pb2.RunOptions(
                  trace_level=config_pb2.RunOptions.SOFTWARE_TRACE
              ),
              run_metadata=run_metadata,
          )
          tfprof_node = model_analyzer.profile(
              sess.graph, run_meta=run_metadata, options=opts
          )
  
          return tfprof_node, run_metadata
  
imports: from collections import defaultdict
  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 ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
  from tensorflow.python.profiler import option_builder
  from tensorflow.python.profiler import model_analyzer
  from tensorflow.python.profiler.internal import model_analyzer_testlib
label_desc: Use image node_id 2 for calling a global function with example usage: _run_model() and returns: tfprof_node,  run_metadata