neuralmonkey.decoders.word_alignment_decoder module

class neuralmonkey.decoders.word_alignment_decoder.WordAlignmentDecoder(encoder: neuralmonkey.encoders.recurrent.RecurrentEncoder, decoder: neuralmonkey.decoders.decoder.Decoder, data_id: str, name: str, reuse: neuralmonkey.model.model_part.ModelPart = None, initializers: List[Tuple[str, Callable]] = None) → None

Bases: neuralmonkey.model.model_part.ModelPart

A decoder that computes soft alignment from an attentive encoder.

Loss is computed as cross-entropy against a reference alignment.

__init__(encoder: neuralmonkey.encoders.recurrent.RecurrentEncoder, decoder: neuralmonkey.decoders.decoder.Decoder, data_id: str, name: str, reuse: neuralmonkey.model.model_part.ModelPart = None, initializers: List[Tuple[str, Callable]] = None) → None

Construct a new parameterized object.

Parameters:
  • name – The name for the model part. Will be used in the variable and name scopes.
  • reuse – Optional parameterized part with which to share parameters.
  • save_checkpoint – Optional path to a checkpoint file which will store the parameters of this object.
  • load_checkpoint – Optional path to a checkpoint file from which to load initial variables for this object.
  • initializers – An InitializerSpecs instance with specification of the initializers.
alignment_target
cost
decoded
feed_dict(dataset: neuralmonkey.dataset.Dataset, train: bool = False) → Dict[tensorflow.python.framework.ops.Tensor, Any]

Return a feed dictionary for the given feedable object.

Parameters:
  • dataset – A dataset instance from which to get the data.
  • train – Boolean indicating whether the model runs in training mode.
Returns:

A FeedDict dictionary object.

ref_alignment
runtime_loss
runtime_outputs
train_loss