class_docstr: Benchmarks for `tf.data.experimental.snapshot()`.
class_docstr_tok: ["Benchmarks","for","`","tf.data.experimental.snapshot","(",")","`","."]
code: def _createSimpleDataset(
      self,
      num_elements,
      tmp_dir=None,
      compression=snapshot.COMPRESSION_NONE,
  ):
      if not tmp_dir:
          tmp_dir = self._makeSnapshotDirectory()
  
      dataset = dataset_ops.Dataset.from_tensor_slices([1.0])
      dataset = dataset.map(
          lambda x: gen_array_ops.broadcast_to(x, [50, 50, 3])
      )
      dataset = dataset.repeat(num_elements)
      dataset = dataset.apply(
          snapshot.legacy_snapshot(tmp_dir, compression=compression)
      )
  
      return dataset
  
file_path: tensorflow/tensorflow/python/data/experimental/benchmarks/snapshot_dataset_benchmark.py
imports: import os
  import shutil
  from tensorflow.python.data.benchmarks import benchmark_base
  from tensorflow.python.data.experimental.ops import snapshot
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.ops import gen_array_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 2 for calling the SnapshotDatasetBenchmark obj's underlying member method code with example usage: obj._createSimpleDataset(num_elements, tmp_dir, compression) and returns: dataset