code: def test(network, ctx, val_data, mode="image"):
      acc_top1 = mx.metric.Accuracy()
      acc_top5 = mx.metric.TopKAccuracy(5)
      acc_top1.reset()
      acc_top5.reset()
      if not opt.rec_dir:
          num_batch = len(val_data)
      num = 0
      start = time.time()
      for i, batch in enumerate(val_data):
          if mode == "image":
              data = gluon.utils.split_and_load(
                  batch[0], ctx_list=ctx, batch_axis=0
              )
              label = gluon.utils.split_and_load(
                  batch[1], ctx_list=ctx, batch_axis=0
              )
          else:
              data = gluon.utils.split_and_load(
                  batch.data[0], ctx_list=ctx, batch_axis=0
              )
              label = gluon.utils.split_and_load(
                  batch.label[0], ctx_list=ctx, batch_axis=0
              )
          outputs = [
              network(X.astype(opt.dtype, copy=False)) for X in data
          ]
          acc_top1.update(label, outputs)
          acc_top5.update(label, outputs)
  
          _, top1 = acc_top1.get()
          _, top5 = acc_top5.get()
          if not opt.rec_dir:
              print(
                  "%d / %d : %.8f, %.8f"
                  % (i, num_batch, 1 - top1, 1 - top5)
              )
          else:
              print("%d : %.8f, %.8f" % (i, 1 - top1, 1 - top5))
          num += batch_size
      end = time.time()
      speed = num / (end - start)
      print("Throughput is %f img/sec." % speed)
  
      _, top1 = acc_top1.get()
      _, top5 = acc_top5.get()
      return (1 - top1, 1 - top5)
  
file_path: gluon-cv/scripts/classification/imagenet/verify_pretrained.py
imports: import argparse, os, math, time, sys
  import mxnet
  import logging
  from mxnet import gluon, nd, image
  from mxnet.gluon.nn import Block, HybridBlock
  from mxnet.gluon.data.vision import transforms
  from mxnet.contrib.quantization import *
  import gluoncv
  from gluoncv.data import imagenet
  from gluoncv.model_zoo import get_model
label_desc: Use image node_id 3 for calling a global function with example usage: test(network, ctx, val_data, mode) and returns: unknown,  unknown