ConvEncoder
- class opennmt.encoders.ConvEncoder(*args, **kwargs)[source]
An encoder that applies a convolution over the input sequence as described in https://arxiv.org/abs/1611.02344.
Inherits from:
opennmt.encoders.Encoder
- __init__(num_layers_a, num_layers_c, num_units, kernel_size=3, dropout=0.3, position_encoder_class=<class 'opennmt.layers.position.PositionEmbedder'>)[source]
Initializes the parameters of the encoder.
- Parameters
num_layers_a – The number of layers in CNN-a.
num_layers_c – The number of layers in CNN-c.
num_units – The number of output filters.
kernel_size – The kernel size.
dropout – The probability to drop units from the inputs.
position_encoder_class – The
opennmt.layers.PositionEncoder
class to use for position encoding (or a callable that returns an instance).