class_docstr: Benchmarks for `tf.data.Dataset.prefetch()`.
class_docstr_tok: ["Benchmarks","for","`","tf.data.Dataset.prefetch","(",")","`","."]
code: def benchmark_prefetch(self):
      num_elements = 1000000
      for prefetch_buffer in [1, 5, 10, 20, 100]:
          dataset = dataset_ops.Dataset.range(num_elements)
          dataset = dataset.prefetch(prefetch_buffer)
  
          self.run_and_report_benchmark(
              dataset,
              num_elements=num_elements,
              extras={
                  "model_name": "prefetch.benchmark.1",
                  "parameters": "%d" % prefetch_buffer,
              },
              name="prefetch_{}".format(prefetch_buffer),
          )
  
imports: from tensorflow.python.data.benchmarks import benchmark_base
  from tensorflow.python.data.ops import dataset_ops
label_desc: Use image node_id 1 for calling the PrefetchBenchmark obj's underlying member method code with example usage: obj.benchmark_prefetch() without return types