'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):

    assert (len(labels) == len(preds))
    loss = 0.0
    num = 0
    for (label, pred) in zip(labels, preds):
        assert (label.size == (pred.size / pred.shape[(-1)])), ('shape    mismatch:    %s    vs.    %s' % (label.shape, pred.shape))
        label = label.as_in_context(pred.context).reshape((label.size,))
        pred = ndarray.pick(pred, label.astype(dtype='int32'), axis=self.axis)
        if (self.ignore_label is not None):
            ignore = (label == self.ignore_label).astype(pred.dtype)
            num -= ndarray.sum(ignore).asscalar()
            pred = ((pred * (1 - ignore)) + ignore)
        loss -= ndarray.sum(ndarray.log(ndarray.maximum(1e-10, pred))).asscalar()
        num += pred.size
    self.sum_metric += loss
    self.num_inst += num
