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 2020/12/17 21:14:52 UTC

[GitHub] [incubator-mxnet] waytrue17 commented on a change in pull request #19691: [WIP] ONNX fix softmax

waytrue17 commented on a change in pull request #19691:
URL: https://github.com/apache/incubator-mxnet/pull/19691#discussion_r545408064



##########
File path: tests/python-pytest/onnx/test_operators.py
##########
@@ -205,3 +206,15 @@ def test_onnx_export_fully_connected(tmp_path, dtype, num_hidden, no_bias, flatt
     if not no_bias:
         args.append(mx.nd.random.uniform(0,1,(num_hidden,)))
     op_export_test('FullyConnected', M, args, tmp_path)
+
+@pytest.mark.parametrize('dtype', ['float32', 'float64'])
+def test_onnx_export_softmax(tmp_path, dtype):
+    x = mx.nd.random.uniform(0, 1, (2, 3, 4), dtype=dtype)
+    M1 = def_model('softmax')
+    op_export_test('softmax_1', M1, [x], tmp_path)
+    M2 = def_model('softmax', use_length=True, axis=0)
+    l2 = mx.nd.array([[2,0,3,1],[1,3,2,0], [0,0,0,1]], dtype=int)

Review comment:
       `l2` and `l3` are intentionally generated to test certain cases e.g. [0,0,0,1] and [0,0,0]. I think it should be fine as `x` is randomly generated.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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