diff --git a/backends/arm/test/ops/test_argmax.py b/backends/arm/test/ops/test_argmax.py index 08e2172cdeb..f29137fcf47 100644 --- a/backends/arm/test/ops/test_argmax.py +++ b/backends/arm/test/ops/test_argmax.py @@ -5,12 +5,14 @@ from typing import Tuple +import pytest import torch from executorch.backends.arm.test import common from executorch.backends.arm.test.tester.test_pipeline import ( OpNotSupportedPipeline, TosaPipelineFP, TosaPipelineINT, + VgfPipeline, ) aten_op = "torch.ops.aten.argmax.default" @@ -131,3 +133,49 @@ def test_argmax_tosa_INT(test_data: Tuple[input_t, int]): ) pipeline.count_tosa_ops({"ARGMAX": 1}) pipeline.run() + + +@pytest.mark.xfail( + reason=( + "VGF ARGMAX output contract mismatch: MLTORCH-2372" + "ExecuTorch output is allocated as int64 while TOSA/VGF emits int32." + ), + strict=True, +) +@common.parametrize( + "test_data", + Argmax.test_data | Argmax.test_data_fp16 | Argmax.test_data_bf16, +) +@common.SkipIfNoModelConverter +def test_argmax_vgf_no_quant(test_data: Tuple[input_t, int]): + data, dim = test_data() + pipeline = VgfPipeline[input_t]( + Argmax(dim), + data, + aten_op, + exir_op, + quantize=False, + tosa_extensions=["bf16"], + ) + pipeline.run() + + +@pytest.mark.xfail( + reason=( + "VGF ARGMAX output contract mismatch: MLTORCH-2372" + "ExecuTorch output is allocated as int64 while TOSA/VGF emits int32." + ), + strict=True, +) +@common.parametrize("test_data", Argmax.test_data) +@common.SkipIfNoModelConverter +def test_argmax_vgf_quant(test_data: Tuple[input_t, int]): + data, dim = test_data() + pipeline = VgfPipeline[input_t]( + Argmax(dim), + data, + aten_op, + exir_op, + quantize=True, + ) + pipeline.run() diff --git a/backends/arm/test/ops/test_pow.py b/backends/arm/test/ops/test_pow.py index 2cde848c7ef..7bec41e81fb 100644 --- a/backends/arm/test/ops/test_pow.py +++ b/backends/arm/test/ops/test_pow.py @@ -57,6 +57,21 @@ class Pow_TensorTensor(torch.nn.Module): ), } + test_data_quant = { + "positive_base_positive_exp": lambda: ( + torch.rand(2, 3, 4) * 1.5 + 0.25, + torch.rand(2, 3, 4) * 1.5 + 0.25, + ), + "broadcast_exp": lambda: ( + torch.rand(1, 3, 4, 4) * 1.5 + 0.25, + torch.rand(1, 3, 1, 1) * 1.5 + 0.25, + ), + "integer_valued_exp": lambda: ( + torch.rand(2, 4) * 1.5 + 0.25, + torch.full((2, 4), 2.0), + ), + } + def forward(self, x: torch.Tensor | float, y: torch.Tensor | float): return torch.pow(x, y) @@ -238,3 +253,24 @@ def test_pow_tensor_scalar_vgf_quant(test_data: Pow_TensorScalar.input_t): quantize=True, ) pipeline.run() + + +@common.parametrize("test_data", Pow_TensorTensor.test_data_quant) +@common.SkipIfNoModelConverter +def test_pow_tensor_tensor_vgf_quant( + test_data: Pow_TensorTensor.input_t, +): + pipeline = VgfPipeline[Pow_TensorTensor.input_t]( + Pow_TensorTensor(), + test_data(), + Pow_TensorTensor.aten_op, + Pow_TensorTensor.exir_op, + quantize=True, + ) + + pipeline.run_and_compare_to_initial_model( + frobenius_threshold=0.3, + cosine_threshold=0.9, + ) + + pipeline.run() diff --git a/backends/arm/test/ops/test_sign.py b/backends/arm/test/ops/test_sign.py index 5e5a88011e9..95ec2f30797 100644 --- a/backends/arm/test/ops/test_sign.py +++ b/backends/arm/test/ops/test_sign.py @@ -17,7 +17,7 @@ ) aten_op = "torch.ops.aten.sign.default" -exir_op = "executorch_exir_dialects_edge__ops_aten__sign_default" +exir_op = "executorch_exir_dialects_edge__ops_aten_sign_default" input_t1 = Tuple[torch.Tensor]