import torch


def accuracy(scores, labels):
    """Return accuracy percentage. Assumes scores are in dim -1."""
    with torch.no_grad():
        total = scores.size()[0]
        pred = torch.argmax(scores, dim=-1)
        correct = (pred == labels).sum().cpu().numpy().astype('float32')
        acc = correct/total * 100
        return acc