CharConvEmbedder

class opennmt.inputters.CharConvEmbedder(*args, **kwargs)[source]

An inputter that applies a convolution on characters embeddings.

Inherits from: opennmt.inputters.CharEmbedder

__init__(embedding_size, num_outputs, kernel_size=5, stride=3, dropout=0.0, **kwargs)[source]

Initializes the parameters of the character convolution embedder.

Parameters
  • embedding_size – The size of the character embedding.

  • num_outputs – The dimension of the convolution output space.

  • kernel_size – Length of the convolution window.

  • stride – Length of the convolution stride.

  • dropout – The probability to drop units in the embedding.

  • **kwargs – Additional layer keyword arguments.

call(features, training=None)[source]

Creates the model input from the features (e.g. word embeddings).

Parameters
Returns

The model input.