class_docstr: Dynamic CRF layer is used to approximate the traditional
  Conditional Random Fields (CRF)
  $P(y | x) = 1/Z(x) exp(sum_i s(y_i, x) + sum_i t(y_{i-1}, y_i, x))$
  
  where in this function, we assume the emition scores (s) are given,
  and the transition score is a |V| x |V| matrix $M$
  
  in the following two aspects:
   (1) it used a low-rank approximation for the transition matrix:
       $M = E_1 E_2^T$
   (2) it used a beam to estimate the normalizing factor Z(x)
class_docstr_tok: ["Dynamic","CRF","layer","is","used","to","approximate","the","traditional","Conditional","Random","Fields","(","CRF",")","$","P","(","y","|","x",")","=","1\/Z","(","x",")","exp","(","sum_i","s","(","y_i",",","x",")","+","sum_i","t","(","y_","{","i-1","}",",","y_i",",","x",")",")","$","where","in","this","function",",","we","assume","the","emition","scores","(","s",")","are","given",",","and","the","transition","score","is","a","|V|","x","|V|","matrix","$","M","$","in","the","following","two","aspects",":","(","1",")","it","used","a","low-rank","approximation","for","the","transition","matrix",":","$","M","=","E_1","E_2^T","$","(","2",")","it","used","a","beam","to","estimate","the","normalizing","factor","Z","(","x",")"]
docstr: Find the most likely output sequence using Viterbi algorithm.
  
  Args:
      emissions (`~torch.Tensor`): Emission score are usually the unnormalized decoder output
          ``(batch_size, seq_len, vocab_size)``. We assume batch-first
      masks (`~torch.ByteTensor`): Mask tensor with the same size as targets
  
  Returns:
      `~torch.LongTensor`: decoded sequence from the CRF model
docstr_tok: ["Find","the","most","likely","output","sequence","using","Viterbi","algorithm",".","Args",":","emissions","(","`","~torch.Tensor","`",")",":","Emission","score","are","usually","the","unnormalized","decoder","output","``","(","batch_size",",","seq_len",",","vocab_size",")","``",".","We","assume","batch-first","masks","(","`","~torch.ByteTensor","`",")",":","Mask","tensor","with","the","same","size","as","targets","Returns",":","`","~torch.LongTensor","`",":","decoded","sequence","from","the","CRF","model"]
code: def forward_decoder(self, emissions, masks=None, beam=None):
      """
      Find the most likely output sequence using Viterbi algorithm.
  
      Args:
          emissions (`~torch.Tensor`): Emission score are usually the unnormalized decoder output
              ``(batch_size, seq_len, vocab_size)``. We assume batch-first
          masks (`~torch.ByteTensor`): Mask tensor with the same size as targets
  
      Returns:
          `~torch.LongTensor`: decoded sequence from the CRF model
      """
      return self._viterbi_decode(emissions, masks, beam)
  
file_path: fairseq/fairseq/modules/dynamic_crf_layer.py
imports: import numpy
  import torch
  import torch.nn
label_desc: Use image node_id 4 for calling the DynamicCRF obj's underlying member method code with example usage: obj.forward_decoder(emissions, masks, beam) and returns: self