Commit 726be2b
Add test for unused initializer check with graph outputs (#2733)
The fix prevents removing initializers that are graph outputs during
constant folding. This test validates that behavior.
## Changes
- Added `test_initializer_as_graph_output_is_not_removed` to verify
initializers used in foldable nodes are preserved when they are graph
outputs
## Test Case
```python
# Model with constant used in operation AND as graph output
agraph (float[N] x) => (float[N] y, float z) {
constant = Constant <value_float=2.0> ()
y = Mul(x, constant)
z = Identity(constant) # constant is also output
}
```
After constant folding:
- Identity node is removed
- Constant becomes initializer 'z'
- Initializer 'z' is NOT removed despite having no uses (it's a graph
output)
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
---------
Signed-off-by: Ganesan Ramalingam <[email protected]>
Co-authored-by: Ganesan Ramalingam <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: justinchuby <[email protected]>
Co-authored-by: Justin Chu <[email protected]>1 parent 8f06364 commit 726be2b
1 file changed
+25
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
741 | 741 | | |
742 | 742 | | |
743 | 743 | | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
744 | 769 | | |
745 | 770 | | |
746 | 771 | | |
0 commit comments