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/02 20:13:38 UTC

[GitHub] [incubator-mxnet] Zha0q1 opened a new pull request #19823: [v1.x] ONNX 1.6 compatibility fix + fix for when multiple nodes have the same name

Zha0q1 opened a new pull request #19823:
URL: https://github.com/apache/incubator-mxnet/pull/19823


   This pr fixes:
   1. softmax when axis == -1
   2. compatibility with onnx 1.6
   3. adds a prefix (index) to the exported nodes so that we can handle when multiple nodes have the same name


----------------------------------------------------------------
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 #19823: [v1.x] ONNX 1.6 compatibility fix + fix for when multiple nodes have the same name

Posted by GitBox <gi...@apache.org>.
Zha0q1 commented on a change in pull request #19823:
URL: https://github.com/apache/incubator-mxnet/pull/19823#discussion_r569114430



##########
File path: python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
##########
@@ -2333,14 +2333,16 @@ def convert_layer_norm(node, **kwargs):
     axes = int(attrs.get('axis', -1))
     eps = attrs.get('eps', 9.99999975e-06)
 
+    input_type = int(kwargs['in_type'])
+    dtype = onnx.mapping.TENSOR_TYPE_TO_NP_TYPE[input_type]
 
     nodes = [
         create_tensor([axes], name+"_axes", kwargs["initializer"]),
         create_tensor([axes+1], name+"_axes+1", kwargs["initializer"]),
         create_tensor([], name+"_void", kwargs["initializer"]),
         create_const_scalar_node(name+'_0_s', np.int64(0), kwargs),
         create_const_scalar_node(name+'_1_s', np.int64(1), kwargs),
-        create_const_scalar_node(name+"_2_s", np.int64(2), kwargs),
+        create_const_scalar_node(name+"_2_s", np.array(2, dtype=dtype), kwargs),

Review comment:
       This is a constant node. We just need to control the dtype so now we cannot use np.int64 or for that same reason np.float32 any more 




----------------------------------------------------------------
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 #19823: [v1.x] ONNX 1.6 compatibility fix + fix for when multiple nodes have the same name

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #19823:
URL: https://github.com/apache/incubator-mxnet/pull/19823#issuecomment-771947448


   Hey @Zha0q1 , 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**: [unix-cpu, website, centos-gpu, clang, centos-cpu, edge, unix-gpu, windows-gpu, windows-cpu, sanity, miscellaneous]
   *** 
   _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] waytrue17 commented on a change in pull request #19823: [v1.x] ONNX 1.6 compatibility fix + fix for when multiple nodes have the same name

Posted by GitBox <gi...@apache.org>.
waytrue17 commented on a change in pull request #19823:
URL: https://github.com/apache/incubator-mxnet/pull/19823#discussion_r569122088



##########
File path: python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
##########
@@ -2333,14 +2333,16 @@ def convert_layer_norm(node, **kwargs):
     axes = int(attrs.get('axis', -1))
     eps = attrs.get('eps', 9.99999975e-06)
 
+    input_type = int(kwargs['in_type'])
+    dtype = onnx.mapping.TENSOR_TYPE_TO_NP_TYPE[input_type]
 
     nodes = [
         create_tensor([axes], name+"_axes", kwargs["initializer"]),
         create_tensor([axes+1], name+"_axes+1", kwargs["initializer"]),
         create_tensor([], name+"_void", kwargs["initializer"]),
         create_const_scalar_node(name+'_0_s', np.int64(0), kwargs),
         create_const_scalar_node(name+'_1_s', np.int64(1), kwargs),
-        create_const_scalar_node(name+"_2_s", np.int64(2), kwargs),
+        create_const_scalar_node(name+"_2_s", np.array(2, dtype=dtype), kwargs),

Review comment:
       Makes sense, 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] Zha0q1 merged pull request #19823: [v1.x] ONNX 1.6 compatibility fix + fix for when multiple nodes have the same name

Posted by GitBox <gi...@apache.org>.
Zha0q1 merged pull request #19823:
URL: https://github.com/apache/incubator-mxnet/pull/19823


   


----------------------------------------------------------------
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 #19823: [v1.x] ONNX 1.6 compatibility fix + fix for when multiple nodes have the same name

Posted by GitBox <gi...@apache.org>.
Zha0q1 merged pull request #19823:
URL: https://github.com/apache/incubator-mxnet/pull/19823


   


----------------------------------------------------------------
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] waytrue17 commented on a change in pull request #19823: [v1.x] ONNX 1.6 compatibility fix + fix for when multiple nodes have the same name

Posted by GitBox <gi...@apache.org>.
waytrue17 commented on a change in pull request #19823:
URL: https://github.com/apache/incubator-mxnet/pull/19823#discussion_r569112719



##########
File path: python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
##########
@@ -2333,14 +2333,16 @@ def convert_layer_norm(node, **kwargs):
     axes = int(attrs.get('axis', -1))
     eps = attrs.get('eps', 9.99999975e-06)
 
+    input_type = int(kwargs['in_type'])
+    dtype = onnx.mapping.TENSOR_TYPE_TO_NP_TYPE[input_type]
 
     nodes = [
         create_tensor([axes], name+"_axes", kwargs["initializer"]),
         create_tensor([axes+1], name+"_axes+1", kwargs["initializer"]),
         create_tensor([], name+"_void", kwargs["initializer"]),
         create_const_scalar_node(name+'_0_s', np.int64(0), kwargs),
         create_const_scalar_node(name+'_1_s', np.int64(1), kwargs),
-        create_const_scalar_node(name+"_2_s", np.int64(2), kwargs),
+        create_const_scalar_node(name+"_2_s", np.array(2, dtype=dtype), kwargs),

Review comment:
       Curious, why do we use array for this const node?




----------------------------------------------------------------
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 #19823: [v1.x] ONNX 1.6 compatibility fix + fix for when multiple nodes have the same name

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #19823:
URL: https://github.com/apache/incubator-mxnet/pull/19823#issuecomment-771947448


   Hey @Zha0q1 , 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**: [unix-cpu, website, centos-gpu, clang, centos-cpu, edge, unix-gpu, windows-gpu, windows-cpu, sanity, miscellaneous]
   *** 
   _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