C5_W4_A1 An error with positional_encoding

positional_encoding is supposed to return pos_encoding with the dimensions (1, position, d_model). When I run `positional_encoding_test’, the assertion expects dimension of (1, 8, 16). However, when I place a print statement below:

# START CODE HERE
# initialize a matrix angle_rads of all the angles 
print('position=',position)

I get position=4. I can fix the problem by multiplying position by 2 when I call get_angles. However, why doesn’t the output dimension agree with the position? Is this an error in the problem?
.

Hey @Andrew_Marcus,
I don’t think there is an error in the test-cases. Can you please let us know if your implementation is passing the test-cases or not? If it doesn’t, then essentially your implementation is missing something. For instance, did you apply sin to even indices and cos to odd indices? Perhaps, you only did one of them and missed out on the other. Let me know if this helps.

Cheers,
Elemento

Never mind… I misspelled positions as position… a vision problem.

2 Likes