-
Notifications
You must be signed in to change notification settings - Fork 9
Create a name fix pass to ensure unique names for all values and nodes #124
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
base: main
Are you sure you want to change the base?
Conversation
You should maintain a ir.Value to assigned name dictionary to ensure that a value is only assigned a name once. Alternatively maintain a set of seen values. |
Co-authored-by: justinchuby <[email protected]>
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #124 +/- ##
==========================================
- Coverage 74.80% 74.71% -0.09%
==========================================
Files 39 40 +1
Lines 4723 4853 +130
Branches 966 1008 +42
==========================================
+ Hits 3533 3626 +93
- Misses 840 868 +28
- Partials 350 359 +9 ☔ View full report in Codecov by Sentry. |
…racking Co-authored-by: justinchuby <[email protected]>
I've updated the implementation to use a |
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.
lintrunner found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
Signed-off-by: Justin Chu <[email protected]>
This PR implements a
NameFixPass
insrc/onnx_ir/passes/common/naming.py
to ensure that all values and nodes in an ONNX IR model have unique names according to the specified policy:Key Features
val_{counter}
node_{counter}
Implementation Details
The pass inherits from
InPlacePass
and processes the model in the following order:The implementation carefully handles the IR's automatic naming system by tracking already-processed values to avoid duplicate processing and unwanted modifications.
Example Usage
Testing
Comprehensive tests cover:
Fixes #123.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.