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