class_docstr: Conditional Random Field.
  
  Conditional Random Field Implementation according to sgrvinod (https://github.com/sgrvinod).
  Classifier which predicts single tag / class / label for given word based on not just the word,
  but also on previous seen annotations.
class_docstr_tok: ["Conditional","Random","Field",".","Conditional","Random","Field","Implementation","according","to","sgrvinod","(","https",":","\/\/github.com\/sgrvinod",")",".","Classifier","which","predicts","single","tag","\/","class","\/","label","for","given","word","based","on","not","just","the","word",",","but","also","on","previous","seen","annotations","."]
docstr: Forward propagation of Conditional Random Field.
  
  Args:
      features: output from RNN / Linear layer in shape (batch size, seq len, hidden size)
  
  Returns: CRF scores (emission scores for each token + transitions prob from previous state) in shape (batch_size, seq len, tagset size, tagset size)
docstr_tok: ["Forward","propagation","of","Conditional","Random","Field",".","Args",":","features",":","output","from","RNN","\/","Linear","layer","in","shape","(","batch","size",",","seq","len",",","hidden","size",")","Returns",":","CRF","scores","(","emission","scores","for","each","token","+","transitions","prob","from","previous","state",")","in","shape","(","batch_size",",","seq","len",",","tagset","size",",","tagset","size",")"]
code: def forward(self, features: torch.Tensor) -> torch.Tensor:
      """Forward propagation of Conditional Random Field.
  
      Args:
          features: output from RNN / Linear layer in shape (batch size, seq len, hidden size)
  
      Returns: CRF scores (emission scores for each token + transitions prob from previous state) in shape (batch_size, seq len, tagset size, tagset size)
      """
      batch_size, seq_len = features.size()[:2]
  
      emission_scores = features
      emission_scores = emission_scores.unsqueeze(-1).expand(
          batch_size, seq_len, self.tagset_size, self.tagset_size
      )
  
      crf_scores = emission_scores + self.transitions.unsqueeze(
          0
      ).unsqueeze(0)
      return crf_scores
  
imports: import torch
  import flair
label_desc: Use image node_id 2 for calling the CRF obj's underlying member method code with example usage: obj.forward(features) and returns: crf_scores