Skip to content

Commit adad0ed

Browse files
Pyre Bot Jr.meta-codesync[bot]
authored andcommitted
Enable Pyrefly in fbcode/executorch (#21045)
Summary: Pull Request resolved: #21045 Automated migration to enable Pyrefly type checking for `fbcode/executorch`. - Added `python.set_pyrefly(True)` to PACKAGE file - Suppressed pre-existing type errors Pyrefly is Meta's next-generation Python type checker, replacing Pyre. If you encounter issues, you can revert the PACKAGE change by removing the `python.set_pyrefly(True)` line. #pyreupgrade Differential Revision: D112856308
1 parent 2524691 commit adad0ed

24 files changed

Lines changed: 241 additions & 6 deletions

backends/cadence/aot/compiler_funcs.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,13 @@ def extract_output_dequant_params(
174174
dtype = args[4]
175175
assert isinstance(dtype, torch.dtype)
176176
return (
177+
# pyrefly: ignore [bad-argument-type]
177178
float(args[0]), # scale
179+
# pyrefly: ignore [bad-argument-type]
178180
int(args[1]), # zero_point
181+
# pyrefly: ignore [bad-argument-type]
179182
int(args[2]), # qmin
183+
# pyrefly: ignore [bad-argument-type]
180184
int(args[3]), # qmax
181185
dtype,
182186
)
@@ -249,9 +253,13 @@ def extract_output_dequant_params_through_permute(
249253
dtype = args[4]
250254
assert isinstance(dtype, torch.dtype)
251255
return (
256+
# pyrefly: ignore [bad-argument-type]
252257
float(args[0]), # scale
258+
# pyrefly: ignore [bad-argument-type]
253259
int(args[1]), # zero_point
260+
# pyrefly: ignore [bad-argument-type]
254261
int(args[2]), # qmin
262+
# pyrefly: ignore [bad-argument-type]
255263
int(args[3]), # qmax
256264
dtype,
257265
)

backends/cadence/aot/compiler_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def get_shape(
6060
return fake_tensor.shape
6161
# Case 3. node holds a param
6262
if node.op == "get_attr":
63+
# pyrefly: ignore [bad-argument-type]
6364
attr_node = getattr(graph_module, node.target)
6465
return attr_node.shape
6566
# Default: return None
@@ -134,6 +135,7 @@ def get_tensor_from_attr(
134135
if node is None:
135136
return None
136137
assert node.op == "get_attr"
138+
# pyrefly: ignore [bad-argument-type]
137139
return getattr(graph_module, node.target)
138140

139141

backends/cadence/aot/fuse_ops.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ def __init__(self) -> None:
385385

386386
@property
387387
def targets(self) -> list[EdgeOpOverload]:
388+
# pyrefly: ignore [bad-return]
388389
return self._CONV_TARGETS
389390

390391
def _get_batchnorm_user(self, conv_node: torch.fx.Node) -> Optional[torch.fx.Node]:
@@ -421,6 +422,7 @@ def _unpack_conv_weights(
421422
"""
422423
conv_packed_arg_node = get_arg(conv_node, "packed_weight", torch.fx.Node)
423424
assert conv_packed_arg_node.op == "get_attr"
425+
# pyrefly: ignore [bad-argument-type]
424426
packed_args = getattr(graph_module, conv_packed_arg_node.target)
425427
weight_tensor, bias_tensor = packed_args.unpack()
426428

0 commit comments

Comments
 (0)