espnet.nets.pytorch_backend.transducer.rnn_encoder.RNN
Less than 1 minute
espnet.nets.pytorch_backend.transducer.rnn_encoder.RNN
class espnet.nets.pytorch_backend.transducer.rnn_encoder.RNN(idim: int, rnn_type: str, elayers: int, eunits: int, eprojs: int, dropout_rate: float, aux_output_layers: List = [])
Bases: Module
RNN module.
- Parameters:
- idim – Input dimension.
- rnn_type – RNN units type.
- elayers – Number of RNN layers.
- eunits – Number of units ((2 * eunits) if bidirectional)
- eprojs – Number of final projection units.
- dropout_rate – Dropout rate for RNN layers.
- aux_output_layers – List of layer IDs for auxiliary RNN output sequences.
Initialize RNN module.
forward(rnn_input: Tensor, rnn_len: Tensor, prev_states: List[Tensor] | None = None) → Tuple[Tensor, List[Tensor], Tensor]
RNN forward.
Parameters:
- rnn_input – RNN input sequences. (B, T, D_in)
- rnn_len – RNN input sequences lengths. (B,)
- prev_states – RNN hidden states. [N x (B, T, D_proj)]
Returns: RNN output sequences. (B, T, D_proj) : with or without intermediate RNN output sequences. ((B, T, D_proj), [N x (B, T, D_proj)])
rnn_len: RNN output sequences lengths. (B,) current_states: RNN hidden states. [N x (B, T, D_proj)]
Return type: rnn_output