import torch


def calculate_accuracy(inputs: torch.Tensor, targets: torch.Tensor) -> float:
    """
    A function that calculates accuracy for batch processing.
    Returns accuracy as a Python float.

    Args:
        inputs (torch.Tensor): shape == [N, n_class]
        targets (torch.Tensor): shape == [N]

    Returns: accracy (float)
    """
    with torch.no_grad():
        total = targets.shape[0]
        _, predicted = torch.max(inputs, 1)
        correct = (predicted == targets).cpu().sum().float().item()

    return correct / total