class_docstr: Output layer for word tagging models that use Conditional Random Field.
  
  Args:
      num_tags (int): Total number of possible word tags.
  
  Attributes:
      num_tags: Total number of possible word tags.
class_docstr_tok: ["Output","layer","for","word","tagging","models","that","use","Conditional","Random","Field",".","Args",":","num_tags","(","int",")",":","Total","number","of","possible","word","tags",".","Attributes",":","num_tags",":","Total","number","of","possible","word","tags","."]
docstr: Compute word tagging loss by using CRF.
  
  Args:
      logit (torch.Tensor): Logit returned by
          :class:`~pytext.models.WordTaggingModel`.
      targets (torch.Tensor): True document label/target.
      context (Dict[str, Any]): Context is a dictionary of items
          that's passed as additional metadata. Defaults to None.
      reduce (bool): Whether to reduce loss over the batch. Defaults to True.
  
  Returns:
      Tuple[torch.Tensor, torch.Tensor]: Model prediction and scores.
docstr_tok: ["Compute","word","tagging","loss","by","using","CRF",".","Args",":","logit","(","torch.Tensor",")",":","Logit","returned","by",":","class",":","`","~pytext.models.WordTaggingModel","`",".","targets","(","torch.Tensor",")",":","True","document","label\/target",".","context","(","Dict","[","str",",","Any","]",")",":","Context","is","a","dictionary","of","items","that","'s","passed","as","additional","metadata",".","Defaults","to","None",".","reduce","(","bool",")",":","Whether","to","reduce","loss","over","the","batch",".","Defaults","to","True",".","Returns",":","Tuple","[","torch.Tensor",",","torch.Tensor","]",":","Model","prediction","and","scores","."]
code: def get_loss(
      self,
      logit: torch.Tensor,
      target: torch.Tensor,
      context: Dict[str, Any],
      reduce=True,
  ):
      """Compute word tagging loss by using CRF.
  
      Args:
          logit (torch.Tensor): Logit returned by
              :class:`~pytext.models.WordTaggingModel`.
          targets (torch.Tensor): True document label/target.
          context (Dict[str, Any]): Context is a dictionary of items
              that's passed as additional metadata. Defaults to None.
          reduce (bool): Whether to reduce loss over the batch. Defaults to True.
  
      Returns:
          Tuple[torch.Tensor, torch.Tensor]: Model prediction and scores.
  
      """
      loss = -1 * self.crf(logit, target, reduce=False)
      return loss.mean() if reduce else loss
  
imports: from typing import Any, Dict, List, Optional, Tuple, Union
  import torch
  import torch.jit
  import torch.nn
  import torch.nn.functional
  from caffe2.python import core
  from pytext.common import Padding
  from pytext.config.component import create_loss
  from pytext.config.serialize import MissingValueError
  from pytext.data.utils import Vocabulary
  from pytext.loss import AUCPRHingeLoss, BinaryCrossEntropyLoss, CrossEntropyLoss, KLDivergenceBCELoss, KLDivergenceCELoss, LabelSmoothedCrossEntropyLoss, StructuredLoss, StructuredMarginLoss
  from pytext.models.crf import CRF
  from pytext.utils.label import get_label_weights
  from pytext.utils.usage import log_class_usage
  from .output_layer_base import OutputLayerBase
  from .utils import OutputLayerUtils
label_desc: Use image node_id 3 for calling the CRFOutputLayer obj's underlying member method code with example usage: obj.get_loss(logit, target, context, reduce) and returns: unknown