-
Notifications
You must be signed in to change notification settings - Fork 54
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
Tool to modify torchlib overload names via libcst #920
base: main
Are you sure you want to change the base?
Conversation
[ghstack-poisoned]
[ghstack-poisoned]
ghstack-source-id: 420de64a8186e91f1def4ba89b9de91c886a9df5 Pull Request resolved: #920
… libcst" [ghstack-poisoned]
[ghstack-poisoned]
ghstack-source-id: dafcfce2877df669a3daa4c5f0ef5a67d844c593 Pull Request resolved: #920
|
||
def main(): | ||
new_overload_names = { | ||
"aten::add.Tensor", |
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.
Possible to add all overloads for these ops? I imagine x for x in torch.ops.aten.add.overloads() if "out" not in x
etc.
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.
Yes, the tool allows such usage.
Frankly this PR is libcst exercise lol. I think the only useful scenario for this tool is when we have a large batch of missing overloads that we know would work, typically from model benchmark.
Codecov Report
@@ Coverage Diff @@
## gh/BowenBao/7/base #920 +/- ##
===================================================
Coverage 76.81% 76.81%
===================================================
Files 112 112
Lines 13547 13547
Branches 1377 1377
===================================================
Hits 10406 10406
Misses 2798 2798
Partials 343 343
|
… libcst" [ghstack-poisoned]
[ghstack-poisoned]
ghstack-source-id: e838cb41ea26a33f9bb31b49f4ece06b38d48d40 Pull Request resolved: #920
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * #920 * __->__ #919 Resolves most reported missing overloads from #865
def leave_FunctionDef(self, node: FunctionDef) -> None: | ||
self._stack.pop() | ||
|
||
def visit_Call(self, node: cst.Call) -> None: |
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 the function def is visited before the decorator call?
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 think so, from cst tree level, decorators are a part of the function.
@BowenBao please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Stack from ghstack (oldest at bottom):