Skip to content

Commit 891904a

Browse files
aorenstefacebook-github-bot
authored andcommitted
Improve torch.ops typing (pytorch#11276)
Summary: X-link: pytorch/pytorch#154555 Cloned pytorch/pytorch#153558 from benjaminglass1 and fixed internal typing errors. Fixes longstanding issue where direct references to aten operations are seen as untyped by type checkers. This is accomplished by setting attributes on several classes more consistently, so that `__getattr__` can return a single type in all other cases. Decisions made along the way: 1. `torch.ops.higher_order` is now implemented by a single-purpose class. This was effectively true before, but the class implementing it attempted to be generalized unnecessarily. Fixing this simplified typing for the `_Ops` class. 2. `__getattr__` is only called when all other lookup methods have failed, so several constant special-cases in the function could be implemented as class variables. The remainder of this PR is fixing up all the bugs exposed by the updated typing, as well as all the nitpicky typing issues. Reviewed By: bobrenjc93 Differential Revision: D75497142
1 parent 5ef38d3 commit 891904a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

backends/cadence/aot/quantizer/patterns.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def get_anchors(
109109
)
110110

111111
def replacement_op(self) -> OpOverload:
112+
# pyre-ignore: Incompatible return type [7]: Expected `OpOverload` but got `OpOverloadPacket`.
112113
return torch.ops.cadence.quantized_linear
113114

114115

0 commit comments

Comments
 (0)