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] Loop Support #6700

Merged
merged 17 commits into from
Oct 20, 2020
Merged

[Relay][Frontend][Onnx] Loop Support #6700

merged 17 commits into from
Oct 20, 2020

Conversation

jwfromm
Copy link
Contributor

@jwfromm jwfromm commented Oct 16, 2020

This PR adds a converter for Loop operators in Onnx. Loops in onnx are represented as entire onnx graphs embedded within the op. To support this structure, there are few changes to the GraphProto class to allow access to the parent graph from a called subgraph using scope. It's worth noting that I encountered some issues with type unification when strided slices were part of the subgraph. For now, I've added a warning that indicates errors might occur in this case, but will add corresponding tests once the issue is resolved.

@jwfromm
Copy link
Contributor Author

jwfromm commented Oct 16, 2020

@masahi @mbrookhart @csullivan @soiferj Can you guys help review this PR?

@masahi masahi self-assigned this Oct 16, 2020
@masahi masahi merged commit e1b053a into apache:main Oct 20, 2020
@masahi
Copy link
Member

masahi commented Oct 20, 2020

Thanks @jwfromm

trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Oct 29, 2020
* Onnx loop almost working, checkpointing for safety.

* Very close to working.

* Last piece is fixing scan initialization.

* snapshotting for debug.

* Fix Josh's issue

* Use subgraph proto class.

* Loop with scan.

* Simple loop test now working.

* Scan outputs now working.

* Added second loop test.

* Removed unneeded helper functions.

* Remove bad merge artifact.

* Cleaned up scan output creation.

* Cleaned up some style mistakes.

* Add pylint skip for unused-argument.

* Remove onnx dependency.

* Remove now obsolete checks for 0 shaped tensors.

Co-authored-by: Jared Roesch <[email protected]>
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Dec 2, 2020
* Onnx loop almost working, checkpointing for safety.

* Very close to working.

* Last piece is fixing scan initialization.

* snapshotting for debug.

* Fix Josh's issue

* Use subgraph proto class.

* Loop with scan.

* Simple loop test now working.

* Scan outputs now working.

* Added second loop test.

* Removed unneeded helper functions.

* Remove bad merge artifact.

* Cleaned up scan output creation.

* Cleaned up some style mistakes.

* Add pylint skip for unused-argument.

* Remove onnx dependency.

* Remove now obsolete checks for 0 shaped tensors.

Co-authored-by: Jared Roesch <[email protected]>
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Dec 4, 2020
* Onnx loop almost working, checkpointing for safety.

* Very close to working.

* Last piece is fixing scan initialization.

* snapshotting for debug.

* Fix Josh's issue

* Use subgraph proto class.

* Loop with scan.

* Simple loop test now working.

* Scan outputs now working.

* Added second loop test.

* Removed unneeded helper functions.

* Remove bad merge artifact.

* Cleaned up scan output creation.

* Cleaned up some style mistakes.

* Add pylint skip for unused-argument.

* Remove onnx dependency.

* Remove now obsolete checks for 0 shaped tensors.

Co-authored-by: Jared Roesch <[email protected]>
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Dec 4, 2020
* Onnx loop almost working, checkpointing for safety.

* Very close to working.

* Last piece is fixing scan initialization.

* snapshotting for debug.

* Fix Josh's issue

* Use subgraph proto class.

* Loop with scan.

* Simple loop test now working.

* Scan outputs now working.

* Added second loop test.

* Removed unneeded helper functions.

* Remove bad merge artifact.

* Cleaned up scan output creation.

* Cleaned up some style mistakes.

* Add pylint skip for unused-argument.

* Remove onnx dependency.

* Remove now obsolete checks for 0 shaped tensors.

Co-authored-by: Jared Roesch <[email protected]>
loop_var_names = [v.name_hint for v in loop_vars]

num_scan_outputs = len(body.output) - (1 + num_deps)
# TODO (jwfromm) Test with strided slice once type unifier for this case is fixed.
Copy link
Contributor

@kevinLu1114 kevinLu1114 Jun 6, 2021

Choose a reason for hiding this comment

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

Hi @jwfromm
Did you make this?

I got some error.
I'm not sure if it is because of this.
Can you help me please

The model is mobilenetv1-SSD like this:
https://github.com/onnx/models/blob/master/vision/object_detection_segmentation/ssd-mobilenetv1/model/ssd_mobilenet_v1_10.onnx

@jwfromm jwfromm deleted the onnx_loop branch April 12, 2023 15:55
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.

4 participants