W3 A1: Neural_machine_translation_with_attention Exercise 2 - modelf

I passed the unit test for one step attention. In modelf excersice, I got an error saying:

“ValueError: Input 0 of layer dense is incompatible with the layer: expected axis -1 of input shape to have value 128 but received input with shape [None, 30, 124]”

I looked at the shapes of my variables, found the hidden state sequence returned by Bidirectional is (None, 30, 60), instead of 64 on the last axis, so the concat of a and s_prev is 60 + 64 = 124.

Isn’t the output of Bidirectional supposed to be 64 at last axis?

1 Like

The shape of a = Bidirectional(…) should be:
a shape: (None, 30, 64)

If you’re getting (None, 30, 60), there is an error in your code.

2 Likes

I got the bug. Thanks.