import torch


def compute_batch_accuracy(o: torch.Tensor, y: torch.Tensor) -> float:
    """
    Computes the accuracy of the predictions over the items in a single batch
    :param o: the logit output of datum in the batch
    :param y: the correct class index of each datum
    :return the percentage of correct predictions as a value in [0,1]
    """
    corrects = (torch.max(o, 1)[1].view(y.size()).data == y.data).sum()
    accuracy = corrects / y.size()[0]
    return accuracy.item()