-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Conversation
@masahi @mbrookhart @csullivan @soiferj Can you guys help review this PR? |
Thanks @jwfromm |
* 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 <jroesch@octoml.ai>
* 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 <jroesch@octoml.ai>
* 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 <jroesch@octoml.ai>
* 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 <jroesch@octoml.ai>
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. |
There was a problem hiding this comment.
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
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.