code: def get_loss(self, logit, target, context, reduce=True):
      # flatten the logit from [batch_size, seq_lens, dim] to
      # [batch_size * seq_lens, dim]
      return self.loss_fn(
          logit.view(-1, logit.size()[-1]), target.view(-1), reduce
      )
  
file_path: pytext/demo/my_tagging/output.py
imports: import torch
  import torch.nn.functional
  from pytext.config.component import create_loss
  from pytext.loss import CrossEntropyLoss
  from pytext.models.output_layers.output_layer_base import OutputLayerBase
label_desc: Use image node_id 2 for calling the MyTaggingOutputLayer obj's underlying member method code with example usage: obj.get_loss(logit, target, context, reduce) and returns: self