parameters: (name, data_gen_cls, i, n, c, pred_ctx, label_ctx, **kwargs)
docstring: Helper function for running one metric benchmark
docstring_summary: Helper function for running one metric benchmark
docstring_tokens: Helper function for running one metric benchmark
function: 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 = "{:<.5}".format(elapsed)
      except mx.MXNetError:
          elapsed_str = "FAILED"
      print("{metric:<15}{pctx:<10}{lctx:<12}{niter:<12}{bs:<15}{out_dim:<15}{elapsed:<}".format(
          metric=name, pctx=str(pred_ctx), lctx=str(label_ctx), niter=i * n, bs=data_gen.batch_size,
          out_dim=data_gen.output_dim, elapsed=elapsed_str), file=sys.stderr)
function_tokens: def run_metric ( name , data_gen_cls , i , n , c , pred_ctx , label_ctx , * * kwargs ) : 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 = "{:<.5}" . format ( elapsed ) except mx . MXNetError : elapsed_str = "FAILED" print ( "{metric:<15}{pctx:<10}{lctx:<12}{niter:<12}{bs:<15}{out_dim:<15}{elapsed:<}" . format ( metric = name , pctx = str ( pred_ctx ) , lctx = str ( label_ctx ) , niter = i * n , bs = data_gen . batch_size , out_dim = data_gen . output_dim , elapsed = elapsed_str ) , file = sys . stderr )