code: def run_benchmark(state):
      with tf.device(device):
          # Warm-up
          if not state.warm:
              log("Running warmup...")
              timeit.timeit(
                  lambda: benchmark_step(state),
                  number=args.num_warmup_batches,
              )
              state.warm = True
              state.commit()
  
          # Benchmark
          if state.iter == 0:
              log("Running benchmark...")
          for x in range(state.iter, args.num_iters):
              time = timeit.timeit(
                  lambda: benchmark_step(state),
                  number=args.num_batches_per_iter,
              )
              img_sec = (
                  args.batch_size * args.num_batches_per_iter / time
              )
              log(
                  "Iter #%d: %.1f img/sec per %s" % (x, img_sec, device)
              )
              state.img_secs.append(img_sec)
              state.iter = x
              state.commit()
  
file_path: horovod/examples/elastic/tensorflow2/tensorflow2_synthetic_benchmark_elastic.py
imports: import argparse
  import os
  import numpy
  import timeit
  import tensorflow
  import horovod.tensorflow
  from tensorflow.keras import applications
label_desc: Use image node_id 4 for calling a global function with example usage: run_benchmark(state) without return types