class_docstr: Calculates the loss for each sequence up to its length t.
class_docstr_tok: ["Calculates","the","loss","for","each","sequence","up","to","its","length","t","."]
docstr: Create an instance of the Viterbi loss.
  
  Args:
      tag_dictionary: tag_dictionary of task
docstr_tok: ["Create","an","instance","of","the","Viterbi","loss",".","Args",":","tag_dictionary",":","tag_dictionary","of","task"]
code: def __init__(self, tag_dictionary: Dictionary) -> None:
      """Create an instance of the Viterbi loss.
  
      Args:
          tag_dictionary: tag_dictionary of task
      """
      super().__init__()
      self.tag_dictionary = tag_dictionary
      self.tagset_size = len(tag_dictionary)
      self.start_tag = tag_dictionary.get_idx_for_item(START_TAG)
      self.stop_tag = tag_dictionary.get_idx_for_item(STOP_TAG)
  
file_path: flair/flair/models/sequence_tagger_utils/viterbi.py
imports: from typing import Tuple
  import numpy
  import torch
  import torch.nn
  from torch.nn.functional import softmax
  from torch.nn.utils.rnn import pack_padded_sequence
  import flair
  from flair.data import Dictionary, Label, List, Sentence
label_desc: Use image node_id 1 to create a new ViterbiLoss object from inherited base classes: torch.nn with example: obj = ViterbiLoss(tag_dictionary)