tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-tvm] mbrookhart commented on a change in pull request #5441: Add TopK to ONNX Frontend
Date Fri, 24 Apr 2020 23:21:16 GMT

mbrookhart commented on a change in pull request #5441:
URL: https://github.com/apache/incubator-tvm/pull/5441#discussion_r414914928



##########
File path: python/tvm/relay/frontend/onnx.py
##########
@@ -1470,6 +1470,23 @@ def _impl_v9(cls, inputs, attr, params):
         output = AttrCvt(op_name='argwhere')(inputs, attr, params)
         return _op.transpose(output, axes=(1, 0))
 
+class TopK(OnnxOpConverter):
+    """Operator converter for TopK
+    """
+    @classmethod
+    def _impl_v1(cls, inputs, attr, params):
+        if len(inputs) != 2:
+            raise ValueError("Expect 2 input only")
+        inp = inputs[0]
+        axis = attr.get("axis", len(infer_shape(inp)) - 1)
+        largest = attr.get("largest", 1)
+
+        if largest == 0:
+            raise ValueError("TVM only supports finding TopK largest elements")

Review comment:
       It's a boolean value stored as an int. Anything but zero is technically true, and I
only want to throw on the false case.




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



Mime
View raw message