class_docstr: Benchmarks for `tf.data.Dataset.map()`.
class_docstr_tok: ["Benchmarks","for","`","tf.data.Dataset.map","(",")","`","."]
code: def benchmark_sequential_control_flow(self):
      dataset = dataset_ops.Dataset.from_tensors(100000)
  
      def fn(x):
          i = constant_op.constant(0)
  
          def body(i, x):
              return math_ops.add(i, 1), x
  
          return while_loop.while_loop(math_ops.less, body, [i, x])
  
      num_elements = 1
      dataset = dataset.map(fn)
      self.run_and_report_benchmark(
          dataset,
          num_elements=num_elements,
          extras={
              "model_name": "map.benchmark.8",
              "parameters": "%d" % num_elements,
          },
          name="sequential_control_flow",
          apply_default_optimizations=True,
      )
  
file_path: tensorflow/tensorflow/python/data/benchmarks/map_benchmark.py
imports: import numpy
  from tensorflow.python.data.benchmarks import benchmark_base
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.ops import map_op
  from tensorflow.python.framework import constant_op
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import map_fn
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import while_loop
label_desc: Use image node_id 3 for calling the MapBenchmark obj's underlying member method code with example usage: obj.benchmark_sequential_control_flow() and returns: while_loop, math_ops,  x