def evaluate(self, x, y):
    """Returns the number of correct predictions.

    Args:
      x: 2-d array of size batch_size x image_size.
      y: 2-d array of size batch_size x num_classes.

    Returns:
      A scalar, the number of correct predictions.
    """
    y_actual = np.argmax(y, axis=1)
    y_predicted = np.argmax(self.forward(x), axis=1)
    return int(
        np.sum(np.array(y_actual == y_predicted, copy=False, dtype=int32)))
Returns the number of correct predictions.

    Args:
      x: 2-d array of size batch_size x image_size.
      y: 2-d array of size batch_size x num_classes.

    Returns:
      A scalar, the number of correct predictions.
    
trax/tf_numpy/examples/mnist/model.py