future_mask
- opennmt.layers.future_mask(sequence_length, maximum_length=None, dtype=tf.bool)[source]
Builds the dot product mask for future positions.
- Parameters
sequence_length – The sequence length.
maximum_length – Optional size of the returned time dimension. Otherwise it is the maximum of
sequence_length
.dtype – The type of the mask tensor.
- Returns
A
tf.Tensor
of typedtype
and shape[batch_size, max_length, max_length]
.