in “def positional_encoding(positions, d)”, got error during test, please help:
TypeError Traceback (most recent call last)
in
1 # UNIT TEST
----> 2 positional_encoding_test(positional_encoding, get_angles)
~/work/W4A1/public_tests.py in positional_encoding_test(target, get_angles)
26 d_model = 16
27
—> 28 pos_encoding = target(position, d_model)
29 sin_part = pos_encoding[:, :, 0::2]
30 cos_part = pos_encoding[:, :, 1::2]
in positional_encoding(positions, d)
17
18 # apply sin to even indices in the array; 2i
—> 19 angle_rads[:, 0::2] =np.sin(angle_rads[:,0::2])
20
21 # apply cos to odd indices in the array; 2i+1
TypeError: ‘float’ object is not subscriptable