Skip to content

Arm backend: Add Inception v3 test #12111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 8, 2025
Merged
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
121 changes: 121 additions & 0 deletions backends/arm/test/models/test_inception_v3_arm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Copyright 2025 Arm Limited and/or its affiliates.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

from typing import Tuple

import common
import pytest

import torch

from executorch.backends.arm.test.tester.test_pipeline import (
EthosU55PipelineINT,
EthosU85PipelineINT,
TosaPipelineFP,
TosaPipelineINT,
VgfPipeline,
)

from torchvision import models, transforms

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

# 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])

model_inputs = (normalize(torch.rand(1, 3, 224, 224)),)
input_t = Tuple[torch.Tensor]


@pytest.mark.slow
def test_ic3_tosa_FP():
pipeline = TosaPipelineFP[input_t](
ic3,
model_inputs,
aten_op=[],
exir_op=[],
use_to_edge_transform_and_lower=True,
)
pipeline.run()


@pytest.mark.slow
def test_ic3_tosa_BI():
pipeline = TosaPipelineINT[input_t](
ic3,
model_inputs,
aten_op=[],
exir_op=[],
use_to_edge_transform_and_lower=True,
atol=0.5,
qtol=1,
)
pipeline.run()


@pytest.mark.slow
@pytest.mark.skip(reason="Takes too long to run on CI")
@common.XfailIfNoCorstone300
def test_ic3_u55_BI():
pipeline = EthosU55PipelineINT[input_t](
ic3,
model_inputs,
aten_ops=[],
exir_ops=[],
run_on_fvp=True,
use_to_edge_transform_and_lower=True,
atol=0.5,
qtol=1,
)
pipeline.run()


@pytest.mark.slow
@pytest.mark.skip(reason="Takes too long to run on CI")
@common.XfailIfNoCorstone320
def test_ic3_u85_BI():
pipeline = EthosU85PipelineINT[input_t](
ic3,
model_inputs,
aten_ops=[],
exir_ops=[],
run_on_fvp=True,
use_to_edge_transform_and_lower=True,
atol=0.5,
qtol=1,
)
pipeline.run()


@pytest.mark.slow
@pytest.mark.skip(reason="Takes too long to run on CI")
@common.SkipIfNoModelConverter
def test_ic3_vgf_FP():
pipeline = VgfPipeline[input_t](
ic3,
model_inputs,
aten_op=[],
exir_op=[],
tosa_version="TOSA-1.0+FP",
use_to_edge_transform_and_lower=True,
)
pipeline.run()


@pytest.mark.slow
@pytest.mark.skip(reason="Takes too long to run on CI")
@common.SkipIfNoModelConverter
def test_ic3_vgf_INT():
pipeline = VgfPipeline[input_t](
ic3,
model_inputs,
aten_op=[],
exir_op=[],
tosa_version="TOSA-1.0+INT",
use_to_edge_transform_and_lower=True,
)
pipeline.run()
Loading