def accuracy_thresh(y_pred, y_true, thresh=0.5, sigmoid=True):
    """Computes accuracy when `y_pred` and `y_true` are the same size."""
    if sigmoid:
        y_pred = y_pred.sigmoid()
    return ((y_pred > thresh).byte() == y_true.byte()).float().mean()
