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 2021/04/15 20:34:05 UTC

[GitHub] [incubator-mxnet] Zha0q1 commented on a change in pull request #20165: [v1.x] ONNX fix operator batch1

Zha0q1 commented on a change in pull request #20165:
URL: https://github.com/apache/incubator-mxnet/pull/20165#discussion_r614373330



##########
File path: tests/python-pytest/onnx/test_operators.py
##########
@@ -1275,3 +1287,42 @@ def test_onnx_export_contrib_div_sqrt_dim(tmp_path, dtype, shape):
     A = mx.nd.random.uniform(-100, 100, shape).astype(dtype)
     M = def_model('contrib.div_sqrt_dim')
     op_export_test('contrib_div_sqrt_dim', M, [A], tmp_path)
+
+
+# onnxruntime currently does not support int32
+@pytest.mark.parametrize('dtype', ['float16', 'float32', 'int64'])
+@pytest.mark.parametrize('shape', [(1,), (2, 3), (4, 5, 6)])
+def test_onnx_export_clip(tmp_path, dtype, shape):
+    A = mx.nd.random.uniform(-100, 100, shape).astype(dtype)
+    a_min = mx.nd.min(A).astype('float32').asnumpy()[0] + 5
+    a_max = mx.nd.max(A).astype('float32').asnumpy()[0] - 5
+    print(a_min)
+    M = def_model('clip', a_min=a_min, a_max=a_max)
+    op_export_test('clip', M, [A], tmp_path)
+
+
+@pytest.mark.parametrize('dtype', ['float16', 'float32', 'int32', 'int64'])
+@pytest.mark.parametrize('shape', [(3, 4, 5), (6, 7), (8,)])
+@pytest.mark.parametrize('func', [lambda x : x + np.random.rand(1)[0]*100,
+                                  lambda x : x * np.random.rand(1)[0]*100,

Review comment:
       Nice!




-- 
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