code: def get_loss(
      self,
      model_outputs: Tuple[torch.Tensor, Dict[str, torch.Tensor]],
      targets: Tuple[torch.Tensor, torch.Tensor],
      context: Dict[str, Any] = None,
      reduce=True,
  ) -> torch.Tensor:
      # flatten the logit from [batch_size, seq_lens, dim] to
      # [batch_size * seq_lens, dim]
      logits = model_outputs[0]
      loss = self.loss_fn(
          logits.view(-1, logits.size()[-1]),
          targets[0].view(-1),
          reduce,
      )
      return loss
  
file_path: pytext/pytext/models/seq_models/seq2seq_output_layer.py
imports: from typing import Any, Dict, Tuple, Union
  import torch
  from pytext.config import ConfigBase
  from pytext.config.component import create_loss
  from pytext.data.utils import Vocabulary
  from pytext.loss import CrossEntropyLoss, LabelSmoothedCrossEntropyLoss, NLLLoss
  from pytext.models.output_layers import OutputLayerBase
label_desc: Use image node_id 2 for calling the Seq2SeqOutputLayer obj's underlying member method code with example usage: obj.get_loss(model_outputs, targets, context, reduce) and returns: loss