Closed
Conversation
This is useful for extracting a subgraph without breaking the original graph. Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #293 +/- ##
==========================================
+ Coverage 78.19% 78.22% +0.03%
==========================================
Files 42 42
Lines 5206 5209 +3
Branches 1041 1041
==========================================
+ Hits 4071 4075 +4
+ Misses 834 833 -1
Partials 301 301 ☔ View full report in Codecov by Sentry. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds the ability to clone GraphView objects, which is useful for extracting and working with subgraphs without modifying the original graph structure. The implementation follows the same pattern as the existing Graph.clone() method.
Key Changes:
- Added
clone()method to theGraphViewclass that returns a newGraphinstance - Updated the
Cloner.clone_graph()method to accept bothGraphandGraphViewtypes - Removed an assertion in
clone_value()that was incorrect for GraphView inputs (which can have producers)
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/onnx_ir/_core.py | Added clone() method to GraphView class with documentation |
| src/onnx_ir/_cloner.py | Updated type hints and removed incorrect assertion about value producers |
| src/onnx_ir/_core_test.py | Added comprehensive test suite covering 11 different cloning scenarios |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Member
Author
|
Merged together with #294 |
justinchuby
added a commit
that referenced
this pull request
Dec 30, 2025
Extract subgraphs with `onnx_ir.convenience.extract()`. Migrated from microsoft/onnxscript#2119. Requires #293 --------- Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is useful for extracting a subgraph without breaking the original graph.