C5W4A1 Ex1 Get Angles

I get the below assertion error for what i thought would be an easy computation for the angles in exercise 1. A previous post on this issue didn’t give any insight on where i am going wrong. Any guidance would be appreciated.

AssertionError Traceback (most recent call last)
in
1 from public_tests import *
2
----> 3 get_angles_test(get_angles)
4
5 # Example

~/work/W4A1/public_tests.py in get_angles_test(target)
13 assert result.shape == (position, d_model), f"Wrong shape. We expected: ({position}, {d_model})"
14 assert np.sum(result[0, :]) == 0
—> 15 assert np.isclose(np.sum(result[:, 0]), position * (position - 1) / 2)
16 even_cols = result[:, 0::2]
17 odd_cols = result[:, 1::2]

AssertionError:

{mentor edit: reply has been edited}

Your right! I neglected to use numpy in the expression for the angles. Thanks for your prompt reply!

1 Like