josephevans commented on a change in pull request #19737:
URL: https://github.com/apache/incubator-mxnet/pull/19737#discussion_r556134478



##########
File path: python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
##########
@@ -2784,6 +2784,48 @@ def convert_arange(node, **kwargs):
     return nodes
 
 
+@mx_op.register("reverse")
+def convert_reverse(node, **kwargs):
+    """Map MXNet's reverse operator attributes to ONNX
+    """
+    from onnx.helper import make_node
+    name, input_nodes, attrs = get_inputs(node, kwargs)
+
+    axis = int(attrs.get('axis', 0))
+
+    # Transpose takes perm as a parameter, so we must 'pad' the input to a 
known dim (10 here)
+    perm = [i for i in range(10)]

Review comment:
       what happens if 10 is not enough?

##########
File path: python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
##########
@@ -2784,6 +2784,48 @@ def convert_arange(node, **kwargs):
     return nodes
 
 
+@mx_op.register("reverse")
+def convert_reverse(node, **kwargs):
+    """Map MXNet's reverse operator attributes to ONNX
+    """
+    from onnx.helper import make_node
+    name, input_nodes, attrs = get_inputs(node, kwargs)
+
+    axis = int(attrs.get('axis', 0))
+
+    # Transpose takes perm as a parameter, so we must 'pad' the input to a 
known dim (10 here)
+    perm = [i for i in range(10)]
+    perm[0], perm[axis] = axis, 0
+    print(perm)

Review comment:
       remove debug?




----------------------------------------------------------------
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:
[email protected]


Reply via email to