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
48 changes: 48 additions & 0 deletions backends/arm/test/ops/test_argmax.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()
36 changes: 36 additions & 0 deletions backends/arm/test/ops/test_pow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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()
2 changes: 1 addition & 1 deletion backends/arm/test/ops/test_sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
Loading