class_docstr: Wrapper class for sequence generators for NeMo transformers.
class_docstr_tok: ["Wrapper","class","for","sequence","generators","for","NeMo","transformers","."]
docstr: Generate sequence tokens given the input encoder states and masks.
  Params:
  -   encoder_states: a torch Tensor of shape BxTxD
  -   encoder_input_mask: a binary tensor of shape BxTxD
  -   return_beam_scores: whether to return beam scores
  -   pad_max_len: optional int, set it to pad all sequence to the same length
  -   return_length: whether to return the lengths for generated sequences (shape B)
  Returns:
  -   generated tokens tensor of shape BxT
docstr_tok: ["Generate","sequence","tokens","given","the","input","encoder","states","and","masks",".","Params",":","-","encoder_states",":","a","torch","Tensor","of","shape","BxTxD","-","encoder_input_mask",":","a","binary","tensor","of","shape","BxTxD","-","return_beam_scores",":","whether","to","return","beam","scores","-","pad_max_len",":","optional","int",",","set","it","to","pad","all","sequence","to","the","same","length","-","return_length",":","whether","to","return","the","lengths","for","generated","sequences","(","shape","B",")","Returns",":","-","generated","tokens","tensor","of","shape","BxT"]
code: def __call__(
      self,
      encoder_states: torch.Tensor,
      encoder_input_mask: torch.Tensor = None,
      return_beam_scores: bool = False,
      pad_max_len: Optional[int] = None,
      return_length: bool = False,
  ):
      """
      Generate sequence tokens given the input encoder states and masks.
      Params:
      -   encoder_states: a torch Tensor of shape BxTxD
      -   encoder_input_mask: a binary tensor of shape BxTxD
      -   return_beam_scores: whether to return beam scores
      -   pad_max_len: optional int, set it to pad all sequence to the same length
      -   return_length: whether to return the lengths for generated sequences (shape B)
      Returns:
      -   generated tokens tensor of shape BxT
      """
      predictions = self.generator(
          encoder_hidden_states=encoder_states,
          encoder_input_mask=encoder_input_mask,
          return_beam_scores=return_beam_scores,
      )
  
      if pad_max_len:
          predictions = pad_sequence(
              predictions, pad_max_len, self.pad_id
          )
  
      if return_length:
          return predictions, self.get_seq_length(predictions)
  
      return predictions
  
file_path: NeMo/nemo/collections/asr/parts/utils/slu_utils.py
imports: from dataclasses import dataclass
  from typing import List, Optional
  import torch
  from omegaconf import DictConfig
  from nemo.collections.asr.modules.transformer import BeamSearchSequenceGenerator, GreedySequenceGenerator, TopKSequenceGenerator
  from nemo.collections.common.tokenizers.tokenizer_spec import TokenizerSpec
  from nemo.core.classes.module import NeuralModule
label_desc: Use image node_id 2 for calling the SequenceGenerator obj's underlying member method code with example usage: obj.__call__(encoder_states, encoder_input_mask, return_beam_scores, pad_max_len, return_length) and returns: predictions, predictions,  self