def calculate_accuracy(y_pred, y):
    """
    Calculate the accuracy of the CNN on a set of data.

    Parameters
    ----------
    y_pred: tensor of encoded binary class
        list of binary arrays wrapped in a tensor that represent prediction
    y: tensor of integers
        list of integers wrapped in a tensor that represent true values

    Returns
    -------
    float
        accuracy of the predictions (decimal between 0 and 1)
    """
    acc = ((y_pred.argmax(dim=1) == y).float().mean())
    return acc