import torch


def accuracy(output, target):
    """
    Accuracy metric for deterministic model for classification.
    Args:
        output: Output Tensor with shape (examples, classes)
        target: Target Tensor with shape (examples)

    Returns: float accuracy

    """
    with torch.no_grad():
        pred = torch.argmax(output, dim=1)
        assert pred.shape[0] == len(target)
        correct = 0
        correct += torch.sum(pred == target).item()
    return correct / len(target)