Week 1, Exercise 1: Some Test Cases Failing

In the first assignment of week 1, i.e., “Python Basics with Numpy”, we have been asked to code the graded function softmax in the seventh part of the exercise. Even though I implemented the 3 steps approach to compute s, I am not getting all the test cases passed. I first applied exponential function element-wise on the input vector/matrix x using np.exp(x). After that, I applied np.sum() to compute the sum row wise. Finally, I used broadcasting while dividing the two variables (vectors/matrices) obtained in the first two steps. Still, it is showing that one test case is getting failed.

I tried printing the outputs of intermediate steps to search where I’m going wrong. But I was unable to figure out. I shall be obliged if someone could help me regarding this. Thank you in advance!

I figured this out. Actually, I was dividing x / x_sum rather than x_exp / x_sum. Therefore, some test cases were failing. Thank you! :slight_smile: