-
Notifications
You must be signed in to change notification settings - Fork 14
Prevent values produced by other nodes to be added as graph inputs #51
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
Conversation
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
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.
Pull Request Overview
This PR prevents values already produced by nodes from being added as graph inputs by adding a check in _set_graph
.
- Adds a guard in
_set_graph
to raise an error ifvalue
has a producer. - Ensures graph inputs are only values without an existing producer.
Comments suppressed due to low confidence (1)
src/onnx_ir/_graph_containers.py:156
- There's a syntax error: the f-string literal isn't closed. Add the missing closing quote before the parenthesis. For example:
raise ValueError(f"Value '{value}' is produced by a node and cannot be an input to the graph")
raise ValueError(f"Value '{value}' is produced by a node and cannot be an input to the graph)
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #51 +/- ##
==========================================
+ Coverage 81.72% 81.75% +0.02%
==========================================
Files 57 57
Lines 6955 6965 +10
Branches 947 948 +1
==========================================
+ Hits 5684 5694 +10
Misses 905 905
Partials 366 366 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
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.
I wonder if this breaks the input of subgraphs? Isn't subgraph using node outputed vlaues?
It shouldn’t. There are two ways for subgraphs to use external values. One is by implicitly capturing and directly referring to those values in the subgraphs, which is what we do with the If op. The other is to define graph inputs and explicitly define in the op definition how these inputs correlates with the node inputs. (Aka the values are connected according to the op definition, not graph topology). This is what happens with the subgraph inputs of the Scan op. |
…nnx#51) Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com> Signed-off-by: Ti-Tai Wang <titaiwang@microsoft.com>
No description provided.