def METHOD_NAME(self, x, t):
    """Compute LM loss value from buffer sequences.
    Args:
        x (torch.Tensor): Input ids. (batch, len)
        t (torch.Tensor): Target ids. (batch, len)
    Returns:
        tuple[torch.Tensor, torch.Tensor, torch.Tensor]: Tuple of
            loss to backward (scalar),
            negative log-likelihood of t: -log p(t) (scalar) and
            the number of elements in x (scalar)
    Notes:
        The last two return values are used
        in perplexity: p(t)^{-n} = exp(-log p(t) / n)
    """
    y = self._before_loss(x, None)[0]
    mask = (x != 0).to(y.dtype)
    loss = F.cross_entropy(y.view(-1, y.shape[-1]), t.view(-1), reduction="none")
    logp = loss * mask.view(-1)
    logp = logp.sum()
    count = mask.sum()
    return logp / count, logp, count