espnet.nets.pytorch_backend.rnn.encoders.RNNP
Less than 1 minute
espnet.nets.pytorch_backend.rnn.encoders.RNNP
class espnet.nets.pytorch_backend.rnn.encoders.RNNP(idim, elayers, cdim, hdim, subsample, dropout, typ='blstm')
Bases: Module
RNN with projection layer module.
- Parameters:
- idim (int) – dimension of inputs
- elayers (int) – number of encoder layers
- cdim (int) – number of rnn units (resulted in cdim * 2 if bidirectional)
- hdim (int) – number of projection units
- subsample (np.ndarray) – list of subsampling numbers
- dropout (float) – dropout rate
- typ (str) – The RNN type
Initialize RNNP.
forward(xs_pad, ilens, prev_state=None)
Calculate RNNP forward propagation.
- Parameters:
- xs_pad (torch.Tensor) – batch of padded input sequences (B, Tmax, idim)
- ilens (torch.Tensor) – batch of lengths of input sequences (B)
- prev_state (torch.Tensor) – batch of previous RNN states
- Returns: batch of hidden state sequences (B, Tmax, hdim)
- Return type: torch.Tensor