Course 5 week 4

Hi, I need some assistance. In the get_angles () of transformer assignment, I wrote the following:

angles = (pos/np.exp(10000, np.divide(np.dot(2, i),d)))

I receive the following error when running get_angles_test()


AssertionError Traceback (most recent call last)
in
20 print("\033[92mAll tests passed")
21
—> 22 get_angles_test(get_angles)
23
24 # Example

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

AssertionError:

There are several threads on the Forum about the get_angles() function.

Using np.divide and np.dot is not necessary.
Modulo-division by 2 is sufficient.