Skip to content

[Flexible Outputs] Allow multi-output matching#2873

Open
srikris-sridhar wants to merge 1 commit intomicrosoft:mainfrom
srikris-sridhar:dev/srikris/allow_other_output
Open

[Flexible Outputs] Allow multi-output matching#2873
srikris-sridhar wants to merge 1 commit intomicrosoft:mainfrom
srikris-sridhar:dev/srikris/allow_other_output

Conversation

@srikris-sridhar
Copy link
Copy Markdown

Adds support for pattern matching on multiple outputs for optimizations involving ops like Split.

def pattern(self, op, x):
        relu = op.Relu(x)
        return op.Split(relu, _allow_flexible_outputs=True)

Fixes #2581

@srikris-sridhar
Copy link
Copy Markdown
Author

@justinchuby Hopefully this is a good attempt. It's my first PR, so go easy on me :)

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 29, 2026

Codecov Report

❌ Patch coverage is 88.37209% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.98%. Comparing base (1077da7) to head (2d0cc42).

Files with missing lines Patch % Lines
onnxscript/rewriter/pattern_test.py 82.60% 2 Missing and 2 partials ⚠️
onnxscript/rewriter/_rewrite_rule.py 92.85% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2873      +/-   ##
==========================================
+ Coverage   71.96%   71.98%   +0.02%     
==========================================
  Files         239      239              
  Lines       29224    29262      +38     
  Branches     2878     2885       +7     
==========================================
+ Hits        21031    21065      +34     
- Misses       7216     7218       +2     
- Partials      977      979       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@srikris-sridhar
Copy link
Copy Markdown
Author

@srikris-sridhar please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

Adds support for pattern matching on multiple outputs
for optimizations involving ops like Split.

```
def pattern(self, op, x):
        relu = op.Relu(x)
        return op.Split(relu, _allow_flexible_outputs=True)
```

Fixes microsoft#2581
@srikris-sridhar srikris-sridhar force-pushed the dev/srikris/allow_other_output branch from 2d0cc42 to 38cf331 Compare March 29, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Matching variadic lists of tensors?

1 participant