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/05 21:54:10 UTC

[GitHub] [incubator-mxnet] Zha0q1 commented on a change in pull request #19854: [v1.x] ONNX support for argsort

Zha0q1 commented on a change in pull request #19854:
URL: https://github.com/apache/incubator-mxnet/pull/19854#discussion_r571271122



##########
File path: python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
##########
@@ -3871,3 +3872,42 @@ def convert_log2(node, **kwargs):
     ]
 
     return nodes
+
+
+@mx_op.register('argsort')
+def convert_argsort(node, **kwargs):
+    """Map MXNet's argsort operator attributes to onnx's TopK operator
+    """
+    from onnx.helper import make_node
+    name, input_nodes, attrs = get_inputs(node, kwargs)
+
+    opset_version = kwargs['opset_version']
+    if opset_version < 11:
+        raise AttributeError('ONNX opset 11 or greater is required to export this operator')
+
+    axis = int(attrs.get('axis', '-1'))
+    is_ascend = attrs.get('is_ascend', 'True')
+    print(is_ascend)

Review comment:
       Right!




----------------------------------------------------------------
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