class_docstr: RNN decoder module for Transducer model.
  
  Args:
      odim: Output dimension.
      dtype: Decoder units type.
      dlayers: Number of decoder layers.
      dunits: Number of decoder units per layer..
      embed_dim: Embedding layer dimension.
      dropout_rate: Dropout rate for decoder layers.
      dropout_rate_embed: Dropout rate for embedding layer.
      blank_id: Blank symbol ID.
class_docstr_tok: ["RNN","decoder","module","for","Transducer","model",".","Args",":","odim",":","Output","dimension",".","dtype",":","Decoder","units","type",".","dlayers",":","Number","of","decoder","layers",".","dunits",":","Number","of","decoder","units","per","layer","..","embed_dim",":","Embedding","layer","dimension",".","dropout_rate",":","Dropout","rate","for","decoder","layers",".","dropout_rate_embed",":","Dropout","rate","for","embedding","layer",".","blank_id",":","Blank","symbol","ID","."]
docstr: Encode source label sequences.
  
  Args:
      sequence: RNN input sequences. (B, D_emb)
      state: Decoder hidden states. ((N, B, D_dec), (N, B, D_dec))
  
  Returns:
      sequence: RNN output sequences. (B, D_dec)
      (h_next, c_next): Decoder hidden states. (N, B, D_dec), (N, B, D_dec))
docstr_tok: ["Encode","source","label","sequences",".","Args",":","sequence",":","RNN","input","sequences",".","(","B",",","D_emb",")","state",":","Decoder","hidden","states",".","(","(","N",",","B",",","D_dec",")",",","(","N",",","B",",","D_dec",")",")","Returns",":","sequence",":","RNN","output","sequences",".","(","B",",","D_dec",")","(","h_next",",","c_next",")",":","Decoder","hidden","states",".","(","N",",","B",",","D_dec",")",",","(","N",",","B",",","D_dec",")",")"]
code: def rnn_forward(
      self,
      sequence: torch.Tensor,
      state: Tuple[torch.Tensor, Optional[torch.Tensor]],
  ) -> Tuple[torch.Tensor, Tuple[torch.Tensor, Optional[torch.Tensor]]]:
      """Encode source label sequences.
  
      Args:
          sequence: RNN input sequences. (B, D_emb)
          state: Decoder hidden states. ((N, B, D_dec), (N, B, D_dec))
  
      Returns:
          sequence: RNN output sequences. (B, D_dec)
          (h_next, c_next): Decoder hidden states. (N, B, D_dec), (N, B, D_dec))
  
      """
      h_prev, c_prev = state
      h_next, c_next = self.init_state(sequence.size(0))
  
      for layer in range(self.dlayers):
          if self.dtype == "lstm":
              (
                  sequence,
                  (
                      h_next[layer : layer + 1],
                      c_next[layer : layer + 1],
                  ),
              ) = self.decoder[layer](
                  sequence,
                  hx=(
                      h_prev[layer : layer + 1],
                      c_prev[layer : layer + 1],
                  ),
              )
          else:
              sequence, h_next[layer : layer + 1] = self.decoder[layer](
                  sequence, hx=h_prev[layer : layer + 1]
              )
  
          sequence = self.dropout_dec(sequence)
  
      return sequence, (h_next, c_next)
  
file_path: espnet/espnet/nets/pytorch_backend/transducer/rnn_decoder.py
imports: from typing import Any, Dict, List, Optional, Tuple, Union
  import torch
  from espnet.nets.transducer_decoder_interface import ExtendedHypothesis, Hypothesis, TransducerDecoderInterface
label_desc: Use image node_id 4 for calling the RNNDecoder obj's underlying member method code with example usage: obj.rnn_forward(sequence, state) and returns: sequence,  h_next,  c_next