Integer specifying a target class to ignore. If given, this class index does not contribute
            to the returned score.

    Returns:
        Perplexity value

    Examples:
        >>> import torch
        >>> gen = torch.manual_seed(42)
        >>> preds = torch.rand(2, 8, 5, generator=gen)
        >>> target = torch.randint(5, (2, 8), generator=gen)
        >>> target[0, 6:] = -100
        >>> perplexity(preds, target, ignore_index=-100)
        tensor(5.8540)

    )