Skip to content

Commit cdc5388

Browse files
kirklandsignmergennachin
authored andcommitted
Fix cadence BUCK deps and pyre
Differential Revision: D66553586 Pull Request resolved: #7116
1 parent dfceca9 commit cdc5388

File tree

5 files changed

+6
-18
lines changed

5 files changed

+6
-18
lines changed

backends/cadence/runtime/TARGETS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ python_library(
1818
"//executorch/devtools/bundled_program:config",
1919
"//executorch/devtools/bundled_program:core",
2020
"//executorch/devtools/bundled_program/serialize:lib",
21+
"//executorch/devtools:lib",
2122
"//executorch/exir:lib",
2223
],
2324
)

backends/cadence/runtime/runtime.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,7 @@ def run(
167167

168168

169169
def compare(
170-
# pyre-fixme[2]: Parameter annotation cannot be `Any`.
171170
outputs: Any,
172-
# pyre-fixme[2]: Parameter annotation cannot be `Any`.
173171
ref_outputs: Any,
174172
name: str = "",
175173
eps_error: float = 1e-1,
@@ -223,7 +221,6 @@ def run_and_compare(
223221
compare(outputs, ref_outputs, eps_error=eps_error, eps_warn=eps_warn)
224222

225223

226-
# pyre-fixme[24]: Generic type `np.ndarray` expects 2 type parameters.
227224
def to_nd_array(v: Union[bool, numbers.Number, ndarray, torch.Tensor]) -> np.ndarray:
228225
if isinstance(v, np.ndarray):
229226
return v

backends/cadence/runtime/utils.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@
1313
import torch
1414

1515

16-
# pyre-fixme[24]: Generic type `np.ndarray` expects 2 type parameters.
17-
def distance(fn: Callable[[np.ndarray, np.ndarray], float]) -> Callable[
16+
def distance(
17+
fn: Callable[[np.ndarray, np.ndarray], float],
18+
) -> Callable[
1819
[
19-
# pyre-fixme[24]: Generic type `np.ndarray` expects 2 type parameters.
2020
typing.Union[np.ndarray, torch._tensor.Tensor],
21-
# pyre-fixme[24]: Generic type `np.ndarray` expects 2 type parameters.
2221
typing.Union[np.ndarray, torch._tensor.Tensor],
2322
],
2423
float,
@@ -27,9 +26,7 @@ def distance(fn: Callable[[np.ndarray, np.ndarray], float]) -> Callable[
2726
# the distance between two N-D tensors given a function. This can be a RMS
2827
# function, maximum abs diff, or any kind of distance function.
2928
def wrapper(
30-
# pyre-fixme[24]: Generic type `np.ndarray` expects 2 type parameters.
3129
a: Union[np.ndarray, torch.Tensor],
32-
# pyre-fixme[24]: Generic type `np.ndarray` expects 2 type parameters.
3330
b: Union[np.ndarray, torch.Tensor],
3431
) -> float:
3532
# convert a and b to np.ndarray type fp64
@@ -68,24 +65,20 @@ def wrapper(
6865

6966

7067
@distance
71-
# pyre-fixme[24]: Generic type `np.ndarray` expects 2 type parameters.
7268
def rms(a: np.ndarray, b: np.ndarray) -> float:
7369
return ((a - b) ** 2).mean() ** 0.5
7470

7571

7672
@distance
77-
# pyre-fixme[24]: Generic type `np.ndarray` expects 2 type parameters.
7873
def max_abs_diff(a: np.ndarray, b: np.ndarray) -> float:
7974
return np.abs(a - b).max()
8075

8176

8277
@distance
83-
# pyre-fixme[24]: Generic type `np.ndarray` expects 2 type parameters.
8478
def max_rel_diff(x: np.ndarray, x_ref: np.ndarray) -> float:
8579
return np.abs((x - x_ref) / x_ref).max()
8680

8781

88-
# pyre-fixme[24]: Generic type `np.ndarray` expects 2 type parameters.
8982
def to_np_arr_fp64(x: Union[np.ndarray, torch.Tensor]) -> np.ndarray:
9083
if isinstance(x, torch.Tensor):
9184
x = x.detach().cpu().numpy()
@@ -94,11 +87,8 @@ def to_np_arr_fp64(x: Union[np.ndarray, torch.Tensor]) -> np.ndarray:
9487
return x
9588

9689

97-
# pyre-fixme[3]: Return type must be annotated.
9890
def normalized_rms(
99-
# pyre-fixme[24]: Generic type `np.ndarray` expects 2 type parameters.
10091
predicted: Union[np.ndarray, torch.Tensor],
101-
# pyre-fixme[24]: Generic type `np.ndarray` expects 2 type parameters.
10292
ground_truth: Union[np.ndarray, torch.Tensor],
10393
):
10494
num = rms(predicted, ground_truth)

examples/cadence/operators/test_add_op.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414

1515
class ATenOpTestCases(unittest.TestCase):
16+
# pyre-fixme[16]: Module `parameterized.parameterized` has no attribute `expand`.
1617
@parameterized.expand(
1718
[
1819
[(7, 5, 6), (7, 5, 6)],
@@ -61,6 +62,7 @@ def forward(self, x: torch.Tensor, y: torch.Tensor):
6162
model, (X, Y), file_name=self._testMethodName, run_and_compare=False
6263
)
6364

65+
# pyre-fixme[16]: Module `parameterized.parameterized` has no attribute `expand`.
6466
@parameterized.expand(
6567
[
6668
[(7, 5, 6), (7, 5, 6)],

extension/llm/export/quantizer_lib.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,12 @@ def get_qnn_quantizer(
184184
)
185185
qnn_quantizer.set_per_channel_conv_quant(enable=False)
186186
qnn_quantizer.set_per_channel_linear_quant(enable=False)
187-
# pyre-ignore: Undefined attribute [16]: Module `executorch.backends` has no attribute `qualcomm`.
188187
qnn_quantizer.set_quant_config(
189188
quant_dtype, is_qat=is_qat, act_observer=MinMaxObserver
190189
)
191190
elif quant_config == "16a4w":
192191
# pyre-ignore: Undefined attribute [16]: Module `executorch.backends` has no attribute `qualcomm`.
193192
quant_dtype = QuantDtype.use_16a4w
194-
# pyre-ignore: Undefined attribute [16]: Module `executorch.backends` has no attribute `qualcomm`.
195193
qnn_quantizer.set_quant_config(
196194
quant_dtype, is_qat=is_qat, act_observer=MinMaxObserver
197195
)

0 commit comments

Comments
 (0)