def METHOD_NAME(input, target, *, reduction="mean", **kwargs):
    """
    Same as `loss_func`, but returns 0 (instead of nan) for empty inputs.
    """
    if target.numel() == 0 and reduction == "mean":
        return input.sum() * 0.0  # connect the gradient
    return loss_func(input, target, reduction=reduction, **kwargs)