x_exp = np.exp(x)

x_sum = np.sum(x, axis=1, keepdims = True)

s = x_exp / x_sum

AssertionError: Not all tests were passed for softmax. Check your equations and avoid using global variables inside the function.

x_exp = np.exp(x)

x_sum = np.sum(x, axis=1, keepdims = True)

s = x_exp / x_sum

AssertionError: Not all tests were passed for softmax. Check your equations and avoid using global variables inside the function.

Dear @Djedjiga_Chikhi, the assertion error which you’re getting is right. You are using a global variable while running the function in the first equation. Check it out. Also, check your third equation for (s) where you are providing the function in a different way without using the numpy.

Thanks!

Take a more careful look at the formula for *softmax*. You are computing the sum of the x values. That is not what is in the denominator, right? It’s the sum of the e^x values.

@Rashmi: please note that x is not a global variable there. It is the declared argument to the function, so it is local to the scope of the *softmax* function.

Oh, okay sir. Thank you for the clarification.