def METHOD_NAME(self, model, net_output, sample, reduce=True):
    lprobs = model.get_normalized_probs(net_output, log_probs=True)
    lprobs = lprobs.view(-1, lprobs.size(-1))
    target = model.get_targets(sample, net_output).view(-1, 1)
    loss, nll_loss = label_smoothed_nll_loss(
        lprobs,
        target,
        self.label_smoothing,
        ignore_index=self.padding_idx,
        reduce=reduce,
    )
    return loss, nll_loss