From f34eda8e3514a3ca390cf940f52e898f86fcd393 Mon Sep 17 00:00:00 2001 From: Digant Desai Date: Fri, 11 Apr 2025 09:00:19 -0700 Subject: [PATCH] Arm Ethos-u: Buckify Slice tests (#10099) Summary: Pull Request resolved: https://github.com/pytorch/executorch/pull/10099 As title. bypass-github-export-checks bypass-github-pytorch-ci-checks bypass-github-executorch-ci-checks Reviewed By: 3l1, manuelcandales Differential Revision: D72766924 --- backends/arm/test/ops/test_slice.py | 19 ++++++++++++++----- backends/arm/test/targets.bzl | 3 ++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/backends/arm/test/ops/test_slice.py b/backends/arm/test/ops/test_slice.py index 7cb82e3a828..6900fda3abe 100644 --- a/backends/arm/test/ops/test_slice.py +++ b/backends/arm/test/ops/test_slice.py @@ -7,9 +7,11 @@ import unittest 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 @@ -35,7 +37,7 @@ def forward(self, x: torch.Tensor): def _test_slice_tosa_MI_pipeline( self, module: torch.nn.Module, test_data: torch.Tensor ): - ( + tester = ( ArmTester( module, example_inputs=test_data, @@ -48,14 +50,16 @@ def _test_slice_tosa_MI_pipeline( .partition() .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_slice_tosa_BI_pipeline( self, module: torch.nn.Module, test_data: Tuple[torch.Tensor] ): - ( + tester = ( ArmTester( module, example_inputs=test_data, @@ -68,9 +72,11 @@ def _test_slice_tosa_BI_pipeline( .partition() .check_count({"torch.ops.higher_order.executorch_call_delegate": 1}) .to_executorch() - .run_method_and_compare_outputs(inputs=test_data, qtol=1) ) + if conftest.is_option_enabled("tosa_ref_model"): + tester.run_method_and_compare_outputs(inputs=test_data, qtol=1) + def _test_slice_ethos_BI_pipeline( self, compile_spec: list[CompileSpec], @@ -107,14 +113,17 @@ def _test_slice_u85_BI_pipeline( ) @parameterized.expand(Slice.test_tensors) + @pytest.mark.tosa_ref_model def test_slice_tosa_MI(self, tensor): self._test_slice_tosa_MI_pipeline(self.Slice(), (tensor,)) @parameterized.expand(Slice.test_tensors[:2]) + @pytest.mark.tosa_ref_model def test_slice_nchw_tosa_BI(self, test_tensor: torch.Tensor): self._test_slice_tosa_BI_pipeline(self.Slice(), (test_tensor,)) @parameterized.expand(Slice.test_tensors[2:]) + @pytest.mark.tosa_ref_model def test_slice_nhwc_tosa_BI(self, test_tensor: torch.Tensor): self._test_slice_tosa_BI_pipeline(self.Slice(), (test_tensor,)) diff --git a/backends/arm/test/targets.bzl b/backends/arm/test/targets.bzl index e97b46cb977..4eece953f2d 100644 --- a/backends/arm/test/targets.bzl +++ b/backends/arm/test/targets.bzl @@ -12,7 +12,8 @@ def define_arm_tests(): test_files.remove("passes/test_ioquantization_pass.py") # Operators - test_files += native.glob(["ops/test_linear.py"]) + test_files += ["ops/test_linear.py"] + test_files += ["ops/test_slice.py"] TESTS = {}