-
Notifications
You must be signed in to change notification settings - Fork 518
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
Generalize canonicalization pattern for more aten.sub/div/mul/add op #1209
Generalize canonicalization pattern for more aten.sub/div/mul/add op #1209
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.
I see a lot of repeated code in this PR. Can we have a function like this which handles all ops? I think it would make it easier to share all the code and would avoid the templates
LogicalResult rewrite0DTensorOp(Operation *op, ...) {
// dyn_cast `op` to determine the operation.
}
ff2a957
to
4bffccd
Compare
Done! |
4bffccd
to
4e24e08
Compare
Merged. Thanks! @silvasean |
This PR generalizes the canonicalization pattern in PR #935 to fit more AtenOps (like
AtenSubTensorOp
,AtenMulScalarOp
, andAtenDivTensorModeOp
). The basic idea is eliminating these tensor ops when their tensor operands are zero-ranked tensors, which come fromValueTensorLiteralOp
orPrimNumToTensorScalarOp
, and replacing them with corresponding scalar ops.This PR also helps to solve issue #1182 .