code: def score(
      symblock,
      data,
      ctx,
      max_num_examples,
      skip_num_batches,
      logger=None,
  ):
      metrics = [
          gluon.metric.create("acc"),
          gluon.metric.create("top_k_accuracy", top_k=5),
      ]
  
      # make sure that fp32 inference works on the same images as calibrated quantized model
      logger.info(f"Skipping the first {skip_num_batches} batches")
  
      tic = time.time()
      num = 0
      for i, input_data in enumerate(data):
          if i < skip_num_batches:
              continue
          x = input_data[0].to_device(ctx)
          label = input_data[1].to_device(ctx)
          outputs = symblock.forward(x)
          for m in metrics:
              m.update(label, outputs)
          num += batch_size
          if max_num_examples is not None and num >= max_num_examples:
              break
  
      speed = num / (time.time() - tic)
  
      if logger is not None:
          logger.info(f"Finished inference with {num} images")
          logger.info(f"Finished with {speed} images per second")
          for m in metrics:
              logger.info(m.get())
  
file_path: mxnet/example/quantization/imagenet_inference.py
imports: import argparse
  import logging
  import time
  import mxnet
  import numpy
  from mxnet import gluon
  from mxnet.gluon.data import DataLoader
  from mxnet.gluon.data.vision import transforms
label_desc: Use image node_id 2 for calling a global function with example usage: score(symblock, data, ctx, max_num_examples, skip_num_batches, logger) without return types