You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update the graph initializers dictionary when renaming Value (#197)
This pull request enhances the handling of value renaming within the
ONNX IR core: When a value (especially an initializer) is renamed, all
relevant references—including the graph's initializer dictionary—are
consistently updated. This reduces the risk of stale or inconsistent
state when manipulating graph initializers.
Key changes:
**Core logic improvements:**
* The `Value` class now ensures that renaming a value also updates the
corresponding entry in the graph's `initializers` dictionary,
maintaining consistency between the value's name and its registration in
the graph. An error is raised if an initializer's name is set to `None`.
* The `__init__` method docstring for `Value` has been updated to
document this new behavior, clarifying that renaming a value also
updates the graph initializer entry if applicable.
**Code simplification:**
* In `naming.py`, redundant logic for manually updating the
`initializers` dictionary after a value rename has been removed, since
this is now handled automatically by the `Value` class. This makes the
code cleaner and less error-prone.
---------
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
0 commit comments