->Decoder class
{moderator edit - solution code removed}
Implementation check:-
Do a quick check of your implementation
Create an instance of your class
decoder = Decoder(VOCAB_SIZE, UNITS)
Notice that you don’t need the embedded version of sr_translation since this is done inside the class
logits = decoder(encoder_output, sr_translation)
print(f’Tensor of contexts has shape: {encoder_output.shape}‘)
print(f’Tensor of right-shifted translations has shape: {sr_translation.shape}’)
print(f’Tensor of logits has shape: {logits.shape}')
output:-
Tensor of contexts has shape: (64, 14, 256)
Tensor of right-shifted translations has shape: (64, 15)
Tensor of logits has shape: (64, 15, 12000)
Expected Output
Tensor of contexts has shape: (64, 14, 256)
Tensor of right-shifted translations has shape: (64, 15)
Tensor of logits has shape: (64, 15, 12000)
Expected output is matching with output but still
w1_unittest.test_decoder(Decoder, CrossAttention)
says:-
Failed test case: Incorrect third dimension of decoder output.
Expected: 6
Got: 12000