code: def compute_teacher_loss(
      self, model, net_output, sample, reduce=True
  ):
      probs = model.get_normalized_probs(net_output, log_probs=False)
      probs = probs.view(-1, probs.size(-1))
      lprobs = probs.log()
      target = model.get_targets(sample, net_output).view(-1, 1)
      non_pad_mask = target.ne(self.padding_idx)
      nll_loss = -lprobs.gather(dim=-1, index=target)[non_pad_mask]
      smooth_loss = -lprobs.sum(dim=-1, keepdim=True)[non_pad_mask]
      if reduce:
          nll_loss = nll_loss.sum()
          smooth_loss = smooth_loss.sum()
      eps_i = self.eps / lprobs.size(-1)
      loss = (1.0 - self.eps) * nll_loss + eps_i * smooth_loss
      return loss, nll_loss, probs
  
file_path: translate/pytorch_translate/research/knowledge_distillation/dual_decoder_kd_loss.py
imports: import math
  from fairseq import utils
  from fairseq.criterions import LegacyFairseqCriterion, register_criterion
label_desc: Use image node_id 4 for calling the DualDecoderCriterion obj's underlying member method code with example usage: obj.compute_teacher_loss(model, net_output, sample, reduce) and returns: loss,  nll_loss,  probs