murdockhou / Yet-Another-EfficientDet-Pytorch-Convert-ONNX-TVM

GNU Lesser General Public License v3.0
59 stars 17 forks source link

Tracerwaring问题 #2

Closed youwh-PIRI closed 4 years ago

youwh-PIRI commented 4 years ago

您好,首先感谢您的这个分支是一项很有意义的工作,我在转换到Onnx的时候,出现了下面的警告 /home/youwh/ywh/efficientDet--ONNX/efficientnet/utils_extra.py:37: TracerWarning: Converting a tensor to a NumPy array might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! h, w = x.cpu().detach().numpy().shape[-2:] 我不理解它是否有影响,下一阶段我在转为tensorrt的时候出现了错误,然而现在还未找出是哪里出了问题,想询问一下您这个警告是否会对接下来的转换存在影响,非常感谢您能回复!

murdockhou commented 4 years ago

@youwh-PIRI 你好,这个warning在转tvm的时候没有问题,tensorrt没有尝试过,所以没有办法确定是否是这个问题。关于取消这行代码h, w = x.cpu().detach().numpy().shape[-2:],使用其它方式来确定shape,你可以参考下原repo里的issue,里面有个issue有提到另外一种方法来转onnx,不是在forward的时候确定h,w,而是在init的时候就确定好了,具体哪个我忘记了,你可以搜下

youwh-PIRI commented 4 years ago

@ youwh-PIRI你好,这个warning在转tvm的时候没有问题,tensorrt没有尝试过,所以没有办法确定是否是这个问题。关于取消这行代码h, w = x.cpu().detach().numpy().shape[-2:],使用其他方式来确定形状,你可以参考下原repo里的问题,里面有个问题有提到另外一种方法来转onnx,不是在forward的时候确定h,w,而是在init的时候就确定好了,具体来说我忘记了,你可以搜下

非常感谢您的回复!我去参考一下您所指的地方