class_docstr: Benchmarks for `tf.data.Dataset.from_tensor_slices()`.
class_docstr_tok: ["Benchmarks","for","`","tf.data.Dataset.from_tensor_slices","(",")","`","."]
code: def benchmark_slice_batch_cache_repeat(self):
      input_size = 10000
      batch_size = 100
      num_epochs = 100
      num_elements = input_size * num_epochs // batch_size
  
      input_data = np.random.randn(input_size)
  
      dataset = (
          dataset_ops.Dataset.from_tensor_slices(input_data)
          .batch(batch_size)
          .cache()
          .repeat(num_epochs)
      )
  
      self.run_and_report_benchmark(
          dataset,
          num_elements=num_elements,
          extras={
              "model_name": "from_tensor_slices.benchmark.4",
              "parameters": "%d.%d" % (input_size, batch_size),
          },
          name="slice_batch_cache_repeat_input_%d_batch_%d"
          % (input_size, batch_size),
      )
  
file_path: tensorflow/tensorflow/python/data/benchmarks/from_tensor_slices_benchmark.py
imports: import numpy
  from tensorflow.python.data.benchmarks import benchmark_base
  from tensorflow.python.data.experimental.ops import get_single_element
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.ops import structured_function
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.ops import gen_dataset_ops
label_desc: Use image node_id 4 for calling the FromTensorSlicesBenchmark obj's underlying member method code with example usage: obj.benchmark_slice_batch_cache_repeat() without return types