Skip to content

Buckify Sigmoid test #10224

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 1 commit into from
Apr 16, 2025
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
24 changes: 19 additions & 5 deletions backends/arm/test/ops/test_sigmoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

from typing import Tuple

import pytest

import torch
from executorch.backends.arm.test import common
from executorch.backends.arm.test import common, conftest
from executorch.backends.arm.test.tester.arm_tester import ArmTester
from executorch.exir.backend.compile_spec_schema import CompileSpec
from parameterized import parameterized
Expand Down Expand Up @@ -63,7 +65,7 @@ def forward(self, x, y):
def _test_sigmoid_tosa_MI_pipeline(
self, module: torch.nn.Module, test_data: Tuple[torch.tensor]
):
(
tester = (
ArmTester(
module,
example_inputs=test_data,
Expand All @@ -77,11 +79,13 @@ def _test_sigmoid_tosa_MI_pipeline(
.check_not(["executorch_exir_dialects_edge__ops_aten_sigmoid_default"])
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
.to_executorch()
.run_method_and_compare_outputs(inputs=test_data)
)

if conftest.is_option_enabled("tosa_ref_model"):
tester.run_method_and_compare_outputs(inputs=test_data)

def _test_sigmoid_tosa_BI_pipeline(self, module: torch.nn.Module, test_data: Tuple):
(
tester = (
ArmTester(
module,
example_inputs=test_data,
Expand All @@ -96,9 +100,11 @@ def _test_sigmoid_tosa_BI_pipeline(self, module: torch.nn.Module, test_data: Tup
.check_not(["executorch_exir_dialects_edge__ops_aten_sigmoid_default"])
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
.to_executorch()
.run_method_and_compare_outputs(inputs=test_data)
)

if conftest.is_option_enabled("tosa_ref_model"):
tester.run_method_and_compare_outputs(inputs=test_data)

def _test_sigmoid_tosa_ethos_BI_pipeline(
self,
compile_spec: list[CompileSpec],
Expand Down Expand Up @@ -137,6 +143,7 @@ def _test_sigmoid_tosa_u85_BI_pipeline(
)

@parameterized.expand(test_data_suite)
@pytest.mark.tosa_ref_model
def test_sigmoid_tosa_MI(
self,
test_name: str,
Expand All @@ -145,26 +152,33 @@ def test_sigmoid_tosa_MI(
self._test_sigmoid_tosa_MI_pipeline(self.Sigmoid(), (test_data,))

@parameterized.expand(test_data_suite)
@pytest.mark.tosa_ref_model
def test_sigmoid_tosa_BI(self, test_name: str, test_data: torch.Tensor):
self._test_sigmoid_tosa_BI_pipeline(self.Sigmoid(), (test_data,))

@pytest.mark.tosa_ref_model
def test_add_sigmoid_tosa_MI(self):
self._test_sigmoid_tosa_MI_pipeline(self.AddSigmoid(), (test_data_suite[0][1],))

@pytest.mark.tosa_ref_model
def test_add_sigmoid_tosa_BI(self):
self._test_sigmoid_tosa_BI_pipeline(self.AddSigmoid(), (test_data_suite[5][1],))

@pytest.mark.tosa_ref_model
def test_sigmoid_add_tosa_MI(self):
self._test_sigmoid_tosa_MI_pipeline(self.SigmoidAdd(), (test_data_suite[0][1],))

@pytest.mark.tosa_ref_model
def test_sigmoid_add_tosa_BI(self):
self._test_sigmoid_tosa_BI_pipeline(self.SigmoidAdd(), (test_data_suite[0][1],))

@pytest.mark.tosa_ref_model
def test_sigmoid_add_sigmoid_tosa_MI(self):
self._test_sigmoid_tosa_MI_pipeline(
self.SigmoidAddSigmoid(), (test_data_suite[4][1], test_data_suite[3][1])
)

@pytest.mark.tosa_ref_model
def test_sigmoid_add_sigmoid_tosa_BI(self):
self._test_sigmoid_tosa_BI_pipeline(
self.SigmoidAddSigmoid(), (test_data_suite[4][1], test_data_suite[3][1])
Expand Down
7 changes: 5 additions & 2 deletions backends/arm/test/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ def define_arm_tests():
test_files.remove("passes/test_ioquantization_pass.py")

# Operators
test_files += ["ops/test_linear.py"]
test_files += ["ops/test_slice.py"]
test_files += [
"ops/test_linear.py",
"ops/test_slice.py",
"ops/test_sigmoid.py",
]

TESTS = {}

Expand Down
Loading