def evaluate_accuracy(data_iterator, net):
    """Function to evaluate accuracy of any data iterator passed to it as an argument"""
    acc = mx.metric.Accuracy()
    for data, label in data_iterator:
        output = net(data)
        predictions = nd.argmax(output, axis=1)
        predictions = predictions.reshape((-1, 1))
        acc.update(preds=predictions, labels=label)
    return acc.get()[1]
Function to evaluate accuracy of any data iterator passed to it as an argument