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

tf-onnx introducing many transpose operations #15

Closed
dmoham1476 opened this issue May 15, 2018 · 5 comments
Closed

tf-onnx introducing many transpose operations #15

dmoham1476 opened this issue May 15, 2018 · 5 comments

Comments

@dmoham1476
Copy link

@dmoham1476 dmoham1476 commented May 15, 2018

Hi, I got to convert an tf graph to onnx and I see that there are several transpose operations in the graph because of tf and onnx layout differences. Is there a way I can tweak the tfonnx/other files to avoid these transposes and still get the correct output shape? I am running on a CPU

I see a related post here for onnx-> tensorflow. onnx/onnx-tensorflow#31

@guschmue
Copy link
Collaborator

@guschmue guschmue commented May 31, 2018

If the model is nhwc we wrap the ops with transpose. There are only 2 optimizations: if the input is a const ant we apply the transpose to the constant and if we find back to back transpose we remove it. Pretty conservative and I'm sure we can do better.
Let me find some time to look at it.

Loading

@dmoham1476
Copy link
Author

@dmoham1476 dmoham1476 commented May 31, 2018

hi I am also seeing that Intel MKL is able to handle NHWC (similar to GPU). This is what I found and posted on the onnx-tf page - onnx/onnx-tensorflow#31 (comment)

Loading

@dmoham1476
Copy link
Author

@dmoham1476 dmoham1476 commented Jul 9, 2018

Hi Guenther, checking how we avoid the transpose operations for the cpu tf2onnx graph?

Loading

@guschmue
Copy link
Collaborator

@guschmue guschmue commented Jul 18, 2018

I think this only creating issues for tensorflow models ... wish they would have not done nhwc. Adding nhwc to onnx would create similar issues there.
I have some ideas how to get rid of some ... going to get to this soon.

Loading

@guschmue
Copy link
Collaborator

@guschmue guschmue commented Aug 24, 2018

This will help:
#108

Loading

@guschmue guschmue closed this Aug 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants