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
7 changes: 6 additions & 1 deletion backends/arm/test/ops/test_cos.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

from typing import Tuple

import torch
import pytest

import torch
from executorch.backends.arm.test import common, conftest
from executorch.backends.arm.test.tester.test_pipeline import (
EthosU55PipelineBI,
Expand Down Expand Up @@ -37,24 +38,28 @@ def forward(self, x: torch.Tensor):


@common.parametrize("test_data", test_data_suite)
@pytest.mark.tosa_ref_model
def test_cos_tosa_MI(test_data: Tuple):
pipeline = TosaPipelineMI[input_t1](
Cos(),
(test_data,),
aten_op,
exir_op=[],
run_on_tosa_ref_model=conftest.is_option_enabled("tosa_ref_model"),
)
if conftest.get_option("tosa_version") == "1.0":
pipeline.run()


@common.parametrize("test_data", test_data_suite)
@pytest.mark.tosa_ref_model
def test_cos_tosa_BI(test_data: Tuple):
pipeline = TosaPipelineBI[input_t1](
Cos(),
(test_data,),
aten_op,
exir_op=[],
run_on_tosa_ref_model=conftest.is_option_enabled("tosa_ref_model"),
)
pipeline.run()

Expand Down
1 change: 1 addition & 0 deletions backends/arm/test/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def define_arm_tests():
"ops/test_slice.py",
"ops/test_sigmoid.py",
"ops/test_tanh.py",
"ops/test_cos.py",
]

# Quantization
Expand Down
36 changes: 22 additions & 14 deletions backends/arm/test/tester/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ class TosaPipelineBI(BasePipelineMaker, Generic[T]):
exir_ops: Exir dialect ops expected to be found in the graph after to_edge.
if not using use_edge_to_transform_and_lower.

run_on_tosa_ref_model: Set to true to test the tosa file on the TOSA reference model.

tosa_version: A string for identifying the TOSA version, see common.get_tosa_compile_spec for
options.
use_edge_to_transform_and_lower: Selects betweeen two possible ways of lowering the module.
Expand All @@ -270,6 +272,7 @@ def __init__(
test_data: T,
aten_op: str | List[str],
exir_op: Optional[str | List[str]] = None,
run_on_tosa_ref_model: bool = True,
tosa_version: str = "TOSA-0.80+BI",
symmetric_io_quantization: bool = False,
use_to_edge_transform_and_lower: bool = True,
Expand Down Expand Up @@ -324,13 +327,14 @@ def __init__(
suffix="quant_nodes",
)

self.add_stage(
self.tester.run_method_and_compare_outputs,
atol=atol,
rtol=rtol,
qtol=qtol,
inputs=self.test_data,
)
if run_on_tosa_ref_model:
self.add_stage(
self.tester.run_method_and_compare_outputs,
atol=atol,
rtol=rtol,
qtol=qtol,
inputs=self.test_data,
)


class TosaPipelineMI(BasePipelineMaker, Generic[T]):
Expand All @@ -345,6 +349,8 @@ class TosaPipelineMI(BasePipelineMaker, Generic[T]):
exir_ops: Exir dialect ops expected to be found in the graph after to_edge.
if not using use_edge_to_transform_and_lower.

run_on_tosa_ref_model: Set to true to test the tosa file on the TOSA reference model.

tosa_version: A string for identifying the TOSA version, see common.get_tosa_compile_spec for
options.
use_edge_to_transform_and_lower: Selects betweeen two possible ways of lowering the module.
Expand All @@ -357,6 +363,7 @@ def __init__(
test_data: T,
aten_op: str | List[str],
exir_op: Optional[str | List[str]] = None,
run_on_tosa_ref_model: bool = True,
tosa_version: str = "TOSA-0.80+MI",
use_to_edge_transform_and_lower: bool = True,
custom_path: str = None,
Expand Down Expand Up @@ -385,13 +392,14 @@ def __init__(
suffix="quant_nodes",
)

self.add_stage(
self.tester.run_method_and_compare_outputs,
atol=atol,
rtol=rtol,
qtol=qtol,
inputs=self.test_data,
)
if run_on_tosa_ref_model:
self.add_stage(
self.tester.run_method_and_compare_outputs,
atol=atol,
rtol=rtol,
qtol=qtol,
inputs=self.test_data,
)


class EthosU55PipelineBI(BasePipelineMaker, Generic[T]):
Expand Down
Loading