espnet2.asr.encoder.rnn_encoder.RNNEncoder
espnet2.asr.encoder.rnn_encoder.RNNEncoder
class espnet2.asr.encoder.rnn_encoder.RNNEncoder(input_size: int, rnn_type: str = 'lstm', bidirectional: bool = True, use_projection: bool = True, num_layers: int = 4, hidden_size: int = 320, output_size: int = 320, dropout: float = 0.0, subsample: Sequence[int] | None = (2, 2, 1, 1))
Bases: AbsEncoder
RNNEncoder class.
- Parameters:
- input_size – The number of expected features in the input
- output_size – The number of output features
- hidden_size – The number of hidden features
- bidirectional – If
True
becomes a bidirectional LSTM - use_projection – Use projection layer or not
- num_layers – Number of recurrent layers
- dropout – dropout probability
Initializes internal Module state, shared by both nn.Module and ScriptModule.
forward(xs_pad: Tensor, ilens: Tensor, prev_states: Tensor | None = None) → Tuple[Tensor, Tensor, Tensor]
Defines the computation performed at every call.
Should be overridden by all subclasses.
NOTE
Although the recipe for forward pass needs to be defined within this function, one should call the Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
output_size() → int