docstr: lprobs_teacher is used as guide for lprobs 
docstr_tok: ["lprobs_teacher","is","used","as","guide","for","lprobs"]
code: def guide_loss_and_acc(
      self, model, lprobs, lprobs_teacher, target, reduce=True
  ):
      """lprobs_teacher is used as guide for lprobs"""
      if (
          self.alpha == 0.0
          or model.num_updates < self.disable_update_num
      ):
          return self.compute_loss_and_acc(
              model,
              lprobs,
              target,
              reduction=("sum" if reduce else "none"),
          )
      if not lprobs.batch_first:
          lprobs = lprobs.transpose(0, 1)
          lprobs_teacher = lprobs_teacher.transpose(0, 1)
  
      lprobs = lprobs.view(
          -1, lprobs.size(-1)
      ).float()  # -> (B x T) x C
      lprobs_teacher = lprobs_teacher.view(
          -1, lprobs_teacher.size(-1)
      ).float()  # -> (B x T) x C
      target = target.view(-1)
      loss = F.nll_loss(
          lprobs,
          target,
          ignore_index=self.padding_idx,
          reduction="sum" if reduce else "none",
      )
      nll_loss = loss
      probs_teacher = lprobs_teacher.exp().masked_fill_(
          target.unsqueeze(-1).eq(self.padding_idx), 0
      )
      probs_teacher = probs_teacher.detach()
      guide_loss = (
          -(probs_teacher * lprobs).sum()
          if reduce
          else -(probs_teacher * lprobs).sum(-1, keepdim=True)
      )
      loss = self.alpha * guide_loss + (1.0 - self.alpha) * loss
  
      mask = target.ne(self.padding_idx)
      correct = torch.sum(
          lprobs.argmax(1)
          .masked_select(mask)
          .eq(target.masked_select(mask))
      )
      total = torch.sum(mask)
      return loss, nll_loss, correct, total
  
file_path: fairseq/examples/speech_text_joint_to_text/criterions/text_guide_cross_entropy_acc.py
imports: import math
  import torch
  import torch.nn.functional
  from fairseq import utils
  from fairseq.criterions import FairseqCriterion, register_criterion
  from fairseq.criterions.label_smoothed_cross_entropy import label_smoothed_nll_loss
  from fairseq.logging import metrics
label_desc: Use image node_id 5 for calling the GuidedCrossEntAccCriterion obj's underlying member method code with example usage: obj.guide_loss_and_acc(model, lprobs, lprobs_teacher, target, reduce) and returns: loss,  nll_loss,  correct,  total, self