You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by tq...@apache.org on 2021/02/17 14:22:49 UTC

[tvm] branch v0.7 updated: [Backport-0.7][Quantize] Fix Bug Which Cause Negative Left Shift Op (#7433)

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

tqchen pushed a commit to branch v0.7
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/v0.7 by this push:
     new 56000bb  [Backport-0.7][Quantize] Fix Bug Which Cause Negative Left Shift Op (#7433)
56000bb is described below

commit 56000bb68a32e4e8bcac5119b1e07a3545b13ccc
Author: Qiang Zhang <jo...@163.com>
AuthorDate: Wed Feb 17 22:22:32 2021 +0800

    [Backport-0.7][Quantize] Fix Bug Which Cause Negative Left Shift Op (#7433)
---
 src/relay/quantize/realize.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/relay/quantize/realize.cc b/src/relay/quantize/realize.cc
index ace2c24..d265111 100644
--- a/src/relay/quantize/realize.cc
+++ b/src/relay/quantize/realize.cc
@@ -165,7 +165,7 @@ Expr QuantizeRealize(const Call& ref_call, const Array<Expr>& new_args, const Ob
                           MakeConstantScalar(cfg->dtype_activation, static_cast<int>(shift_nbit)));
       } else {
         data = LeftShift(data,
-                         MakeConstantScalar(cfg->dtype_activation, static_cast<int>(shift_nbit)));
+                         MakeConstantScalar(cfg->dtype_activation, static_cast<int>(-shift_nbit)));
       }
       data = Clip(data, clip_min_imm, clip_max_imm);
       return QRealizeIntExpr(data, dom_scale, n->dtype);