Run error for relay auto quantize


I am tring to test the resnet50 inference use tvm relay automatic quantization. now , the quantize pass is OK. but ,when i run() over cpu encounter error.



 with relay.quantize.qconfig(calibrate_mode="kl_divergence", weight_scale="max"):
   mod = relay.quantize.quantize(mod, params, dataset=calibrate_dataset())

 graph, lib, params =,"llvm"params=params)
 m = graph_executor.create(graph, lib, device=tvm.cpu(0))
 An error occurred during the execut the " fused_fixed_point_multiply" op

File "/tvm/python/tvm/contrib/", line 248, in run
File "/tvm/python/tvm/_ffi/_ctypes/", line 237, in __call__
raise get_last_ffi_error()
tvm._ffi.base.TVMError: Traceback (most recent call last):
12: TVMFuncCall
    at /tvm/src/runtime/
11: tvm::runtime::PackedFunc::CallPacked(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*) const
    at /tvm/include/tvm/runtime/packed_func.h:1150
10: std::function<void (tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)>::operator()(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*) const
    at /usr/include/c++/5/functional:2267
9: _M_invoke
    at /usr/include/c++/5/functional:1871
8: operator()
    at /tvm/src/runtime/graph_executor/
7: tvm::runtime::GraphExecutor::Run()
    at /tvm/src/runtime/graph_executor/
6: std::function<void ()>::operator()() const
    at /usr/include/c++/5/functional:2267
5: _M_invoke
    at /usr/include/c++/5/functional:1871
4: operator()
    at /tvm/src/runtime/graph_executor/
3: tvm::runtime::PackedFunc::CallPacked(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*) const
    at /tvm/include/tvm/runtime/packed_func.h:1150
2: std::function<void (tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)>::operator()(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*) const
    at /usr/include/c++/5/functional:2267
1: _M_invoke
    at /usr/include/c++/5/functional:1871
0: operator()
     at /tvm/src/runtime/
File "/tvm/src/runtime/", line 78 

 Check failed: ret == 0 (-1 vs. 0) : Assert fail: (((tir.tvm_struct_get(arg1, 0, 5) == (uint8)0) && (tir.tvm_struct_get(arg1, 0, 6) == (uint8)32)) && (tir.tvm_struct_get(arg1, 0, 7) == (uint16)1)), arg1.dtype is expected to be int32

Any help is greatly appreciated.


having the same problem

oh, and same problem too.

The problem for me is like this.

  1. check the "idom_scale_imm " value



if idom_scale_imm is too small, this code
std::log2(odom_scale_imm / idom_scale_imm); will cause bug. equal to divided by zero。

  1. so my solution is check the idom_scale_imm value before division。
if (fabs(idom_scale_imm) <= 1e-6)
     data = ZerosLike(n->data);	//数据清零
     return QRealizeIntExpr(data, dom_scale, n->dtype);