GNMTEncoder

class opennmt.encoders.GNMTEncoder(*args, **kwargs)[source]

The RNN encoder used in GNMT as described in https://arxiv.org/abs/1609.08144.

Inherits from: opennmt.encoders.SequentialEncoder

__init__(num_layers, num_units, 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.

  • dropout – The probability to drop units in each layer output.

Raises

ValueError – if num_layers < 2.