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/02/24 19:15:49 UTC
[GitHub] [incubator-mxnet] josephevans opened a new pull request #19952: [v1.x] Add onnx export support and unit tests for one_hot.
josephevans opened a new pull request #19952:
URL: https://github.com/apache/incubator-mxnet/pull/19952
## Description ##
Add onnx export function and unit tests for one_hot operator.
----------------------------------------------------------------
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
[GitHub] [incubator-mxnet] Zha0q1 commented on a change in pull request #19952: [v1.x] Add onnx export support for one_hot and random_uniform_like and unit tests for one_hot.
Posted by GitBox <gi...@apache.org>.
Zha0q1 commented on a change in pull request #19952:
URL: https://github.com/apache/incubator-mxnet/pull/19952#discussion_r582517876
##########
File path: tests/python-pytest/onnx/test_operators.py
##########
@@ -1183,6 +1183,15 @@ def test_onnx_export_take_raise(tmp_path, dtype, axis):
op_export_test('take', M, [x, y], tmp_path)
+# onnxruntime currently only supports float32 and int64
+@pytest.mark.parametrize("dtype", ["float32", "int64"])
+@pytest.mark.parametrize("depth", [1, 3, 5, 10])
+def test_onnx_export_one_hot(tmp_path, dtype, depth):
+ M = def_model('one_hot', depth=depth, dtype=dtype)
+ x = mx.random.randint(0, 10, (depth * depth)).astype('int64')
Review comment:
Also I think mxnet one_hot can also take non-int64 input, in that case we might need to add a `Cast` op before 'OneHot'
----------------------------------------------------------------
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
[GitHub] [incubator-mxnet] Zha0q1 commented on a change in pull request #19952: [v1.x] Add onnx export support for one_hot and random_uniform_like and unit tests for one_hot.
Posted by GitBox <gi...@apache.org>.
Zha0q1 commented on a change in pull request #19952:
URL: https://github.com/apache/incubator-mxnet/pull/19952#discussion_r585094736
##########
File path: tests/python-pytest/onnx/test_operators.py
##########
@@ -1183,6 +1183,15 @@ def test_onnx_export_take_raise(tmp_path, dtype, axis):
op_export_test('take', M, [x, y], tmp_path)
+# onnxruntime currently only supports float32 and int64
+@pytest.mark.parametrize("dtype", ["float32", "int64"])
+@pytest.mark.parametrize("depth", [1, 3, 5, 10])
+def test_onnx_export_one_hot(tmp_path, dtype, depth):
+ M = def_model('one_hot', depth=depth, dtype=dtype)
+ x = mx.random.randint(0, 10, (depth * depth)).astype('int64')
Review comment:
i see thanks!
----------------------------------------------------------------
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
[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #19952: [v1.x] Add onnx export support and unit tests for one_hot.
Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #19952:
URL: https://github.com/apache/incubator-mxnet/pull/19952#issuecomment-785310918
Hey @josephevans , Thanks for submitting the PR
All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands:
- To trigger all jobs: @mxnet-bot run ci [all]
- To trigger specific jobs: @mxnet-bot run ci [job1, job2]
***
**CI supported jobs**: [clang, centos-cpu, centos-gpu, edge, unix-cpu, sanity, windows-cpu, miscellaneous, website, unix-gpu, windows-gpu]
***
_Note_:
Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin.
All CI tests must pass before the PR can be merged.
----------------------------------------------------------------
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
[GitHub] [incubator-mxnet] Zha0q1 merged pull request #19952: [v1.x] Add onnx export support for one_hot and random_uniform_like and unit tests for one_hot.
Posted by GitBox <gi...@apache.org>.
Zha0q1 merged pull request #19952:
URL: https://github.com/apache/incubator-mxnet/pull/19952
----------------------------------------------------------------
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
[GitHub] [incubator-mxnet] Zha0q1 commented on a change in pull request #19952: [v1.x] Add onnx export support for one_hot and random_uniform_like and unit tests for one_hot.
Posted by GitBox <gi...@apache.org>.
Zha0q1 commented on a change in pull request #19952:
URL: https://github.com/apache/incubator-mxnet/pull/19952#discussion_r582516404
##########
File path: tests/python-pytest/onnx/test_operators.py
##########
@@ -1183,6 +1183,15 @@ def test_onnx_export_take_raise(tmp_path, dtype, axis):
op_export_test('take', M, [x, y], tmp_path)
+# onnxruntime currently only supports float32 and int64
+@pytest.mark.parametrize("dtype", ["float32", "int64"])
+@pytest.mark.parametrize("depth", [1, 3, 5, 10])
+def test_onnx_export_one_hot(tmp_path, dtype, depth):
+ M = def_model('one_hot', depth=depth, dtype=dtype)
+ x = mx.random.randint(0, 10, (depth * depth)).astype('int64')
Review comment:
shall we use a separate parameter to control the shape?
----------------------------------------------------------------
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
[GitHub] [incubator-mxnet] josephevans commented on a change in pull request #19952: [v1.x] Add onnx export support for one_hot and random_uniform_like and unit tests for one_hot.
Posted by GitBox <gi...@apache.org>.
josephevans commented on a change in pull request #19952:
URL: https://github.com/apache/incubator-mxnet/pull/19952#discussion_r585142559
##########
File path: tests/python-pytest/onnx/test_operators.py
##########
@@ -1183,6 +1183,15 @@ def test_onnx_export_take_raise(tmp_path, dtype, axis):
op_export_test('take', M, [x, y], tmp_path)
+# onnxruntime currently only supports float32 and int64
+@pytest.mark.parametrize("dtype", ["float32", "int64"])
+@pytest.mark.parametrize("depth", [1, 3, 5, 10])
+def test_onnx_export_one_hot(tmp_path, dtype, depth):
+ M = def_model('one_hot', depth=depth, dtype=dtype)
+ x = mx.random.randint(0, 10, (depth * depth)).astype('int64')
Review comment:
Added a shape parameter.
----------------------------------------------------------------
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
[GitHub] [incubator-mxnet] josephevans commented on a change in pull request #19952: [v1.x] Add onnx export support for one_hot and random_uniform_like and unit tests for one_hot.
Posted by GitBox <gi...@apache.org>.
josephevans commented on a change in pull request #19952:
URL: https://github.com/apache/incubator-mxnet/pull/19952#discussion_r585092809
##########
File path: tests/python-pytest/onnx/test_operators.py
##########
@@ -1183,6 +1183,15 @@ def test_onnx_export_take_raise(tmp_path, dtype, axis):
op_export_test('take', M, [x, y], tmp_path)
+# onnxruntime currently only supports float32 and int64
+@pytest.mark.parametrize("dtype", ["float32", "int64"])
+@pytest.mark.parametrize("depth", [1, 3, 5, 10])
+def test_onnx_export_one_hot(tmp_path, dtype, depth):
+ M = def_model('one_hot', depth=depth, dtype=dtype)
+ x = mx.random.randint(0, 10, (depth * depth)).astype('int64')
Review comment:
Thanks for the feedback. It looks like it is already cast to int64 based on the onnx documentation (https://github.com/onnx/onnx/blob/master/docs/Changelog.md#OneHot-11):
`In case 'indices' is of non-integer type, the values will be casted to int64 before use.`
----------------------------------------------------------------
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
[GitHub] [incubator-mxnet] Zha0q1 commented on a change in pull request #19952: [v1.x] Add onnx export support for one_hot and random_uniform_like and unit tests for one_hot.
Posted by GitBox <gi...@apache.org>.
Zha0q1 commented on a change in pull request #19952:
URL: https://github.com/apache/incubator-mxnet/pull/19952#discussion_r582517876
##########
File path: tests/python-pytest/onnx/test_operators.py
##########
@@ -1183,6 +1183,15 @@ def test_onnx_export_take_raise(tmp_path, dtype, axis):
op_export_test('take', M, [x, y], tmp_path)
+# onnxruntime currently only supports float32 and int64
+@pytest.mark.parametrize("dtype", ["float32", "int64"])
+@pytest.mark.parametrize("depth", [1, 3, 5, 10])
+def test_onnx_export_one_hot(tmp_path, dtype, depth):
+ M = def_model('one_hot', depth=depth, dtype=dtype)
+ x = mx.random.randint(0, 10, (depth * depth)).astype('int64')
Review comment:
Also I think mxnet one_hot can also take non-int64 input, in that case we might need to add a `Cast` op before `OneHot`
----------------------------------------------------------------
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