Tool to modify torchlib overload names via libcst#920
Conversation
[ghstack-poisoned]
[ghstack-poisoned]
… libcst" [ghstack-poisoned]
[ghstack-poisoned]
|
|
||
| def main(): | ||
| new_overload_names = { | ||
| "aten::add.Tensor", |
There was a problem hiding this comment.
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.
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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #920 +/- ##
=======================================
Coverage 76.81% 76.81%
=======================================
Files 112 112
Lines 13547 13547
Branches 1377 1377
=======================================
Hits 10406 10406
Misses 2798 2798
Partials 343 343 ☔ View full report in Codecov by Sentry. |
… libcst" [ghstack-poisoned]
[ghstack-poisoned]
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.
So the function def is visited before the decorator call?
There was a problem hiding this comment.
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):