class_docstr: Base class for op benchmarks.
docstr: Runs and reports benchmarks in graph mode.
docstr_tok: ["Runs","and","reports","benchmarks","in","graph","mode","."]
code: def _run_and_report_graphmode(
      self,
      fn,
      iters,
      burn_iters,
      benchmark_name,
      xprof_enabled,
      **kwargs,
  ):
      """Runs and reports benchmarks in graph mode."""
      if self.input_data is None:
          raise ValueError(
              "Input data is missing for {} benchmark".format(
                  benchmark_name
              )
          )
  
      # Uses the benchmark config to disable the static graph optimizations
      with session.Session(config=tf.test.benchmark_config()) as sess:
          if hasattr(self, "iterator"):
              sess.run(self.iterator.initializer)
  
          sess.run(lookup_ops.tables_initializer())
          sess.run(variables_lib.global_variables_initializer())
  
          inputs = sess.run(self.input_data)
          placeholder = array_ops.placeholder(
              dtypes.string, tensor_shape.TensorShape({None})
          )
          op_feed_dict = {placeholder: inputs}
          benchmark_op = fn(placeholder, **kwargs)
  
          def run_benchmark():
              for _ in range(burn_iters):
                  sess.run(benchmark_op, op_feed_dict)
              total_time = 0
              for _ in range(iters):
                  start_time = time.time()
                  sess.run(benchmark_op, op_feed_dict)
                  total_time += time.time() - start_time
  
              return total_time
  
          total_time = run_benchmark()
          mean_time = total_time / iters
          extras = {"sec_per_batch": mean_time}
  
          metrics = []
          if hasattr(self, "batch_number"):
              extras.update(
                  {"batches_per_sec": self.batch_number / mean_time}
              )
              metrics.append(
                  {
                      "name": "batches_per_sec",
                      "value": self.batch_number / mean_time,
                  }
              )
  
          if xprof_enabled:
              extras.update(self._run_with_xprof(run_benchmark))
  
          self.report_benchmark(
              wall_time=mean_time,
              name=benchmark_name + "_graph",
              extras=extras,
              metrics=metrics,
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import time
  import tensorflow
  import tensorflow_datasets
  from tensorflow.python.client import session
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import lookup_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow_text.python import ops
  from tensorflow.python.util import tf_inspect
label_desc: Use image node_id 9 for calling the OpsBaseBenchmark obj's underlying member method code with example usage: obj._run_and_report_graphmode(fn, iters, burn_iters, benchmark_name, xprof_enabled) and returns: total_time