daquexian / onnx-simplifier

Simplify your onnx model
Apache License 2.0
3.67k stars 377 forks source link

[BUG] onnx-simplifier==0.4.25 cannot do shape inference in some onnx #322

Closed TangChangcheng closed 4 months ago

TangChangcheng commented 4 months ago

Describe the bug A clear and concise description of what the bug is.

The onnx model does have input shape, but after simplification its input shape becomes [unk_1, ...], even I set --overwrite-input-shape xxx and it does not work.

Model To reproduce the problem, please post download link of your model here, or send your model to daquexian566@gmail.com AvgPool_chw_2x4093x3126_k_2x12_p_0x0x0x0_s_2x11.onnx.zip

TangChangcheng commented 4 months ago

This problem is solved when I degrade onnxsim to 0.4.13, but I still want to ensure why it happens in 0.4.25

congyang12345 commented 4 months ago

I have the same problem, you can try

pip install onnxslim

onnxslim onnx_model slimmed_onnx_model

and the shape can be inferred.

daquexian commented 4 months ago

Thanks for your issue! Fixed in v0.4.36. Please update onnxsim by pip install -U onnxsim