class_docstr: Benchmarks for `tf.data.experimental.parallel_interleave()`.
class_docstr_tok: ["Benchmarks","for","`","tf.data.experimental.parallel_interleave","(",")","`","."]
code: def apply_interleave(
      self,
      interleave_version,
      dataset,
      interleave_fn,
      cycle_length,
      num_parallel_calls,
  ):
      if interleave_version == NON_PARALLEL:
          return dataset.interleave(
              interleave_fn, cycle_length=cycle_length
          )
      elif interleave_version == EXPERIMENTAL_PARALLEL:
          return dataset.apply(
              interleave_ops.parallel_interleave(
                  interleave_fn, cycle_length=cycle_length
              )
          )
      elif interleave_version == CORE_PARALLEL:
          if not num_parallel_calls:
              num_parallel_calls = cycle_length
          return dataset.interleave(
              interleave_fn,
              cycle_length=cycle_length,
              num_parallel_calls=num_parallel_calls,
          )
      else:
          raise ValueError("Unknown version: " + interleave_version)
  
file_path: tensorflow/tensorflow/python/data/benchmarks/interleave_benchmark.py
imports: from tensorflow.python.data.benchmarks import benchmark_base
  from tensorflow.python.data.experimental.ops import interleave_ops
  from tensorflow.python.data.experimental.ops import testing
  from tensorflow.python.data.ops import dataset_ops
label_desc: Use image node_id 1 for calling the ParallelInterleaveBenchmark obj's underlying member method code with example usage: obj.apply_interleave(interleave_version, dataset, interleave_fn, cycle_length, num_parallel_calls) and returns: dataset, dataset, dataset