CharRNNEmbedder
- class opennmt.inputters.CharRNNEmbedder(*args, **kwargs)[source]
An inputter that runs a single RNN layer over character embeddings.
Inherits from:
opennmt.inputters.CharEmbedder
- __init__(embedding_size, num_units, dropout=0.2, cell_class=None, **kwargs)[source]
Initializes the parameters of the character RNN embedder.
- Parameters
embedding_size – The size of the character embedding.
num_units – The number of units in the RNN layer.
dropout – The probability to drop units in the embedding and the RNN outputs.
cell_class – The inner cell class or a callable taking
num_units
as argument and returning a cell. Defaults to a LSTM cell.**kwargs – Additional layer keyword arguments.
- Raises
ValueError – if
encoding
is invalid.
- call(features, training=None)[source]
Creates the model input from the features (e.g. word embeddings).
- Parameters
features – A dictionary of
tf.Tensor
, the output ofopennmt.inputters.Inputter.make_features()
.training – Run in training mode.
- Returns
The model input.