class_docstr: An abstract RNNT Decoder framework, which can possibly integrate with GreedyRNNTInfer and BeamRNNTInfer classes.
  Represents the abstract RNNT Prediction/Decoder stateful network, which performs autoregressive decoding
  in order to construct the output sequence.
  
  Args:
      vocab_size: Size of the vocabulary, excluding the RNNT blank token.
      blank_idx: Index of the blank token. Can be 0 or size(vocabulary).
      blank_as_pad: Bool flag, whether to allocate an additional token in the Embedding layer
          of this module in order to treat all RNNT `blank` tokens as pad tokens, thereby letting
          the Embedding layer batch tokens more efficiently.
  
          It is mandatory to use this for certain Beam RNNT Infer methods - such as TSD, ALSD.
          It is also more efficient to use greedy batch decoding with this flag.
class_docstr_tok: ["An","abstract","RNNT","Decoder","framework",",","which","can","possibly","integrate","with","GreedyRNNTInfer","and","BeamRNNTInfer","classes",".","Represents","the","abstract","RNNT","Prediction\/Decoder","stateful","network",",","which","performs","autoregressive","decoding","in","order","to","construct","the","output","sequence",".","Args",":","vocab_size",":","Size","of","the","vocabulary",",","excluding","the","RNNT","blank","token",".","blank_idx",":","Index","of","the","blank","token",".","Can","be","0","or","size","(","vocabulary",")",".","blank_as_pad",":","Bool","flag",",","whether","to","allocate","an","additional","token","in","the","Embedding","layer","of","this","module","in","order","to","treat","all","RNNT","`","blank","`","tokens","as","pad","tokens",",","thereby","letting","the","Embedding","layer","batch","tokens","more","efficiently",".","It","is","mandatory","to","use","this","for","certain","Beam","RNNT","Infer","methods","-","such","as","TSD",",","ALSD",".","It","is","also","more","efficient","to","use","greedy","batch","decoding","with","this","flag","."]
docstr: Stateful prediction of scores and state for a (possibly null) tokenset.
  This method takes various cases into consideration :
  - No token, no state - used for priming the RNN
  - No token, state provided - used for blank token scoring
  - Given token, states - used for scores + new states
  
  Here:
  B - batch size
  U - label length
  H - Hidden dimension size of RNN
  L - Number of RNN layers
  
  Args:
      y: Optional torch tensor of shape [B, U] of dtype long which will be passed to the Embedding.
          If None, creates a zero tensor of shape [B, 1, H] which mimics output of pad-token on Embedding.
  
      state: An optional list of states for the RNN. Eg: For LSTM, it is the state list length is 2.
          Each state must be a tensor of shape [L, B, H].
          If None, and during training mode and `random_state_sampling` is set, will sample a
          normal distribution tensor of the above shape. Otherwise, None will be passed to the RNN.
  
      add_sos: bool flag, whether a zero vector describing a "start of signal" token should be
          prepended to the above "y" tensor. When set, output size is (B, U + 1, H).
  
      batch_size: An optional int, specifying the batch size of the `y` tensor.
          Can be infered if `y` and `state` is None. But if both are None, then batch_size cannot be None.
  
  Returns:
      A tuple  (g, hid) such that -
  
      If add_sos is False:
          g: (B, U, H)
          hid: (h, c) where h is the final sequence hidden state and c is the final cell state:
              h (tensor), shape (L, B, H)
              c (tensor), shape (L, B, H)
  
      If add_sos is True:
          g: (B, U + 1, H)
          hid: (h, c) where h is the final sequence hidden state and c is the final cell state:
              h (tensor), shape (L, B, H)
              c (tensor), shape (L, B, H)
