Run error for relay auto quantize

Hello,

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.

Model

Resnet50.pb

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

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


File "/tvm/python/tvm/contrib/graph_executor.py", line 248, in run
self._run()
File "/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 237, in __call__
raise get_last_ffi_error()
tvm._ffi.base.TVMError: Traceback (most recent call last):
12: TVMFuncCall
    at /tvm/src/runtime/c_runtime_api.cc:486
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/graph_executor.cc:575
7: tvm::runtime::GraphExecutor::Run()
    at /tvm/src/runtime/graph_executor/graph_executor.cc:68
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/graph_executor.cc:508
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/library_module.cc:78
File "/tvm/src/runtime/library_module.cc", 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.

Thanks!

having the same problem

oh, and same problem too.

The problem for me is like this.

  1. check the "idom_scale_imm " value

“\src\relay\quantize\realize.cc::QuantizeRealize()”

printf(“odom_scale_imm:%f,idom_scale_imm:%f\n”,odom_scale_imm,idom_scale_imm);

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);
}