MeanEncoder

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

A simple encoder that takes the mean of its inputs.

Inherits from: opennmt.encoders.Encoder

call(inputs, sequence_length=None, training=None)[source]

Encodes an input sequence.

Parameters
  • inputs – The inputs to encode of shape \([B, T, ...]\).

  • sequence_length – The length of each input with shape \([B]\).

  • training – Run in training mode.

Returns

A tuple (outputs, state, sequence_length).