docstr_tok: ["Stateful","prediction","of","scores","and","state","for","a","(","possibly","null",")","tokenset",".","This","method","takes","various","cases","into","consideration",":","-","No","token",",","no","state","-","used","for","priming","the","RNN","-","No","token",",","state","provided","-","used","for","blank","token","scoring","-","Given","token",",","states","-","used","for","scores","+","new","states","Here",":","B","-","batch","size","U","-","label","length","H","-","Hidden","dimension","size","of","RNN","L","-","Number","of","RNN","layers","Args",":","y",":","Optional","torch","tensor","of","shape","[","B",",","U","]","of","dtype","long","which","will","be","passed","to","the","Embedding",".","If","None",",","creates","a","zero","tensor","of","shape","[","B",",","1",",","H","]","which","mimics","output","of","pad-token","on","Embedding",".","state",":","An","optional","list","of","states","for","the","RNN",".","Eg",":","For","LSTM",",","it","is","the","state","list","length","is","2",".","Each","state","must","be","a","tensor","of","shape","[","L",",","B",",","H","]",".","If","None",",","and","during","training","mode","and","`","random_state_sampling","`","is","set",",","will","sample","a","normal","distribution","tensor","of","the","above","shape",".","Otherwise",",","None","will","be","passed","to","the","RNN",".","add_sos",":","bool","flag",",","whether","a","zero","vector","describing","a","``","start","of","signal","''","token","should","be","prepended","to","the","above","``","y","''","tensor",".","When","set",",","output","size","is","(","B",",","U","+","1",",","H",")",".","batch_size",":","An","optional","int",",","specifying","the","batch","size","of","the","`","y","`","tensor",".","Can","be","infered","if","`","y","`","and","`","state","`","is","None",".","But","if","both","are","None",",","then","batch_size","can","not","be","None",".","Returns",":","A","tuple","(","g",",","hid",")","such","that","-","If","add_sos","is","False",":","g",":","(","B",",","U",",","H",")","hid",":","(","h",",","c",")","where","h","is","the","final","sequence","hidden","state","and","c","is","the","final","cell","state",":","h","(","tensor",")",",","shape","(","L",",","B",",","H",")","c","(","tensor",")",",","shape","(","L",",","B",",","H",")","If","add_sos","is","True",":","g",":","(","B",",","U","+","1",",","H",")","hid",":","(","h",",","c",")","where","h","is","the","final","sequence","hidden","state","and","c","is","the","final","cell","state",":","h","(","tensor",")",",","shape","(","L",",","B",",","H",")","c","(","tensor",")",",","shape","(","L",",","B",",","H",")"]
code: def predict(
      self,
      y: Optional[torch.Tensor] = None,
      state: Optional[torch.Tensor] = None,
      add_sos: bool = False,
      batch_size: Optional[int] = None,
  ) -> Tuple[torch.Tensor, List[torch.Tensor]]:
      """
      Stateful prediction of scores and state for a (possibly null) tokenset.
      This method takes various cases into consideration :
      - No token, no state - used for priming the RNN
      - No token, state provided - used for blank token scoring
      - Given token, states - used for scores + new states
  
      Here:
      B - batch size
      U - label length
      H - Hidden dimension size of RNN
      L - Number of RNN layers
  
      Args:
          y: Optional torch tensor of shape [B, U] of dtype long which will be passed to the Embedding.
              If None, creates a zero tensor of shape [B, 1, H] which mimics output of pad-token on Embedding.
  
          state: An optional list of states for the RNN. Eg: For LSTM, it is the state list length is 2.
              Each state must be a tensor of shape [L, B, H].
              If None, and during training mode and `random_state_sampling` is set, will sample a
              normal distribution tensor of the above shape. Otherwise, None will be passed to the RNN.
  
          add_sos: bool flag, whether a zero vector describing a "start of signal" token should be
              prepended to the above "y" tensor. When set, output size is (B, U + 1, H).
  
          batch_size: An optional int, specifying the batch size of the `y` tensor.
              Can be infered if `y` and `state` is None. But if both are None, then batch_size cannot be None.
  
      Returns:
          A tuple  (g, hid) such that -
  
          If add_sos is False:
              g: (B, U, H)
              hid: (h, c) where h is the final sequence hidden state and c is the final cell state:
                  h (tensor), shape (L, B, H)
                  c (tensor), shape (L, B, H)
  
          If add_sos is True:
              g: (B, U + 1, H)
              hid: (h, c) where h is the final sequence hidden state and c is the final cell state:
                  h (tensor), shape (L, B, H)
                  c (tensor), shape (L, B, H)
  
      """
      raise NotImplementedError()
  
imports: from abc import ABC, abstractmethod
  from typing import Any, Dict, List, Optional, Tuple
  import torch
  from nemo.collections.asr.parts.utils.rnnt_utils import Hypothesis
  from nemo.core import NeuralModule
label_desc: Use image node_id 2 for calling the AbstractRNNTDecoder obj's underlying member method code with example usage: obj.predict(y, state, add_sos, batch_size) without return types