import torch


def sigmoid_cross_entropy(output, target, reduction='mean'):
    """Sigmoid cross-entropy operation, see ``tf.ops.sigmoid_cross_entropy_with_logits``.

    Parameters
    ----------
    output : Tensor
        A batch of distribution with shape: [batch_size, num of classes].
    target : Tensor
        same shape as the input.
    reduction : str
        The optional values are “mean”, “sum”, and “none”. If “none”, do not perform reduction.

    """

    return torch.nn.BCEWithLogitsLoss(reduction=reduction)(output, target)