class_docstr: Benchmark that compares various ways of running tf.data benchmarks.
class_docstr_tok: ["Benchmark","that","compares","various","ways","of","running","tf.data","benchmarks","."]
docstr: Benchmarks the dataset with the iterations performed in C++.
docstr_tok: ["Benchmarks","the","dataset","with","the","iterations","performed","in","C++","."]
code: def run_benchmark_with_only_cpp_iterations(self, dataset):
      """Benchmarks the dataset with the iterations performed in C++."""
      # NOTE: We use `dataset.skip()` to perform the iterations in C++, avoiding
      # the overhead of multiple `session.run()` calls. Note that this relies on
      # the underlying implementation of `skip`: if it is optimized in the future,
      # we will have to change this code.
      dataset = dataset.skip(self.iters - 1)
      iterator = dataset_ops.make_initializable_iterator(dataset)
      next_element = iterator.get_next()
  
      with session.Session() as sess:
          deltas = []
          for _ in range(self.num_reps):
              sess.run(iterator.initializer)
              deltas.append(
                  timeit.timeit(
                      lambda: sess.run(next_element.op), number=1
                  )
              )
      self.report(deltas)
  
imports: import timeit
  import numpy
  from tensorflow.python.client import session
  from tensorflow.python.data.experimental.ops import testing
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.ops import options
  from tensorflow.python.eager import context
  from tensorflow.python.platform import test
label_desc: Use image node_id 14 for calling the MetaBenchmark obj's underlying member method code with example usage: obj.run_benchmark_with_only_cpp_iterations(dataset) without return types