code: def compute_loss(
      self, model, net_output, target, reduction, log_probs
  ):
      # N, T -> N * T
      target = target.view(-1)
      lprobs = model.get_normalized_probs(
          net_output, log_probs=log_probs
      )
      if not hasattr(lprobs, "batch_first"):
          logging.warning(
              "ERROR: we need to know whether "
              "batch first for the net output; "
              "you need to set batch_first attribute for the return value of "
              "model.get_normalized_probs. Now, we assume this is true, but "
              "in the future, we will raise exception instead. "
          )
      batch_first = getattr(lprobs, "batch_first", True)
      if not batch_first:
          lprobs = lprobs.transpose(0, 1)
  
      # N, T, D -> N * T, D
      lprobs = lprobs.view(-1, lprobs.size(-1))
      loss = F.nll_loss(
          lprobs,
          target,
          ignore_index=self.padding_idx,
          reduction=reduction,
      )
      return lprobs, loss
  
file_path: fairseq/examples/speech_recognition/criterions/cross_entropy_acc.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import math
  import torch
  import torch.nn.functional
  from fairseq import utils
  from fairseq.criterions import FairseqCriterion, register_criterion
label_desc: Use image node_id 2 for calling the CrossEntropyWithAccCriterion obj's underlying member method code with example usage: obj.compute_loss(model, net_output, target, reduction, log_probs) and returns: lprobs,  loss