ncnn
ncnn copied to clipboard
Pytorch Flatten() 转换以后出现维度丢失的问题
error log | 日志或报错信息 | ログ
Pytorch 转换onnx 以后再转换ncnn,Flatten 算子128 维度出现维度丢失的问题,转换后变为8维。
context | 编译/运行环境 | バックグラウンド
Ubuntu22.04
how to reproduce | 复现步骤 | 再現方法
- Efficient-lite0 转换onnx以后 在转换ncnn 出现维度丢失的问题。将Flatten 替换为view 可以解决
more | 其他 | その他
试试 pnnx 转换 pytorch 模型 https://github.com/pnnx/pnnx
针对onnx模型转换的各种问题,推荐使用最新的pnnx工具转换到ncnn In view of various problems in onnx model conversion, it is recommended to use the latest pnnx tool to convert your model to ncnn
pip install pnnx
pnnx model.onnx inputshape=[1,3,224,224]
详细参考文档 Detailed reference documentation https://github.com/pnnx/pnnx https://github.com/Tencent/ncnn/wiki/use-ncnn-with-pytorch-or-onnx#how-to-use-pnnx