Example

Seq2SeqAttentionDecoder Output Shape Verification

The Seq2SeqAttentionDecoder can be verified by instantiating a test configuration with vocab_size =10= 10, embed_size =8= 8, num_hiddens =16= 16, and num_layers =2= 2, then feeding a minibatch of 44 sequences each with 77 time steps. After running the encoder and initializing the decoder state, the forward pass produces an output tensor of shape (batch_size, num_steps, vocab_size) =(4,7,10)= (4, 7, 10). The returned state contains the encoder outputs of shape (batch_size, num_steps, num_hiddens) =(4,7,16)= (4, 7, 16) and a per-layer decoder hidden state where each layer has shape (batch_size, num_hiddens) =(4,16)= (4, 16).

0

1

Updated 2026-05-14

Contributors are:

Who are from:

Tags

D2L

Dive into Deep Learning @ D2L