- Notifications
You must be signed in to change notification settings - Fork151
Facilitate graph pattern matching#1786
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Draft
ricardoV94 wants to merge4 commits intopymc-devs:mainChoose a base branch fromricardoV94:op_shortcut
base:main
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Draft
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| # Check for use of pt.diag first | ||
| case (AllocDiag(offset=0,axis1=axis1,axis2=axis2),diag_input): | ||
| ndim=diag_input.ndim | ||
| ifaxis1==ndim-1andaxis2==ndim: |
MemberAuthor
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.
This is new, we were not checking for non standard allocdiagonal, not along the last dims!
0a5ec73 tocf91364CompareSign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading.Please reload this page.
This PR provides a POC for#1455
owner_opandowner_op_and_inputs.if x.owner.op is not None and isinstance(x.owner.op, ...)in favor ofisinstance(x.owner_op, ...)casestatement. This makes nested patterns easier to write. Eg.case (Blocwise(Dot()), a, b)for a singlematch x.owner_op_and_inputs.match_argsso common parametrized Ops (Elemwise, Blockwise) and Constants are easier to pattern match without kwargsis_matrix_transposeandis_left_expanded_matrix_transposeproperty to DimShuffle, for easier pattern matchingI then refactored the existing linalg rewrites as a POC. I went a bit overboard and tried to standardize names, and fuse rewrites that were pretty simple to combine.
CC@tanish1729 who did many of these rewrites, see if it feels nicer?