Unverified Commit 4b743676 by ziheng Committed by GitHub

[BUGFIX] Fix for quantize. (#2573)

parent f0ae8e31
...@@ -31,8 +31,6 @@ def extract_from_program(func, params, ops, target, target_host=None): ...@@ -31,8 +31,6 @@ def extract_from_program(func, params, ops, target, target_host=None):
The associated parameters of the program The associated parameters of the program
ops: List of relay op ops: List of relay op
List of relay ops to be tuned List of relay ops to be tuned
dtype: str or dict of str to str
The input types to the program
target: tvm.target.Target target: tvm.target.Target
The compilation target The compilation target
target_host: tvm.target.Target target_host: tvm.target.Target
......
...@@ -231,7 +231,7 @@ Expr QuantizeRealize(const Call& ref_call, ...@@ -231,7 +231,7 @@ Expr QuantizeRealize(const Call& ref_call,
return QRealizeIntExprNode::make(round_data, dom_scale, Float(32)); return QRealizeIntExprNode::make(round_data, dom_scale, Float(32));
} }
RELAY_REGISTER_OP("simulated_quantize") RELAY_REGISTER_OP("relay.op.annotation.simulated_quantize")
.set_attr<FForwardRewrite>("FQRealizeRewrite", QuantizeRealize); .set_attr<FForwardRewrite>("FQRealizeRewrite", QuantizeRealize);
...@@ -350,7 +350,6 @@ Array<Expr> UnifyDTypeScale(const Array<Expr>& args, ...@@ -350,7 +350,6 @@ Array<Expr> UnifyDTypeScale(const Array<Expr>& args,
Expr dom_scale = MakeConstantScalar(Float(32), s); Expr dom_scale = MakeConstantScalar(Float(32), s);
for (size_t i = 0; i < ret.size(); ++i) { for (size_t i = 0; i < ret.size(); ++i) {
float cur_s = GetScalarFromConstant<float>(nptrs[i]->dom_scale); float cur_s = GetScalarFromConstant<float>(nptrs[i]->dom_scale);
LOG(INFO) << "unify data scale from " << cur_s << " to " << s;
ret.Set(i, MulAndDiv(ret[i], cur_s, s)); ret.Set(i, MulAndDiv(ret[i], cur_s, s));
} }
...@@ -504,7 +503,7 @@ void QConfig::ExitQConfigScope() { ...@@ -504,7 +503,7 @@ void QConfig::ExitQConfigScope() {
entry->context_stack.pop(); entry->context_stack.pop();
} }
QConfig QConfig::Current() { QConfig& QConfig::Current() {
TVMQConfigThreadLocalEntry *entry = TVMQConfigThreadLocalStore::Get(); TVMQConfigThreadLocalEntry *entry = TVMQConfigThreadLocalStore::Get();
if (entry->context_stack.size() > 0) { if (entry->context_stack.size() > 0) {
return entry->context_stack.top(); return entry->context_stack.top();
......
...@@ -162,7 +162,7 @@ class QConfig : public NodeRef { ...@@ -162,7 +162,7 @@ class QConfig : public NodeRef {
* configuration if a BuildConfig scope has not been entered. * configuration if a BuildConfig scope has not been entered.
* \return The configuration that is the current context. * \return The configuration that is the current context.
*/ */
static QConfig Current(); static QConfig& Current();
using ContainerType = QConfigNode; using ContainerType = QConfigNode;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment