class_docstr: RNN decoder module.
  
  Args:
      vocab_size: Vocabulary size.
      embed_size: Embedding size.
      hidden_size: Hidden size..
      rnn_type: Decoder layers type.
      num_layers: Number of decoder layers.
      dropout_rate: Dropout rate for decoder layers.
      embed_dropout_rate: Dropout rate for embedding layer.
      embed_pad: Embedding padding symbol ID.
docstr: Construct a RNNDecoder object.
docstr_tok: ["Construct","a","RNNDecoder","object","."]
code: def __init__(
      self,
      vocab_size: int,
      embed_size: int = 256,
      hidden_size: int = 256,
      rnn_type: str = "lstm",
      num_layers: int = 1,
      dropout_rate: float = 0.0,
      embed_dropout_rate: float = 0.0,
      embed_pad: int = 0,
  ) -> None:
      """Construct a RNNDecoder object."""
      super().__init__()
  
      assert check_argument_types()
  
      if rnn_type not in ("lstm", "gru"):
          raise ValueError(f"Not supported: rnn_type={rnn_type}")
  
      self.embed = torch.nn.Embedding(
          vocab_size, embed_size, padding_idx=embed_pad
      )
      self.dropout_embed = torch.nn.Dropout(p=embed_dropout_rate)
  
      rnn_class = torch.nn.LSTM if rnn_type == "lstm" else torch.nn.GRU
  
      self.rnn = torch.nn.ModuleList(
          [rnn_class(embed_size, hidden_size, 1, batch_first=True)]
      )
  
      for _ in range(1, num_layers):
          self.rnn += [
              rnn_class(hidden_size, hidden_size, 1, batch_first=True)
          ]
  
      self.dropout_rnn = torch.nn.ModuleList(
          [torch.nn.Dropout(p=dropout_rate) for _ in range(num_layers)]
      )
  
      self.dlayers = num_layers
      self.dtype = rnn_type
  
      self.output_size = hidden_size
      self.vocab_size = vocab_size
  
      self.device = next(self.parameters()).device
      self.score_cache = {}
  
file_path: espnet/espnet2/asr_transducer/decoder/rnn_decoder.py
imports: from typing import List, Optional, Tuple
  import torch
  from typeguard import check_argument_types
  from espnet2.asr_transducer.beam_search_transducer import Hypothesis
  from espnet2.asr_transducer.decoder.abs_decoder import AbsDecoder
label_desc: Use image node_id 1 to create a new RNNDecoder object from inherited base classes: AbsDecoder with example: obj = RNNDecoder(vocab_size, embed_size, hidden_size, rnn_type, num_layers, dropout_rate, embed_dropout_rate, embed_pad)