开发环境:
MegEngine 1.2.0
Python 3.7.9
centos8
按照https://megengine.org.cn/doc/advanced/quantization.html#id5文档-进阶学习-量化进行本模型量化时,最后一步 :将模型转换为量化模型,并执行 Dump 用于后续模型部署时报错,报错代码如下
Traceback (most recent call last):
File "inference_MCNN_quantize.py", line 61, in <module>
et_dmap = infer_func(img)
File "/opt/Anaconda3/envs/MegEngine/lib/python3.7/site-packages/megengine/jit/tracing.py", line 644, in __call__
outputs = self.__wrapped__(*args, **kwargs)
File "inference_MCNN_quantize.py", line 48, in infer_func
et_dmap = mcnn(img)
File "/opt/Anaconda3/envs/MegEngine/lib/python3.7/site-packages/megengine/module/module.py", line 113, in __call__
outputs = self.forward(*inputs, **kwargs)
File "/home/housiyue/myMegEngine/MCNN_quantize/model_MCNN_quantize.py", line 78, in forward
x1 = self.branch1(x)
File "/opt/Anaconda3/envs/MegEngine/lib/python3.7/site-packages/megengine/module/module.py", line 113, in __call__
outputs = self.forward(*inputs, **kwargs)
File "/opt/Anaconda3/envs/MegEngine/lib/python3.7/site-packages/megengine/module/sequential.py", line 96, in forward
inp = layer(inp)
File "/opt/Anaconda3/envs/MegEngine/lib/python3.7/site-packages/megengine/module/quantized/module.py", line 23, in __call__
return super().__call__(*inputs, **kwargs)
File "/opt/Anaconda3/envs/MegEngine/lib/python3.7/site-packages/megengine/module/module.py", line 113, in __call__
outputs = self.forward(*inputs, **kwargs)
File "/opt/Anaconda3/envs/MegEngine/lib/python3.7/site-packages/megengine/module/quantized/conv.py", line 108, in forward
return self.calc_conv_quantized(inp, nonlinear_mode="RELU")
File "/opt/Anaconda3/envs/MegEngine/lib/python3.7/site-packages/megengine/module/quantized/conv.py", line 57, in calc_conv_quantized
w_scale = dtype.get_scale(self.weight.dtype)
RuntimeError: expect quantize dtype
请问老师出现这样的错误可能是什么原因造成的呢?