Learn Before
Decoder Base Interface
The Decoder serves as the abstract base interface for the decoding phase within the encoder-decoder architecture. To support the step-by-step generation of variable-length sequences, this interface defines two essential methods. First, the init_state method converts the outputs generated by the encoder (and potentially additional information, such as the valid sequence length) into the initial internal state of the decoder. Second, a forward execution method (such as forward in PyTorch, call in JAX, or call in TensorFlow) is mandated; this method maps the input at the current time step (often the token generated at the previous step) and the current internal state to produce the output token for the current time step.
0
1
Tags
D2L
Dive into Deep Learning @ D2L