Positional_encoding() wrong shape

Please see the code and error below. I’ll delete my code once the error is addressed. I’m not sure what I’m doing wrong but my pos_encoding is not the right shape. I added a new cell to see pos_encoding.shape to figure out what’s wrong, but then I get the error that “pos_encoding is not defined”. I don’t know why this is happening since although the cell outputs the wrong shape, it still runs.

1 Like

The code for the arguments to the get_angles() function is a little weird.

    code removed

Do not add any cells to the notebook. It can make the grader very confused.

1 Like

Thank you Tom. I used the code that you posted and deleted any extra cells, all tests have passed. Could you explain why we need to use this code for the arguments of get_angles(). At the moment I really don’t understand it.

I don’t understand that code either, but Python isn’t my native language.

You are correct - please don’t post your code on the discussion forum.

Your arguments to get_angles are all global variables. That’s not a good idea. None of them are correct for this context.

The correct first two arguments use the np.arrange() function on the ‘positions’ and ‘d’ variables, along with using the tip in the instructions regarding np.newaxis.

The syntax is a little bit inscrutable, though.

thank you!! figured it out. now onto the next error.