code: def evaluate_accuracy(data_iterator, network):
      
      acc = mx.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(ctx[0])
          label = label.as_in_context(ctx[0])
  
          # 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]
docs: Measure the accuracy of ResNet
  
      Parameters
      ----------
      data_iterator: Iter
        examples of dataset
      network:
        ResNet
  
      Returns
      ----------
      tuple of array element