import torch


def is_loss(module):
    """Return whether `module` is a `torch` loss function.

    Args:
        module (torch.nn.Module): A PyTorch module.

    Returns:
        bool: Whether `module` is a loss function.
    """
    return isinstance(module, torch.nn.modules.loss._Loss)