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

[Relay][Frontend][Onnx] Auto extract onnx input shapes when possible. #7115

Merged
merged 2 commits into from
Dec 16, 2020

Conversation

jwfromm
Copy link
Contributor

@jwfromm jwfromm commented Dec 15, 2020

Onnx has shapes associated with each input in the graph. In many cases, there is no need for users to specify those shapes since we can simply pull them out. In the onnx importer today, however, an error is thrown whenever shapes aren't explicitly provided. This PR changes that behavior and should make the importer much more user friendly. If an input shape can be extracted and is static, it does not need to be passed in as a shape dictionary. If there are unknown shapes, the importer will raise a warning but continue assuming they're dynamic.

@jwfromm
Copy link
Contributor Author

jwfromm commented Dec 15, 2020

@masahi @hogepodge can you guys take a look at this PR? Let me know if there are other default behaviors we should consider.

@comaniac
Copy link
Contributor

Hey this looks similar to #7055. Could you also review that PR to see how should we proceed?

@jwfromm
Copy link
Contributor Author

jwfromm commented Dec 15, 2020

@comaniac thanks for pointing that out, you're right that there's a lot of overlap. I looked over #7055 and think that the implementation in this PR is cleaner and probably the one we want to merge. I added the removal of shape_dict in the tvmc frontend converter as well to make sure there's feature parity for both implementations. @dlexplorer are you ok with closing your PR and getting this one merged instead?

@hogepodge
Copy link
Contributor

Looks good.

@jwfromm
Copy link
Contributor Author

jwfromm commented Dec 15, 2020

@mbrookhart can you also weigh in on this implementation vs that in #7055?

@dlexplorer
Copy link
Contributor

@dlexplorer are you ok with closing your PR and getting this one merged instead?
I verified problematic networks with this PR and they are converted successfully. Agree to close my PR

Copy link
Contributor

@mbrookhart mbrookhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My main complaint with #7055 was the handling of dynamic shapes, it seems you've covered that here.

@jwfromm
Copy link
Contributor Author

jwfromm commented Dec 16, 2020

Seems like we might have hit a flaky cudnn test. I'll try rebasing and recommitting.

@dlexplorer
Copy link
Contributor

dlexplorer commented Dec 16, 2020

it may sense to remove shape init from this script as well: https://github.com/apache/tvm/blob/main/apps/wasm-standalone/wasm-graph/tools/build_graph_lib.py#L32

@masahi masahi merged commit 18cf9b9 into apache:main Dec 16, 2020
TusharKanekiDey pushed a commit to TusharKanekiDey/tvm that referenced this pull request Jan 20, 2021
…apache#7115)

* Auto extract onnx input shapes when possible.

* Remove shape dict definition in tvmc.
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Jan 21, 2021
…apache#7115)

* Auto extract onnx input shapes when possible.

* Remove shape dict definition in tvmc.
electriclilies pushed a commit to electriclilies/tvm that referenced this pull request Feb 18, 2021
…apache#7115)

* Auto extract onnx input shapes when possible.

* Remove shape dict definition in tvmc.
@jwfromm jwfromm deleted the better_onnx_inputs branch April 12, 2023 15:54
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 this pull request may close these issues.

6 participants