import torch


def calc_batch_accuracy(output: torch.Tensor,
                        target: torch.Tensor) -> float:
    """Calculates accuracy for a batch.

    Args:
        output: Output predictions of the network on one-hot encoding.
        target: Targets for the predictions.
    """
    oa = output.argmax(1)  # output argmax
    correct = (oa == target).sum()

    return float(correct) / float(target.shape[0])