You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/11/20 04:14:14 UTC

[GitHub] pengzhao-intel commented on a change in pull request #13328: adding test for mkldnn softmax operator for large negative inputs

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

 ##########
 File path: tests/python/mkl/test_mkldnn.py
 ##########
 @@ -383,6 +383,17 @@ def check_fullyconnected_training(stype):
     for stype in stypes:
         check_fullyconnected_training(stype)
 
+def test_softmax_with_large_negative_inputs():
+    input_data = mx.nd.array([[[[-1e30,-1e30]]]])
+    data = mx.sym.Variable('data')
+    out1 = data.softmax(axis=1)
+    exec1 = out1.bind(mx.cpu(), args={'data': input_data, 'softmax_label': mx.nd.ones([1]),
+                                      'fc_weight': mx.nd.ones([2,2]), 'fc1_weight': mx.nd.ones([2,2])})
+    exec1.forward()[0].wait_to_read()
+    ndarr = exec1.outputs[0][0][0][0]
+    nparr = ndarr.asnumpy()
+    assert(np.isnan(nparr).any(), False)
 
 Review comment:
   Could you build other corner cases to cover more, such as 1e-30 as input and other possible combinations?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services