-
Notifications
You must be signed in to change notification settings - Fork 98
[IR] Create sort() on Model #2171
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
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.
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
❌ 3 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
| graph={textwrap.indent(repr(self.graph), " " * 4).strip()} | ||
| )""" | ||
|
|
||
| def sort(self) -> 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.
where would this be called?
| graph={textwrap.indent(repr(self.graph), " " * 4).strip()} | ||
| )""" | ||
|
|
||
| def sort(self) -> 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.
Could you add a unit test for this?
|
Replaced by the topological sort pass |
This pull request includes a new method to perform a topological sort on graphs and functions in the
onnxscript/ir/_core.pyfile. The most important change is the addition of thesortmethod, which ensures that all graphs and functions are sorted in a stable manner.Enhancements to graph and function sorting:
onnxscript/ir/_core.py: Added thesortmethod to perform a topological sort on all graphs and functions, ensuring stability and preserving the original order as much as possible. This method raises aValueErrorif a cycle is detected in the graph.