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/03 03:55:46 UTC

[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

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