-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Replace split-squeeze pattern #101765
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
Replace split-squeeze pattern #101765
Conversation
Replaces split-squeeze (same dimension) with an unbind. This will be used in combination with later patterns to remove the unbind if it follows a cat/stack Differential Revision: [D45758181](https://our.internmc.facebook.com/intern/diff/D45758181/) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/101765
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 59ee628: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Replaces split-squeeze (same dimension) with an unbind. This will be used in combination with later patterns to remove the unbind if it follows a cat/stack Differential Revision: [D45758181](https://our.internmc.facebook.com/intern/diff/D45758181/) [ghstack-poisoned]
Replaces split-squeeze (same dimension) with an unbind. This will be used in combination with later patterns to remove the unbind if it follows a cat/stack Differential Revision: [D45758181](https://our.internmc.facebook.com/intern/diff/D45758181/) [ghstack-poisoned]
|
@pytorchbot label "topic: not user facing" |
Replaces split-squeeze (same dimension) with an unbind. This will be used in combination with later patterns to remove the unbind if it follows a cat/stack Differential Revision: [D45758181](https://our.internmc.facebook.com/intern/diff/D45758181/) cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire [ghstack-poisoned]
| continue | ||
| for node in other_node.users: | ||
| if node not in searched: | ||
| if not matching_nodes or self._match_fns(node): |
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.
Can you explain what matching_nodes does?
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.
So, I added this in the base class (_TargetArgsExpr) - and it is here just to follow the interface.
By default, we only returned nodes which match in find_anchor_nodes. This doesn't work for RepeatedExpr. In the usual case, we want to not match the pattern, unless all users of the previous node match it. With the usual behavior, it would by default do just a partial match.
So things like
split -> squeeze
-> relu
will get matched for a split->squeeze pattern.
If I pass, matching_nodes=False, all users of previous node are returned, allowing me to invalidate partial matches.
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.
If you have a better way of doing this please suggest. I was initially thinking of using a different method like find_sibling_nodes, but it seemed very similar to find_anchor_nodes in implementation.
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.
btw, I just realized I forgot to add this variable to some other classes. I can add them, but waiting for your response first.
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 isn't really what find_anchor_nodes() is meant for, I worry this confuses the semantics.
I'd rather see an extra check, either in the _match function or in the handler that is just based on the users of split.
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.
Sure, I can do that
Replaces split-squeeze (same dimension) with an unbind. This will be used in combination with later patterns to remove the unbind if it follows a cat/stack Differential Revision: [D45758181](https://our.internmc.facebook.com/intern/diff/D45758181/) cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire [ghstack-poisoned]
Replaces split-squeeze (same dimension) with an unbind. This will be used in combination with later patterns to remove the unbind if it follows a cat/stack Differential Revision: [D45758181](https://our.internmc.facebook.com/intern/diff/D45758181/) cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire [ghstack-poisoned]
Replaces split-squeeze (same dimension) with an unbind. This will be used in combination with later patterns to remove the unbind if it follows a cat/stack Differential Revision: [D45758181](https://our.internmc.facebook.com/intern/diff/D45758181/) cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire [ghstack-poisoned]
Replaces split-squeeze (same dimension) with an unbind. This will be used in combination with later patterns to remove the unbind if it follows a cat/stack Differential Revision: [D45758181](https://our.internmc.facebook.com/intern/diff/D45758181/) cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire [ghstack-poisoned]
Replaces split-squeeze (same dimension) with an unbind. This will be used in combination with later patterns to remove the unbind if it follows a cat/stack Differential Revision: [D45758181](https://our.internmc.facebook.com/intern/diff/D45758181/) cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire [ghstack-poisoned]
Replaces split-squeeze (same dimension) with an unbind. This will be used in combination with later patterns to remove the unbind if it follows a cat/stack Differential Revision: [D45758181](https://our.internmc.facebook.com/intern/diff/D45758181/) cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire [ghstack-poisoned]
Replaces split-squeeze (same dimension) with an unbind. This will be used in combination with later patterns to remove the unbind if it follows a cat/stack Differential Revision: [D45758181](https://our.internmc.facebook.com/intern/diff/D45758181/) cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 desertfire [ghstack-poisoned]
|
@pytorchbot merge (Initiating merge automatically since Phabricator Diff has merged) |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Stack from ghstack (oldest at bottom):
Replaces split-squeeze (same dimension) with an unbind. This will be used in combination with later patterns to remove the unbind if it follows a cat/stack
Differential Revision: D45758181
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @desertfire