Can’t find the issue here. i set x_exp=exp(x) and divided s=x_exp/x_sum the output shows wrong.
Output:
softmax(x) = [[5.06442745e+02 4.61816006e-01 9.27582244e+00 6.25000000e-02
6.25000000e-02]
[9.13860965e+01 1.23677633e+01 8.33333333e-02 8.33333333e-02
8.33333333e-02]]
Error: Wrong output
2 Tests passed
1 Tests failed
AssertionError Traceback (most recent call last)
in
3 print("softmax(x) = " + str(softmax(t_x)))
4
----> 5 softmax_test(softmax)
~/work/release/W2A1/public_tests.py in softmax_test(target)
195 ]
196
→ 197 test(test_cases, target)
198
199 def L1_test(target):
~/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.