Computes an alignment score for query
.
Computes an alignment score for query
.
Query tensor.
Current attention mechanism state (defaults to the previous alignment tensor). The data type of
this tensor matches that of values
and its shape is [batchSize, alignmentSize]
, where
alignmentSize
is the memory's maximum time.
Score tensor.
Computes an alignment tensor given the provided query and previous alignment tensor.
Computes an alignment tensor given the provided query and previous alignment tensor.
The previous alignment tensor is important for attention mechanisms that use the previous alignment to calculate the attention at the next time step, such as monotonic attention mechanisms.
TODO: Figure out how to generalize the "next state" functionality.
Query tensor.
Previous alignment tensor.
Tuple containing the alignment tensor and the next attention state.
Initial alignment value.
Initial alignment value.
This is important for attention mechanisms that use the previous alignment to calculate the alignment at the next time step (e.g., monotonic attention).
The default behavior is to return a tensor of all zeros.
Initial state value.
Initial state value.
This is important for attention mechanisms that use the previous alignment to calculate the alignment at the next time step (e.g., monotonic attention).
The default behavior is to return the same output as initialAlignment
.
Computes alignment probabilities for score
.
Computes alignment probabilities for score
.
Alignment score tensor.
Current attention mechanism state (defaults to the previous alignment tensor). The data type of
this tensor matches that of values
and its shape is [batchSize, alignmentSize]
, where
alignmentSize
is the memory's maximum time.
Alignment probabilities tensor.
Base class for attention models that use as state the previous alignment.