class_docstr: (RNN-)Transducer decoder module.
  
  Args:
      vocab_size: Output dimension.
      layers_type: (RNN-)Decoder layers type.
      num_layers: Number of decoder layers.
      hidden_size: Number of decoder units per layer.
      dropout: Dropout rate for decoder layers.
      dropout_embed: Dropout rate for embedding layer.
      embed_pad: Embed/Blank symbol ID.
code: def __init__(
      self,
      vocab_size: int,
      rnn_type: str = "lstm",
      num_layers: int = 1,
      hidden_size: int = 320,
      dropout: float = 0.0,
      dropout_embed: float = 0.0,
      embed_pad: int = 0,
  ):
      assert check_argument_types()
  
      if rnn_type not in {"lstm", "gru"}:
          raise ValueError(f"Not supported: rnn_type={rnn_type}")
  
      super().__init__()
  
      self.embed = torch.nn.Embedding(
          vocab_size, hidden_size, padding_idx=embed_pad
      )
      self.dropout_embed = torch.nn.Dropout(p=dropout_embed)
  
      dec_net = torch.nn.LSTM if rnn_type == "lstm" else torch.nn.GRU
  
      self.decoder = torch.nn.ModuleList(
          [
              dec_net(hidden_size, hidden_size, 1, batch_first=True)
              for _ in range(num_layers)
          ]
      )
      self.dropout_dec = torch.nn.ModuleList(
          [torch.nn.Dropout(p=dropout) for _ in range(num_layers)]
      )
  
      self.dlayers = num_layers
      self.dunits = hidden_size
      self.dtype = rnn_type
      self.odim = vocab_size
  
      self.ignore_id = -1
      self.blank_id = embed_pad
  
      self.device = next(self.parameters()).device
  
file_path: espnet/espnet2/asr/decoder/transducer_decoder.py
imports: from typing import Any, Dict, List, Optional, Tuple, Union
  import torch
  from typeguard import check_argument_types
  from espnet2.asr.decoder.abs_decoder import AbsDecoder
  from espnet2.asr.transducer.beam_search_transducer import ExtendedHypothesis, Hypothesis
label_desc: Use image node_id 1 to create a new TransducerDecoder object from inherited base classes: AbsDecoder with example: obj = TransducerDecoder(vocab_size, rnn_type, num_layers, hidden_size, dropout, dropout_embed, embed_pad)