class_docstr: Compute the log-likelihood of the input assuming a conditional random field
  model.
  
  Args:
      num_tags: The number of tags
class_docstr_tok: ["Compute","the","log-likelihood","of","the","input","assuming","a","conditional","random","field","model",".","Args",":","num_tags",":","The","number","of","tags"]
code: def __init__(
      self,
      num_tags: int,
      ignore_index: int,
      default_label_pad_index: int,
  ) -> None:
      if num_tags <= 0:
          raise ValueError(f"Invalid number of tags: {num_tags}")
      super().__init__()
      self.num_tags = num_tags
      # Add two states at the end to accommodate start and end states
      # (i,j) element represents the probability of transitioning from state i to j
      self.transitions = nn.Parameter(
          torch.Tensor(num_tags + 2, num_tags + 2)
      )
      self.start_tag = num_tags
      self.end_tag = num_tags + 1
      self.reset_parameters()
      self.ignore_index = ignore_index
      self.default_label_pad_index = default_label_pad_index
      log_class_usage(__class__)
  
imports: from typing import List
  import torch
  import torch.jit
  import torch.nn
  from caffe2.python.crf_predict import apply_crf
  from pytext.utils.usage import log_class_usage
label_desc: Use image node_id 1 to create a new CRF object from inherited base classes: nn with example: obj = CRF(num_tags, ignore_index, default_label_pad_index)