Skip to content

Commit becae5a

Browse files
committed
Arm backend: Remove obsolete import ignores
The mypy lint job now resolves the TOSA dependencies and project-internal modules, so their import-not-found suppressions are obsolete. Retain import-untyped suppressions for tosa-tools because the package does not provide typing metadata. Authored with Codex. Signed-off-by: Per Held <per.held@arm.com> Change-Id: I1adf6c3d6fc45923ae58238666e27d19272c39a7
1 parent 201f3ea commit becae5a

11 files changed

Lines changed: 20 additions & 38 deletions

File tree

‎backends/arm/_passes/decompose_any_pass.py‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,8 @@
1111
create_node,
1212
get_first_fake_tensor,
1313
)
14-
from executorch.exir.dialects._ops import ( # type: ignore[import-not-found]
15-
ops as exir_ops,
16-
)
17-
from executorch.exir.pass_base import ( # type: ignore[import-not-found]
18-
ExportPass,
19-
PassResult,
20-
)
14+
from executorch.exir.dialects._ops import ops as exir_ops
15+
from executorch.exir.pass_base import ExportPass, PassResult
2116

2217

2318
class DecomposeAnyPass(ArmPass):

‎backends/arm/ethosu/compile_spec.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99
from executorch.backends.arm.common.arm_compile_spec import ArmCompileSpec
1010
from executorch.backends.arm.common.pipeline_config import ArmPassPipelineConfig
11-
from executorch.backends.arm.tosa import ( # type: ignore[import-not-found]
12-
TosaSpecification,
13-
)
11+
from executorch.backends.arm.tosa import TosaSpecification
1412
from executorch.exir.backend.compile_spec_schema import CompileSpec
1513

1614

‎backends/arm/test/misc/test_process_node.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from executorch.backends.arm.tosa.specification import TosaSpecification
1616
from executorch.exir import to_edge
1717
from torch._export.utils import is_param
18-
from tosa.TosaGraph import TosaGraph # type: ignore[import-not-found, import-untyped]
18+
from tosa.TosaGraph import TosaGraph # type: ignore[import-untyped]
1919
from tosa_serializer.numpy_utils import pack_6bit_array
2020

2121

‎backends/arm/test/misc/test_reshape_permute_5d_regression.py‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,9 @@ def _run_model(model: torch.nn.Module, out_dir: str) -> Path:
106106

107107

