code: def run_metric(
      name, data_gen_cls, i, n, c, pred_ctx, label_ctx, **kwargs
  ):
      """Helper function for running one metric benchmark"""
      metric = mx.gluon.metric.create(name, **kwargs)
      data_gen = data_gen_cls(n, c, pred_ctx, label_ctx)
      try:
          label, pred = data_gen.data()
          mx.nd.waitall()
          before = time.time()
          metric.update([label] * i, [pred] * i)
          mx.nd.waitall()
          elapsed = time.time() - before
          elapsed_str = f"{elapsed:<.5}"
      except mx.MXNetError:
          elapsed_str = "FAILED"
      print(
          f"{name:<15}{pred_ctx:<10}{label_ctx:<12}{i * n:<12}{data_gen.batch_size:<15}{data_gen.output_dim:<15}{elapsed_str:<}",
          file=sys.stderr,
      )
  
file_path: mxnet/benchmark/python/metric/benchmark_metric.py
imports: from __future__ import print_function
  import itertools
  import mxnet
  import sys
  import time
label_desc: Use image node_id 1 for calling a global function with example usage: run_metric(name, data_gen_cls, i, n, c, pred_ctx, label_ctx) without return types