import torch


def accuracy(predictions, labels):
    """
    Evaluate accuracy from model predictions against ground truth labels.
    """
    ind = torch.argmax(predictions, 1)
    # provide labels only for samples, where prediction is available (during the training, not every samples prediction is returned for efficiency reasons)
    labels = labels[-predictions.size()[0]:]
    accuracy = torch.sum(torch.eq(ind, labels)).item() / \
        labels.size()[0] * 100.0
    return accuracy