-
Notifications
You must be signed in to change notification settings - Fork 543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dynamic shape inference with onnx model #145
Comments
Hi @jonas-doevenspeck , do you have any luck now on the onnx model inference? |
Hi, I fix it by editing network_swinir.py: by 2、replace by then do the pytorch2onnx, dynamic input should work when inference with onnx model. Hope it helps. |
After exporting the model to onnx, onnxruntime fails to do inference with inputs that have a different shape than the one used to export the model.
To reproduce:
error message:
[E:onnxruntime:, sequential_executor.cc:514 ExecuteKernel] Non-zero status code returned while running Reshape node. Name:'/layers.0/residual_group/blocks.1/attn/Reshape_1' Status Message: [/onnxruntime_src/onnxruntime/core/providers/cpu/tensor/reshape_helper.h:40](https://vscode-remote+ssh-002dremote-002b10-002e30-002e2-002e76.vscode-resource.vscode-cdn.net/onnxruntime_src/onnxruntime/core/providers/cpu/tensor/reshape_helper.h:40) onnxruntime::ReshapeHelper::ReshapeHelper(const onnxruntime::TensorShape&, onnxruntime::TensorShapeVector&, bool) gsl::narrow_cast<int64_t>(input_shape.Size()) == size was false. The input tensor cannot be reshaped to the requested shape. Input shape:{88,6,64,64}, requested shape:{1,64,6,64,64}
environment: pytorch==1.13.1, onnxruntime==1.15.1, onnx==1.12.0
The text was updated successfully, but these errors were encountered: