W2_tests for test_dot_product_self_attention

I am getting the same results but I am not passing the tests, what am I doing wrong?


AssertionError Traceback (most recent call last)
~/work/w2_tests.py in test_dot_product_self_attention(target)
330 try:
→ 331 assert jnp.isclose(output, expected).all()
332 successful_cases += 1

~/work/w2_tests.py in test_dot_product_self_attention(target)
332 successful_cases += 1
333 except:
→ 334 print(test_case.get(“error”)[1])
335 failed_cases.append(
336 {

TypeError: ‘NoneType’ object is not subscriptable


Your function is correct, the problem is somewhere else. Please message me your notebook and I will take a look. And please remove the code from this post because it contains solutions.

I removed the code containing the solutions as requested.

In # UNQ_C1 DotProductAttention when determining depth value you’re trying to access variable q shape which is not in scope of the function (your argument is query, not q). Also do not leave global variables like the cell above because it could problems for the grader (please read “Important Note on Submission to the AutoGrader” at the top of the Assignment.

Let me know if that fixes your problems. Cheers!

1 Like

Hello arvyzukai, thank you very much for your help. I totally forgot to replace q with query and I got careless. I have also deleted the cell above as suggested by you.

Thank you again and have a great day!


1 Like