在将pytorch模型转换为onnx模型时报警:

```

WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function.

```

经过模块尝试发现是`F.interpolate`函数(换成F.upsmple也报)导致的,下面给出两种解决方法:

方法1. 用反卷积代替上采样(只是猜测,未尝试)

方法2. 将onnx.export函数的属性加上opset_version=11。(我自己用的这个方法)

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