code: def evaluate(data_iterator, network, context):
      """Measure the accuracy of ResNet
  
      Parameters
      ----------
      data_iterator: Iter
        examples of dataset
      network:
        ResNet
  
      Returns
      ----------
      tuple of array element
      """
      acc = mx.gluon.metric.Accuracy()
  
      # Iterate through data and label
      for i, (data, label) in enumerate(data_iterator):
          # Get the data and label into the GPU
          data = data.as_in_context(context)
          label = label.as_in_context(context)
  
          # Get network's output which is a probability distribution
          # Apply argmax on the probability distribution to get network's
          # classification.
          output = network(data)
          predictions = nd.argmax(output, axis=1)
  
          # Give network's prediction and the correct label to update the metric
          acc.update(preds=predictions, labels=label)
  
      # Return the accuracy
      return acc.get()[1]
  
file_path: mxnet/example/distributed_training/cifar10_kvstore_hvd.py
imports: import argparse
  import logging
  import time
  import random
  import types
  import warnings
  import numpy
  import mxnet
  from mxnet import autograd, gluon, kv, nd
  from mxnet.gluon.model_zoo import vision
label_desc: Use image node_id 3 for calling a global function with example usage: evaluate(data_iterator, network, context) and returns: acc