import torch


def binary_acc(y_pred, y):
    """Calculates model accuracy
    
    Arguments:
        y_pred {torch.Tensor} -- Output of model between 0 and 1
        y {torch.Tensor} -- labels/target values
    
    Returns:
        [torch.Tensor] -- accuracy
    """
    y_pred_tag = torch.round(y_pred)
    correct_results_sum = (y_pred_tag == y).float().sum()
    n = y.nelement() 
    acc = correct_results_sum/n
    acc = acc * 100
    return acc.item()