masahi commented on code in PR #14536:
URL: https://github.com/apache/tvm/pull/14536#discussion_r1162060645


##########
tests/python/relay/test_pass_fake_quantization_to_integer.py:
##########
@@ -1114,5 +1114,36 @@ def test_fake_quantize_take():
     compare_fq_to_int(op, [x_np])
 
 
+def test_fake_quantize_softmax():
+    x = relay.var("x", shape=[5, 10], dtype="float32")
+
+    x = relay.qnn.op.quantize(x, relay.const(0.08), relay.const(-48), 
out_dtype="int8")
+    x = relay.qnn.op.dequantize(x, relay.const(0.08), relay.const(-48))
+    op = relay.op.nn.softmax(x, axis=1)
+    op = relay.qnn.op.quantize(op, relay.const(0.0038), relay.const(-128), 
out_dtype="int8")
+    op = relay.qnn.op.dequantize(op, relay.const(0.0038), relay.const(-128))
+
+    x_np = np.random.random_sample([5, 10]).astype(np.float32) * 20.0 - 6

Review Comment:
   Yes it looks good. We should also test on uint8. A new feature involving 
subtle arithmetic like this should be tested very thoroughly. See also the 
remark by @ibsidorenko 



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

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to