Roshrini commented on a change in pull request #12633: Onnx version update from 
1.2.1 to 1.3 in CI
URL: https://github.com/apache/incubator-mxnet/pull/12633#discussion_r221040423
 
 

 ##########
 File path: python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
 ##########
 @@ -1841,20 +1840,24 @@ def convert_cast(node, **kwargs):
     """Map MXNet's Cast operator attributes to onnx's Cast operator
     and return the created node.
     """
-    helper, _, _ = import_onnx_modules()
+    onnx = import_onnx_modules()
     name = node["name"]
     proc_nodes = kwargs["proc_nodes"]
     inputs = node["inputs"]
     dtype = node["attrs"]["dtype"]
+    if dtype == 'float32':
+        dtype = 'float'
+    elif dtype == 'float64':
 
 Review comment:
   This is mapping from mxnet's dtype for cast operator to onnx's dtypes. Added 
comment to better explain.
   
   TensorProto maps 'float32' to 'float' and 'float64' to 'double'. Rest of the 
types are handled by this line while creating cast op node->   " 
to=getattr(onnx.TensorProto, dtype.upper())",

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to