mseth10 commented on a change in pull request #13328: adding test for softmax 
operator for large negative inputs
URL: https://github.com/apache/incubator-mxnet/pull/13328#discussion_r235278053
 
 

 ##########
 File path: tests/python/unittest/test_operator.py
 ##########
 @@ -4449,6 +4449,20 @@ def test_log_softmax():
             check_symbolic_forward(sym, [data], [np.log(np_softmax(data, 
axis=axis)+1e-20)])
             check_numeric_gradient(sym, [data], rtol=0.05, atol=1e-3)
 
+def test_softmax_with_large_inputs():
+    def softmax_forward(input_data, true_output):
+        data = mx.sym.Variable('data')
+        out1 = data.softmax(axis=1)
+        exec1 = out1.bind(mx.cpu(), args={'data': input_data})
+        exec1.forward()[0].wait_to_read()
+        ndarr = exec1.outputs[0][0][0][0]
+        nparr = ndarr.asnumpy()
+        assert np.array_equal(nparr, true_output)
 
 Review comment:
   assert_almost_equal makes more sense as we are comparing floats here. 
Corrected.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to