Skip to content
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

Using TransposeOptimizer breaks model with split optimizer opset >= 13 error #1941

Closed
CarlPoirier opened this issue May 17, 2022 · 1 comment · Fixed by #1996
Closed

Using TransposeOptimizer breaks model with split optimizer opset >= 13 error #1941

CarlPoirier opened this issue May 17, 2022 · 1 comment · Fixed by #1996
Assignees

Comments

@CarlPoirier
Copy link

CarlPoirier commented May 17, 2022

Describe the bug
I have an onnx model on which I want to run the onnx-optimize.py script. All the optimizers work fine except the TransposeOptimizer. When I use it, my onnx model is not working anymore, with onnxruntime at least. I get this error :

[ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Non-zero status code returned while running Split node. Name:'Split_12' Status Message: D:\a\_work\1\s\onnxruntime\core\providers\cpu\tensor\split.cc:160 onnxruntime::Split::ComputeImpl split_tensor->Shape().NumDimensions() == 1 was false. An split tensor must be a vector tensor.

Urgency
None, for now I deactivated this optimizer and I'm using all the others.

System information

  • OS Platform and Distribution: Windows 10
  • Tf2onnx version: 1.10.1
  • Tensorflow Version: 2.5.2
  • Python version: 3.9.9
  • ONNXRuntime: 1.9.3

To Reproduce
test_models.zip

The above zip contains four files:

  • test-run.py : script to run the model using onnxruntime
  • test_model2_small.onnx : starting model which works
  • test_model2_small_broken.onnx : optimized model which does not work anymore
  • test_model2_small_ok.onnx : optimized model for which I have deactivated only the transpose optimizer and it still works

I'm running the onnx-optimize script this way:

python onnx-optimize-orig.py --input test_model2_small.onnx --output test_model2_small_broken.onnx 2022-05-17 19:13:24.283642: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cudart64_110.dll 2022-05-17 19:13:27,704 - INFO - Optimizing ONNX model 2022-05-17 19:13:27,732 - INFO - After optimization: Const -1 (7->6), Identity -1 (1->0)

Then I run the model with any image, this way:

python test-run.py

If you need any more information, let me know!

@hwangdeyu
Copy link
Contributor

@CarlPoirier The latest tf2onnx verison 1.12 has been released. I think your model can be optimized as expected. Thanks!

@hwangdeyu hwangdeyu changed the title Using TransposeOptimizer breaks model (again) Using TransposeOptimizer breaks model with split optimizer opset >= 13 error Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants