def logit_accuracy(predictions, target):
    """
    Gives the accuracy when the output of the network is in logits and the target is binary.

    For example, this can be used with BCEWithLogitsLoss.
    """
    return ((predictions > 0.0) == (target > 0.5)).float().mean()