-
Notifications
You must be signed in to change notification settings - Fork 72
[Pass] Support lift constants to initializers pass #2160
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
[Pass] Support lift constants to initializers pass #2160
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2160 +/- ##
==========================================
+ Coverage 74.03% 74.13% +0.09%
==========================================
Files 222 224 +2
Lines 29239 29355 +116
Branches 3399 3414 +15
==========================================
+ Hits 21647 21762 +115
- Misses 6439 6440 +1
Partials 1153 1153 ☔ View full report in Codecov by Sentry. |
onnxscript/ir/passes/common/lift_constants_to_initializers_test.py
Outdated
Show resolved
Hide resolved
const_value=tensor, | ||
) | ||
assert node.graph is not None | ||
assert isinstance(node.graph, ir.Graph) |
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.
@justinchuby does this make sense? I think there should not be any ir.Function node coming out from recursive iterator?
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.
Does make sense. Thanks! The reason why it was annotated with graph | function is that the “owning graph” can be a function when the node is part of a function. Maybe there are better ways to do it 🤔
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.
(Unrelated to this PR): Isn't a Function object a wrapper around a Graph object? Does node.graph not return that graph object even in the case of function nodes?
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.
Technically the graph in a function is private and not used directly. It is currently an implementation detail
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.
sorry I was wrong. It is pointed to a graph when we call function.append
, but it is not when we call ir.Node(graph=function). I need to figure out how to reconcile this. Suggestions appreciated. #2181
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.
c3cec70
to
a2e9d2a
Compare
Co-authored-by: Justin Chu <[email protected]>
Fix #2156