Pytorch转Onnx转TensorRT踩坑记

转换Onnx过程中:

PyTorch v1.0.1  Reshape不支持报错 

源码安装PyTorch v1.0.1 caffe2报错

PyTorch v1.2.0 需要升级cuda10.0以上

PyTorch v1.1.0报错:

RuntimeError: Failed to export an ONNX attribute, since it's not constant, please try to make things (e.g., kernel size) static if possible

解决办法,按照如下方式修改:

https://github.com/pytorch/pytorch/commit/11845cf2440c1abb0cb117bcee9532b26573e9c9

即可成功

TensorRT解析onnx失败,Failing to parse onnx file generated by pytorch

解决办法,按照如下方式修改:

https://devtalk.nvidia.com/default/topic/1055172/tensorrt/failing-to-parse-onnx-file-generated-by-pytorch/

修改完成之后,还有问题,是其中的Gather算子的问题,PyTorch官方没有考虑asix=0的情况

你可能感兴趣的:(边缘计算,深度学习,PyTorch)