108108
def _assert_all_transposes_shape_consistent(tosa_path: Path) -> None:
109-
import tosa.Op as Op # type: ignore[import-not-found,import-untyped]
110-
from tosa.TosaGraph import ( # type: ignore[import-not-found,import-untyped]
111-
TosaGraph,
112-
)
113-
from tosa.TransposeAttribute import ( # type: ignore[import-not-found,import-untyped]
109+
import tosa.Op as Op # type: ignore[import-untyped]
110+
from tosa.TosaGraph import TosaGraph # type: ignore[import-untyped]
111+
from tosa.TransposeAttribute import ( # type: ignore[import-untyped]
114112
TransposeAttribute,
115113
)
116114

‎backends/arm/test/misc/test_tosa_constant_pool.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import pytest
1111
import tosa_serializer as ts
1212
from executorch.backends.arm.tosa.constant_pool import TosaSerializerWithConstantPool
13-
from tosa.TosaGraph import TosaGraph # type: ignore[import-not-found, import-untyped]
13+
from tosa.TosaGraph import TosaGraph # type: ignore[import-untyped]
1414

1515

1616
def _serializer(path_prefix=""):

‎backends/arm/test/misc/tosa_dialect/test_tosa_shape_node_visitors.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from executorch.backends.arm.tosa.mapping import TosaArg
2222
from executorch.backends.arm.tosa.specification import TosaSpecification
2323
from torch.fx import Node
24-
from tosa.TosaGraph import TosaGraph # type: ignore[import-not-found, import-untyped]
24+
from tosa.TosaGraph import TosaGraph # type: ignore[import-untyped]
2525

2626

2727
SHAPE_VISITOR_TARGETS = {

‎backends/arm/test/runner_utils.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
from executorch.exir.lowered_backend_module import LoweredBackendModule
4242
from torch.fx.node import Node
4343
from torch.overrides import TorchFunctionMode
44-
from tosa.TosaGraph import TosaGraph # type: ignore[import-not-found, import-untyped]
44+
from tosa.TosaGraph import TosaGraph # type: ignore[import-untyped]
4545

4646
logger = logging.getLogger(__name__)
4747

@@ -1278,7 +1278,7 @@ def run_tosa_graph(
12781278
inputs_np = [torch_tensor_to_numpy(input_tensor) for input_tensor in inputs]
12791279

12801280
if isinstance(tosa_version, Tosa_1_00):
1281-
import tosa_reference_model as reference_model # type: ignore[import-not-found, import-untyped]
1281+
import tosa_reference_model as reference_model # type: ignore[import-untyped]
12821282

12831283
debug_mode = "ALL" if logger.getEffectiveLevel() <= logging.DEBUG else None
12841284
outputs_np, status = reference_model.run(

‎backends/arm/test/tester/test_pipeline.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ def is_tosa_ref_model_available():
505505
# Not all deployments of ET have the TOSA reference model available.
506506
# Make sure we don't try to use it if it's not available.
507507
try:
508-
import tosa_reference_model # type: ignore[import-not-found, import-untyped]
508+
import tosa_reference_model # type: ignore[import-untyped]
509509

510510
# Check if the module has content
511511
return bool(dir(tosa_reference_model))

‎backends/arm/tosa/dialect/real_impl.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def real_impl(*args, **kwargs) -> torch.Tensor:
5757
# Import lazily: the reference model is only needed to execute an op,
5858
# not to import the dialect. Linking the native extension into every
5959
# dialect consumer overflows the ELF relocation limit in large builds.
60-
import tosa_reference_model as reference_model # type: ignore[import-not-found, import-untyped]
60+
import tosa_reference_model as reference_model # type: ignore[import-untyped]
6161
import tosa_serializer as ts
6262

6363
bound = signature.bind(*args, **kwargs)

‎backends/arm/vgf/backend.py‎

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,23 @@
3131
PassInsertions,
3232
register_pass_insertions_before,
3333
)
34-
from executorch.backends.arm.tosa.backend import ( # type: ignore[import-not-found]
34+
from executorch.backends.arm.tosa.backend import (
3535
arm_get_first_delegation_tag,
3636
TOSABackend,
3737
)
38-
from executorch.backends.arm.vgf._passes import ( # type: ignore[import-not-found]
38+
from executorch.backends.arm.vgf._passes import (
3939
FuseGridSamplerFlowOffsetPass,
4040
InsertGridSamplerGridDequantPass,
4141
RewriteGridSamplerToTosaCustomPass,
4242
)
4343

44-
from executorch.backends.arm.vgf.compile_spec import ( # type: ignore[import-not-found]
45-
VgfCompileSpec,
46-
)
47-
from executorch.backends.arm.vgf.model_converter import ( # type: ignore[import-not-found]
44+
from executorch.backends.arm.vgf.compile_spec import VgfCompileSpec
45+
from executorch.backends.arm.vgf.model_converter import (
4846
model_converter_env,
4947
require_model_converter_executable,
5048
)
51-
from executorch.exir.backend.backend_details import ( # type: ignore[import-not-found]
52-
BackendDetails,
53-
PreprocessResult,
54-
)
55-
from executorch.exir.backend.compile_spec_schema import ( # type: ignore[import-not-found]
56-
CompileSpec,
57-
)
49+
from executorch.exir.backend.backend_details import BackendDetails, PreprocessResult
50+
from executorch.exir.backend.compile_spec_schema import CompileSpec
5851
from executorch.exir.pass_base import ExportPass
5952
from torch.export.exported_program import ExportedProgram
6053

0 commit comments

Comments
 (0)