PyramidalRNNEncoder
- class opennmt.encoders.PyramidalRNNEncoder(*args, **kwargs)[source]
An encoder that reduces the time dimension after each bidirectional layer.
Inherits from:
opennmt.encoders.Encoder
- __init__(num_layers, num_units, reduction_factor=2, cell_class=None, dropout=0.3)[source]
Initializes the parameters of the encoder.
- Parameters
num_layers – The number of layers.
num_units – The number of units in each layer.
reduction_factor – The time reduction factor.
cell_class – The inner cell class or a callable taking
num_units
as argument and returning a cell. Defaults to a LSTM cell.dropout – The probability to drop units in each layer output.