code: def compute_student_loss(
      self, model, net_output, sample, teacher_probs, 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)
      non_pad_mask = target.ne(self.padding_idx)
      nll_loss = -lprobs.gather(dim=-1, index=target)[non_pad_mask]
      kd_loss = (teacher_probs * -lprobs).sum(dim=-1, keepdim=True)[
          non_pad_mask
      ]
      if reduce:
          nll_loss = nll_loss.sum()
          kd_loss = kd_loss.sum()
      loss = (
          1.0 - self.kd_weight
      ) * nll_loss + self.kd_weight * kd_loss
      return loss, nll_loss
  
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 5 for calling the DualDecoderCriterion obj's underlying member method code with example usage: obj.compute_student_loss(model, net_output, sample, teacher_probs, reduce) and returns: loss,  nll_loss