I am a bit stuck on Exercise 7 - softmax. The output of the grader is as follows:
Error: Wrong output
2 Tests passed
1 Tests failed
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-36-589a35b2026d> in <module>
3 print("softmax(x) = " + str(softmax(t_x)))
4
----> 5 softmax_test(softmax)
~/work/release/W2A1/public_tests.py in softmax_test(target)
202 ]
203
--> 204 test(test_cases, target)
205
206
~/work/release/W2A1/test_utils.py in test(test_cases, target)
24 print('\033[92m', success," Tests passed")
25 print('\033[91m', len(test_cases) - success, " Tests failed")
---> 26 raise AssertionError("Not all tests were passed for {}. Check your equations and avoid using global variables inside the function.".format(target.__name__))
AssertionError: Not all tests were passed for softmax. Check your equations and avoid using global variables inside the function.
I don’t think I can post any code I wrote, but in summary, I have 3 lines of code, first one computes np.exp, second uses np.sum (I ensure I have axis=1 and keepdims=True). Lastly, I simply divide these two quantities and assign result to s.
Could someone let me know what I might be missing?