DLS course 5 week 4 exercise scaled dot product attention

What do you do when the error message doesn’t really give you anything to go off of? When you read this error message, do you see something Im missing with regards to useful information?


AssertionError Traceback (most recent call last)
in
1 # UNIT TEST
----> 2 scaled_dot_product_attention_test(scaled_dot_product_attention)

~/work/W4A1/public_tests.py in scaled_dot_product_attention_test(target)
66 assert np.allclose(attention, [[0.74105227, 0.15705977],
67 [0.7227253, 0.16817567],
—> 68 [0.6637989, 0.2039163 ]])
69
70 mask = np.array([[[1, 1, 0, 1], [1, 1, 0, 1], [1, 1, 0, 1]]])

AssertionError:

That assert seems to be missing its text message.

But from looking at the assert, you can see that the value it is testing (the returned “attention” value) is failing the “all close” test with the expected results.

Thanks. Its good to know what that means, sometimes I don’t feel like I"m getting all the info out of those error messages. But that makes sense. Thanks

In this specific case, the test that’s failing is the attention values when the mask is set to “None”. i.e. the attention values without a mask applied.

1 Like