Skip to content
Merged
Changes from 4 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
90 changes: 90 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,90 @@
# 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 (
EthosU55PipelineBI,
EthosU85PipelineBI,
TosaPipelineBI,
TosaPipelineMI,
)

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_MI():
pipeline = TosaPipelineMI[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 = TosaPipelineBI[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 = EthosU55PipelineBI[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 = EthosU85PipelineBI[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()
Loading