Skip to content

Commit 27ae6cc

Browse files
authored
Arm backend: Fix mypy warnings in test/quantizer (#15525)
Signed-off-by: [email protected]
1 parent ba4621a commit 27ae6cc

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

backends/arm/test/quantizer/test_generic_annotater.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# LICENSE file in the root directory of this source tree.
55
import itertools
66

7-
from typing import Tuple
7+
from typing import Any, Callable, Tuple
88

99
import torch
1010
from executorch.backends.arm.quantizer import is_annotated
@@ -18,20 +18,25 @@
1818

1919

2020
class SingleOpModel(torch.nn.Module):
21-
def __init__(self, op, example_input, **op_kwargs) -> None:
21+
def __init__(
22+
self,
23+
op: Callable[..., torch.Tensor],
24+
example_input: Tuple[Any, ...],
25+
**op_kwargs: Any,
26+
) -> None:
2227
super().__init__()
23-
self.op = op
24-
self._example_input = example_input
25-
self.op_kwargs = op_kwargs
28+
self.op: Callable[..., torch.Tensor] = op
29+
self._example_input: Tuple[Any, ...] = example_input
30+
self.op_kwargs: dict[str, Any] = dict(op_kwargs)
2631

27-
def forward(self, x):
32+
def forward(self, x: Any) -> torch.Tensor:
2833
return self.op(x, **self.op_kwargs)
2934

30-
def example_inputs(self):
35+
def example_inputs(self) -> Tuple[Any, ...]:
3136
return self._example_input
3237

3338

34-
def check_annotation(model):
39+
def check_annotation(model: SingleOpModel) -> None:
3540
pipeline = TosaPipelineINT[input_t1](model, model.example_inputs(), [], [])
3641
pipeline.pop_stage("check_count.exir")
3742
pipeline.pop_stage("run_method_and_compare_outputs")

0 commit comments

Comments
 (0)