You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/02/07 21:08:38 UTC

[GitHub] [tvm] AndrewZhaoLuo commented on a change in pull request #10170: [FQ2I] Add topk to FQ2I

AndrewZhaoLuo commented on a change in pull request #10170:
URL: https://github.com/apache/tvm/pull/10170#discussion_r801057640



##########
File path: src/runtime/contrib/sort/sort.cc
##########
@@ -446,6 +446,20 @@ TVM_REGISTER_GLOBAL("tvm.contrib.sort.topk").set_body([](TVMArgs args, TVMRetVal
     } else {
       LOG(FATAL) << "Unsupported output dtype: " << out_dtype;
     }
+  } else if (data_dtype == "int8") {

Review comment:
       what about uint8 dtypes?

##########
File path: tests/python/relay/test_pass_fake_quantization_to_integer.py
##########
@@ -434,6 +434,21 @@ def test_fake_quantize_concat():
     compare_fq_to_int(out, inputs_np)
 
 
+@pytest.mark.parametrize("k", [0, 1, 5])
+@pytest.mark.parametrize("axis", [0, -1, 1])
+@pytest.mark.parametrize("is_ascend", [True, False])
+def test_fake_quantize_topk(k, axis, is_ascend):
+    x = relay.var("x", shape=[20, 100], dtype="int8")
+    zero = relay.const(0)
+
+    x = relay.qnn.op.dequantize(x, relay.const(2.0), zero)
+    op = relay.topk(x, k, axis, "values", is_ascend, "float32")
+    op = relay.qnn.op.quantize(op, relay.const(2.0), zero, out_dtype="int8")

Review comment:
       probably also want uint8




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

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org