(logits: Tensor, targets: Tensor)
return -(targets * F.logsigmoid(logits) + (1 - targets) * F.logsigmoid(-logits))
r"""Binary Cross Entropy

    Args:
        logits (Tensor):
            the predicted logits
        targets (Tensor):
            the assigned targets with the same shape as logits

    Returns:
        the calculated binary cross entropy.
r"""Binary Cross Entropy
r Binary Cross Entropy
def binary_cross_entropy(logits: Tensor, targets: Tensor) -> Tensor:
    r"""Binary Cross Entropy

    Args:
        logits (Tensor):
            the predicted logits
        targets (Tensor):
            the assigned targets with the same shape as logits

    Returns:
        the calculated binary cross entropy.
    """
    return -(targets * F.logsigmoid(logits) + (1 - targets) * F.logsigmoid(-logits))
def binary_cross_entropy ( logits : Tensor , targets : Tensor ) -> Tensor : return - ( targets * F . logsigmoid ( logits ) + ( 1 - targets ) * F . logsigmoid ( - logits ) )