-
Couldn't load subscription status.
- Fork 87
Handle matching against None explicitly #2460
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
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
❌ 33 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 PR introduces explicit handling for pattern variables that can match against None values in the ONNX pattern matching system. The changes allow users to specify when a pattern variable should accept None inputs through a can_match_none parameter, improving the consistency and robustness of pattern matching.
Key changes:
- Added
can_match_noneparameter to pattern variables for explicit None matching control - Enhanced the matching logic to properly handle variable-length inputs with trailing None values
- Refactored
Varfrom an alias to a proper class with cloning capabilities
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
onnxscript/rewriter/_pattern_ir.py |
Converted Var from alias to class, added can_match_none parameter and validation |
onnxscript/rewriter/_matcher.py |
Updated matching logic to handle None values and variable-length inputs properly |
onnxscript/rewriter/pattern.py |
Added Var to module exports |
onnxscript/rewriter/pattern_test.py |
Updated existing test and added comprehensive test for variable-length input matching |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Looks like there are some failing tests |
Thanks, fixed. |
Provide a way to indicate that a pattern-variable can match successfully against a None-valued input. Cleanup current handling which was inconsistent in one place. Add test cases. --------- Signed-off-by: Ganesan Ramalingam <grama@microsoft.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Provide a way to indicate that a pattern-variable can match successfully against a None-valued input. Cleanup current handling which was inconsistent in one place. Add test cases.