docstr: Compute and return the loss given logits and targets.
  
  Args:
      logit (torch.Tensor): Logits returned :class:`~pytext.models.Model`.
      target (torch.Tensor): True label/target to compute loss against.
      context (Optional[Dict[str, Any]]): Context is a dictionary of items
          that's passed as additional metadata by the
          :class:`~pytext.data.DataHandler`. Defaults to None.=
  
  Returns:
      torch.Tensor: Model loss.
docstr_tok: ["Compute","and","return","the","loss","given","logits","and","targets",".","Args",":","logit","(","torch.Tensor",")",":","Logits","returned",":","class",":","`","~pytext.models.Model","`",".","target","(","torch.Tensor",")",":","True","label\/target","to","compute","loss","against",".","context","(","Optional","[","Dict","[","str",",","Any","]","]",")",":","Context","is","a","dictionary","of","items","that","'s","passed","as","additional","metadata","by","the",":","class",":","`","~pytext.data.DataHandler","`",".","Defaults","to","None.=","Returns",":","torch.Tensor",":","Model","loss","."]
code: def get_loss(
      self,
      logits: Tuple[torch.Tensor, ...],
      targets: Tuple[torch.Tensor, ...],
      contexts: Optional[Dict[str, Any]] = None,
      *args,
      **kwargs,
  ) -> torch.Tensor:
      """Compute and return the loss given logits and targets.
  
      Args:
          logit (torch.Tensor): Logits returned :class:`~pytext.models.Model`.
          target (torch.Tensor): True label/target to compute loss against.
          context (Optional[Dict[str, Any]]): Context is a dictionary of items
              that's passed as additional metadata by the
              :class:`~pytext.data.DataHandler`. Defaults to None.=
  
      Returns:
          torch.Tensor: Model loss.
  
      """
      return (
          self._get_soft_hard_loss(logits, targets)
          if self.is_kd
          else self._get_hard_loss(logits, targets)
      )
  
file_path: pytext/pytext/models/output_layers/squad_output_layer.py
imports: from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
  import torch
  import torch.nn.functional
  from pytext.config.component import create_loss
  from pytext.fields import FieldMeta
  from pytext.loss import BinaryFocalLoss, CrossEntropyLoss, FocalLoss, KLDivergenceCELoss, Loss
  from pytext.models.output_layers import OutputLayerBase
  from pytext.utils.usage import log_class_usage
label_desc: Use image node_id 5 for calling the SquadOutputLayer obj's underlying member method code with example usage: obj.get_loss(logits, targets, contexts) and returns: unknown