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 and return prediction and scores from the model.
  
  Prediction is computed using CRF decoding.
  
  Scores are softmax scores over the model logits where the logits are
  computed by rearranging the word logits such that decoded word tag has
  the highest valued logits. This is done because with CRF, the highest valued
  word tag for a given may not be part of the overall set of word tags. In
  order for argmax to work, we rearrange the logit values.
  
  Args:
      logit (torch.Tensor): Logits returned
          :class:`~pytext.models.WordTaggingModel`.
      target (torch.Tensor): Not applicable. Defaults to None.
      context (Optional[Dict[str, Any]]): Context is a dictionary of items
          that's passed as additional metadata. Defaults to None.
  
  Returns:
      Tuple[torch.Tensor, torch.Tensor]: Model prediction and scores.
docstr_tok: ["Compute","and","return","prediction","and","scores","from","the","model",".","Prediction","is","computed","using","CRF","decoding",".","Scores","are","softmax","scores","over","the","model","logits","where","the","logits","are","computed","by","rearranging","the","word","logits","such","that","decoded","word","tag","has","the","highest","valued","logits",".","This","is","done","because","with","CRF",",","the","highest","valued","word","tag","for","a","given","may","not","be","part","of","the","overall","set","of","word","tags",".","In","order","for","argmax","to","work",",","we","rearrange","the","logit","values",".","Args",":","logit","(","torch.Tensor",")",":","Logits","returned",":","class",":","`","~pytext.models.WordTaggingModel","`",".","target","(","torch.Tensor",")",":","Not","applicable",".","Defaults","to","None",".","context","(","Optional","[","Dict","[","str",",","Any","]","]",")",":","Context","is","a","dictionary","of","items","that","'s","passed","as","additional","metadata",".","Defaults","to","None",".","Returns",":","Tuple","[","torch.Tensor",",","torch.Tensor","]",":","Model","prediction","and","scores","."]
code: def get_pred(
      self,
      logit: torch.Tensor,
      target: Optional[torch.Tensor] = None,
      context: Optional[Dict[str, Any]] = None,
  ):
      """Compute and return prediction and scores from the model.
  
      Prediction is computed using CRF decoding.
  
      Scores are softmax scores over the model logits where the logits are
      computed by rearranging the word logits such that decoded word tag has
      the highest valued logits. This is done because with CRF, the highest valued
      word tag for a given may not be part of the overall set of word tags. In
      order for argmax to work, we rearrange the logit values.
  
      Args:
          logit (torch.Tensor): Logits returned
              :class:`~pytext.models.WordTaggingModel`.
          target (torch.Tensor): Not applicable. Defaults to None.
          context (Optional[Dict[str, Any]]): Context is a dictionary of items
              that's passed as additional metadata. Defaults to None.
  
      Returns:
          Tuple[torch.Tensor, torch.Tensor]: Model prediction and scores.
  
      """
      if not context:
          raise MissingValueError(
              "Expected non-None context but got None."
          )
      pred = self.crf.decode(logit, context["seq_lens"])
      logit_rearranged = _rearrange_output(logit, pred)
      scores = F.log_softmax(logit_rearranged, 2)
      return pred, scores
  
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 4 for calling the CRFOutputLayer obj's underlying member method code with example usage: obj.get_pred(logit, target, context) and returns: pred,  scores