Skip to content

Commit 1c5f77f

Browse files
authored
Arm backend: Fix mypy warnings in test/models (#15594)
Add ignores for third-party modules and change import common into using the correct path. Signed-off-by: [email protected]
1 parent 1205999 commit 1c5f77f

File tree

6 files changed

+18
-10
lines changed

6 files changed

+18
-10
lines changed

backends/arm/test/models/test_conformer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
VgfPipeline,
1919
)
2020

21-
from torchaudio.models import Conformer
21+
from torchaudio.models import Conformer # type: ignore[import-untyped]
2222

2323
input_t = Tuple[torch.Tensor, torch.IntTensor] # Input x, y
2424

backends/arm/test/models/test_deit_tiny_arm.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from typing import Tuple
99

10-
import timm
10+
import timm # type: ignore[import-untyped]
1111

1212
import torch
1313

@@ -19,8 +19,11 @@
1919
VgfPipeline,
2020
)
2121

22-
from timm.data import IMAGENET_INCEPTION_MEAN, IMAGENET_INCEPTION_STD
23-
from torchvision import transforms
22+
from timm.data import ( # type: ignore[import-untyped]
23+
IMAGENET_INCEPTION_MEAN,
24+
IMAGENET_INCEPTION_STD,
25+
)
26+
from torchvision import transforms # type: ignore[import-untyped]
2427

2528
logger = logging.getLogger(__name__)
2629

backends/arm/test/models/test_inception_v3_arm.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55

66
from typing import Tuple
77

8-
import common
98
import pytest
109

1110
import torch
1211

12+
from executorch.backends.arm.test import common
13+
1314
from executorch.backends.arm.test.tester.test_pipeline import (
1415
EthosU55PipelineINT,
1516
EthosU85PipelineINT,
@@ -18,7 +19,7 @@
1819
VgfPipeline,
1920
)
2021

21-
from torchvision import models, transforms
22+
from torchvision import models, transforms # type: ignore[import-untyped]
2223

2324
ic3 = models.inception_v3(weights=models.Inception_V3_Weights)
2425
ic3 = ic3.eval()

backends/arm/test/models/test_mobilenet_v3_arm.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55

66
from typing import Tuple
77

8-
import common
98
import pytest
109

1110
import torch
1211

12+
from executorch.backends.arm.test import common
13+
1314
from executorch.backends.arm.test.tester.test_pipeline import (
1415
EthosU55PipelineINT,
1516
EthosU85PipelineINT,
@@ -18,7 +19,7 @@
1819
VgfPipeline,
1920
)
2021

21-
from torchvision import models, transforms
22+
from torchvision import models, transforms # type: ignore[import-untyped]
2223

2324
mv3 = models.mobilenet_v3_small(weights=models.MobileNet_V3_Small_Weights)
2425
mv3 = mv3.eval()

backends/arm/test/models/test_resnet18.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
)
1818

1919
from torchvision import transforms # type: ignore[import-untyped]
20-
from torchvision.models import resnet18, ResNet18_Weights
20+
from torchvision.models import ( # type: ignore[import-untyped]
21+
resnet18,
22+
ResNet18_Weights,
23+
)
2124

2225
model = resnet18(weights=ResNet18_Weights)
2326
model = model.eval()

backends/arm/test/models/test_w2l_arm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
VgfPipeline,
2121
)
2222

23-
from torchaudio import models
23+
from torchaudio import models # type: ignore[import-untyped]
2424

2525
input_t = Tuple[torch.Tensor] # Input x
2626

0 commit comments

Comments
 (0)