Course 5 week 4 UNQ_C2, test is not passing.It is showing Wrong shape. We expected: (1, 8, 16).Please help

course 5 week 4 UNQ_C2, test is not passing.It is showing Wrong shape. We expected: (1, 8, 16).Please help

I had that same error, make sure that you are using positions instead of position, the autocomplete tricked me there, position is used in the previous cell as a global variable, so it is in the scope of the positional_encoding function.

11 Likes

The issue could be the initialization of matrix angle_rads.

For the correct initalisation, you need to specify the first and second parameters (positions,
dimensions of i) correctly. To do so you need to (pre-) transform the arguments provided (i.e. positions, d). You find a hint of how to do this in the Unit Test (and other posts in this forum). Do the same for “positions” as you do for i (“dims”)!

This resolved the issue for me, I hope this helps!

3 Likes

Yep, we need to pre process the first and second dimensions of angle_rads. An important hint: check out the very previous cell ( get_angles_test() ) :wink:

2 Likes