-
Notifications
You must be signed in to change notification settings - Fork 64
Add from_onnx_text function to convert ONNX text to IR model #2291
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
--- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/microsoft/onnxscript?shareId=XXXX-XXXX-XXXX-XXXX).
❌ 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 |
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.
Pull Request Overview
This pull request introduces a new API function, from_onnx_text, to convert an ONNX textual representation directly into an IR model. The changes update various test files and documentation to use the new function instead of manually parsing and deserializing ONNX text.
- Tests in version_converter, rewriter, and optimizer have been updated to use the new function.
- The ir/serde module is extended with a new helper function, and the documentation is updated accordingly.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
onnxscript/version_converter/_version_converter_test.py | Updated tests to replace onnx.parser.parse_model with from_onnx_text. |
onnxscript/rewriter/no_op_test.py | Simplified test helper to use from_onnx_text. |
onnxscript/optimizer/_constant_folding_test.py | Updated constant folding tests to use the new conversion function. |
onnxscript/ir/serde.py | Added the new from_onnx_text function and updated init.py. |
docs/ir/ir_api/core.md | Updated API documentation to include from_onnx_text. |
Comments suppressed due to low confidence (2)
onnxscript/rewriter/no_op_test.py:12
- [nitpick] It is good to see the tests using from_onnx_text; consider also adding tests for malformed ONNX text inputs to verify robust error handling.
def _check(self, model_text: str) -> None:
onnxscript/optimizer/_constant_folding_test.py:16
- [nitpick] Consider adding negative test cases with invalid or malformed ONNX text to ensure that from_onnx_text handles errors gracefully.
def _fold(self, model: ir.Model | str, onnx_shape_inference=False, **kwargs):
Simplify conversion of the onnx textual representation to IR.
#2290