Skip to content

Commit d45a7b1

Browse files
committed
Arm backend: Add Inception v3 test
Signed-off-by: Tom Allsop <[email protected]> Change-Id: I25b0b8aca7c2c309a9b19e2308e128f460884a75
1 parent 1b42512 commit d45a7b1

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Copyright 2025 Arm Limited and/or its affiliates.
2+
#
3+
# This source code is licensed under the BSD-style license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
6+
from typing import Tuple
7+
8+
import common
9+
import pytest
10+
11+
import torch
12+
13+
from executorch.backends.arm.test.tester.test_pipeline import (
14+
EthosU55PipelineBI,
15+
EthosU85PipelineBI,
16+
TosaPipelineBI,
17+
TosaPipelineMI,
18+
)
19+
20+
from torchvision import models, transforms
21+
22+
ic3 = models.inception_v3(weights=models.Inception_V3_Weights)
23+
ic3 = ic3.eval()
24+
25+
# Normalization values referenced from here:
26+
# https://docs.pytorch.org/vision/main/models/generated/torchvision.models.quantization.inception_v3.html
27+
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
28+
29+
model_inputs = (normalize(torch.rand(1, 3, 224, 224)),)
30+
input_t = Tuple[torch.Tensor]
31+
32+
33+
@pytest.mark.slow
34+
def test_ic3_tosa_MI():
35+
pipeline = TosaPipelineMI[input_t](
36+
ic3,
37+
model_inputs,
38+
aten_op=[],
39+
exir_op=[],
40+
use_to_edge_transform_and_lower=True,
41+
)
42+
pipeline.run()
43+
44+
45+
@pytest.mark.slow
46+
def test_ic3_tosa_BI():
47+
pipeline = TosaPipelineBI[input_t](
48+
ic3,
49+
model_inputs,
50+
aten_op=[],
51+
exir_op=[],
52+
use_to_edge_transform_and_lower=True,
53+
atol=0.5,
54+
qtol=1,
55+
)
56+
pipeline.run()
57+
58+
59+
@pytest.mark.slow
60+
@pytest.mark.skip(reason="Takes too long to run on CI")
61+
@common.XfailIfNoCorstone300
62+
def test_ic3_u55_BI():
63+
pipeline = EthosU55PipelineBI[input_t](
64+
ic3,
65+
model_inputs,
66+
aten_ops=[],
67+
exir_ops=[],
68+
run_on_fvp=True,
69+
use_to_edge_transform_and_lower=True,
70+
atol=0.5,
71+
qtol=1,
72+
)
73+
pipeline.run()
74+
75+
76+
@pytest.mark.slow
77+
@pytest.mark.skip(reason="Takes too long to run on CI")
78+
@common.XfailIfNoCorstone320
79+
def test_ic3_u85_BI():
80+
pipeline = EthosU85PipelineBI[input_t](
81+
ic3,
82+
model_inputs,
83+
aten_ops=[],
84+
exir_ops=[],
85+
run_on_fvp=True,
86+
use_to_edge_transform_and_lower=True,
87+
atol=0.5,
88+
qtol=1,
89+
)
90+
pipeline.run()

0 commit comments

Comments
 (0)