-
Notifications
You must be signed in to change notification settings - Fork 97
Provide inplace replacement util #2708
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: Ganesan Ramalingam <grama@microsoft.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2708 +/- ##
==========================================
- Coverage 70.04% 70.04% -0.01%
==========================================
Files 226 226
Lines 27177 27179 +2
Branches 2734 2734
==========================================
+ Hits 19036 19037 +1
- Misses 7197 7198 +1
Partials 944 944 ☔ View full report in Codecov by Sentry. |
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 refactors the replace_functions utility by extracting the core logic into a new replace_functions_inplace function that operates directly on IR models. The original replace_functions now acts as a wrapper that handles proto conversion and calls the new inplace variant.
Key changes:
- Introduces
replace_functions_inplacethat operates onir.Modelandir.Functiontypes directly - Refactors
replace_functionsto convert protos and delegate to the inplace function
| def replace_functions( | ||
| model: onnx.ModelProto, functions: Sequence[onnx.FunctionProto] | ||
| ) -> onnx.ModelProto: | ||
| def replace_functions_inplace(irmodel: ir.Model, irfunctions: Sequence[ir.Function]) -> None: |
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.
| def replace_functions_inplace(irmodel: ir.Model, irfunctions: Sequence[ir.Function]) -> None: | |
| def replace_functions_inplace(model: ir.Model, functions: Collection[ir.Function]) -> None: |
Consider consistent names
Redo #2703, thanks to Titai.