Skip to content

Commit

Permalink
[BUGFIX] Fix for quantize. (apache#2573)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZihengJiang authored and libing4752 committed Feb 18, 2019
1 parent bbd0388 commit 33e8546
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 0 additions & 2 deletions python/tvm/autotvm/task/relay_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ def extract_from_program(func, params, ops, target, target_host=None):
The associated parameters of the program
ops: List of relay op
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
The compilation target
target_host: tvm.target.Target
Expand Down
5 changes: 2 additions & 3 deletions src/relay/pass/quantize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ Expr QuantizeRealize(const Call& ref_call,
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);


Expand Down Expand Up @@ -350,7 +350,6 @@ Array<Expr> UnifyDTypeScale(const Array<Expr>& args,
Expr dom_scale = MakeConstantScalar(Float(32), s);
for (size_t i = 0; i < ret.size(); ++i) {
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));
}

Expand Down Expand Up @@ -504,7 +503,7 @@ void QConfig::ExitQConfigScope() {
entry->context_stack.pop();
}

QConfig QConfig::Current() {
QConfig& QConfig::Current() {
TVMQConfigThreadLocalEntry *entry = TVMQConfigThreadLocalStore::Get();
if (entry->context_stack.size() > 0) {
return entry->context_stack.top();
Expand Down
2 changes: 1 addition & 1 deletion src/relay/pass/quantize.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class QConfig : public NodeRef {
* configuration if a BuildConfig scope has not been entered.
* \return The configuration that is the current context.
*/
static QConfig Current();
static QConfig& Current();

using ContainerType = QConfigNode;
};
Expand Down

0 comments on commit 33e8546

Please sign in to comment.