'Updates the internal evaluation result.
Parameters
labels : list of `NDArray`
The labels of the data.
preds : list of `NDArray`
Predicted values.'

def update(self, labels, preds):

    check_label_shapes(labels, preds)
    for (label, pred_label) in zip(labels, preds):
        assert (len(pred_label.shape) <= 2), 'Predictions    should    be    no    more    than    2    dims'
        pred_label = numpy.argsort(pred_label.asnumpy().astype('float32'), axis=1)
        label = label.asnumpy().astype('int32')
        check_label_shapes(label, pred_label)
        num_samples = pred_label.shape[0]
        num_dims = len(pred_label.shape)
        if (num_dims == 1):
            self.sum_metric += (pred_label.flat == label.flat).sum()
        elif (num_dims == 2):
            num_classes = pred_label.shape[1]
            top_k = min(num_classes, self.top_k)
            for j in range(top_k):
                self.sum_metric += (pred_label[:, ((num_classes - 1) - j)].flat == label.flat).sum()
        self.num_inst += num_samples
