You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ma...@apache.org on 2022/07/30 08:28:47 UTC

[tvm] branch main updated: remove duplicated cast op when lowering qnn.requantize op in float mode (#12234)

This is an automated email from the ASF dual-hosted git repository.

masahi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new fb87c21bf8 remove duplicated cast op when lowering qnn.requantize op in float mode (#12234)
fb87c21bf8 is described below

commit fb87c21bf8d0fa5edec96a054a57a6d37c11289f
Author: paperplanet <et...@gmail.com>
AuthorDate: Sat Jul 30 16:28:39 2022 +0800

    remove duplicated cast op when lowering qnn.requantize op in float mode (#12234)
---
 src/relay/qnn/op/requantize.cc | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/relay/qnn/op/requantize.cc b/src/relay/qnn/op/requantize.cc
index 2a6153e810..5bf53a95ed 100644
--- a/src/relay/qnn/op/requantize.cc
+++ b/src/relay/qnn/op/requantize.cc
@@ -303,10 +303,7 @@ Expr RequantizeLowerFP(const Expr& input_tensor, const Expr& input_scale,
                                                                   -1,
                                                               }),
                                                       rank, {axis});
-    tensor = Subtract(Cast(tensor, DataType::Float(Bits)),
-                      Cast(input_zero_broadcast, DataType::Float(Bits)));
-  } else {
-    tensor = Cast(tensor, DataType::Float(Bits));
+    tensor = Subtract(tensor, Cast(input_zero_broadcast, DataType::Float(Bits)));
   }
 
   // 2) If the input and output scales are same, we can skip the multiplication. Check