Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions backends/arm/test/models/test_inception_v3_arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
ic3 = models.inception_v3(weights=models.Inception_V3_Weights)
ic3 = ic3.eval()

ic3_fp16 = models.inception_v3(weights=models.Inception_V3_Weights).to(torch.float16)
ic3_fp16 = ic3_fp16.eval()
Comment on lines +27 to +28
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ic3_fp16 is instantiated and converted at import time, which forces a second model construction + weight load even when the FP16 test isn’t selected. Consider creating the FP16 model inside test_ic3_tosa_FP_fp16() (or via a cached pytest fixture) to reduce test import time and memory usage.

Copilot uses AI. Check for mistakes.

# Normalization values referenced from here:
# https://docs.pytorch.org/vision/main/models/generated/torchvision.models.quantization.inception_v3.html
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
Expand All @@ -44,6 +47,20 @@ def test_ic3_tosa_FP():
pipeline.run()


@pytest.mark.slow
def test_ic3_tosa_FP_fp16():
inputs_fp16 = tuple(t.to(torch.float16) for t in model_inputs)
pipeline = TosaPipelineFP[input_t](
ic3_fp16,
inputs_fp16,
aten_op=[],
exir_op=[],
use_to_edge_transform_and_lower=True,
atol=5e-2,
)
pipeline.run()


@pytest.mark.slow
def test_ic3_tosa_INT():
pipeline = TosaPipelineINT[input_t](
Expand Down
19 changes: 19 additions & 0 deletions backends/arm/test/models/test_mobilenet_v3_arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
mv3 = models.mobilenet_v3_small(weights=models.MobileNet_V3_Small_Weights)
mv3 = mv3.eval()

mv3_fp16 = models.mobilenet_v3_small(weights=models.MobileNet_V3_Small_Weights).to(
torch.float16
)
mv3_fp16 = mv3_fp16.eval()

Comment on lines +27 to +31
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mv3_fp16 is instantiated and converted at import time, which forces a second model construction + weight load even when the FP16 test isn’t selected. Consider creating the FP16 model inside test_mv3_tosa_FP_fp16() (or via a cached pytest fixture) to reduce test import time and memory usage.

Copilot uses AI. Check for mistakes.
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])

input_tensor = torch.rand(1, 3, 232, 232)
Expand All @@ -40,6 +45,20 @@ def test_mv3_tosa_FP():
pipeline.run()


@pytest.mark.slow
def test_mv3_tosa_FP_fp16():
inputs_fp16 = tuple(t.to(torch.float16) for t in model_inputs)
pipeline = TosaPipelineFP[input_t](
mv3_fp16,
inputs_fp16,
aten_op=[],
exir_op=[],
use_to_edge_transform_and_lower=True,
atol=5e-2,
)
pipeline.run()


@pytest.mark.slow
def test_mv3_tosa_INT():
pipeline = TosaPipelineINT[input_t](
Expand Down
Loading