Skip to content
Open
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
1 change: 1 addition & 0 deletions backends/arm/_passes/insert_table_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class TableOps:
exir_ops.edge.aten.floor.default: torch.floor,
exir_ops.edge.aten.log.default: torch.log,
exir_ops.edge.aten.log1p.default: torch.log1p,
exir_ops.edge.aten.log10.default: torch.log10,
exir_ops.edge.aten.reciprocal.default: torch.reciprocal,
exir_ops.edge.aten.rsqrt.default: torch.rsqrt,
exir_ops.edge.aten.sigmoid.default: torch.sigmoid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
exir_ops.edge.aten.expm1.default,
exir_ops.edge.aten.log.default,
exir_ops.edge.aten.log1p.default,
exir_ops.edge.aten.log10.default,
exir_ops.edge.aten.linear.default,
exir_ops.edge.aten.split_with_sizes_copy.default,
exir_ops.edge.aten.split_copy.Tensor,
Expand Down
1 change: 1 addition & 0 deletions backends/arm/quantizer/quantization_annotator.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ def _match_pattern(
torch.ops.aten.sinh.default,
torch.ops.aten.atan.default,
torch.ops.aten.log1p.default,
torch.ops.aten.log10.default,
torch.ops.aten.acosh.default,
torch.ops.aten.sign.default,
torch.ops.aten.asinh.default,
Expand Down
87 changes: 87 additions & 0 deletions backends/arm/test/ops/test_log10.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# Copyright 2024-2026 Arm Limited and/or its affiliates.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.


from typing import Tuple

import torch
from executorch.backends.arm.test import common

from executorch.backends.arm.test.tester.test_pipeline import (
EthosU55PipelineINT,
EthosU85PipelineINT,
TosaPipelineINT,
VgfPipeline,
)

aten_op = "torch.ops.aten.log10.default"
exir_op = "executorch_exir_dialects_edge__ops_aten_log10_default"

input_t1 = Tuple[torch.Tensor]


def _tensor(values):
return torch.tensor(values, dtype=torch.float32)


test_data_suite = {
# (test_name, test_data)
"tiny_positive": lambda: (_tensor([5e-4, 8e-4, 9e-4, 1e-3, 1.2e-3])),
"mixed_range": lambda: (_tensor([1e-4, 5e-4, 2e-3, 1e-2, 5e-2])),
"ones_rank4": lambda: (torch.ones(1, 10, 10, 10)),
"ones_rank3": lambda: (torch.ones(10, 10, 10)),
"rand": lambda: (torch.rand(10, 10) + 0.001),
"randn_pos": lambda: (torch.randn(10) + 10),
"randn_spread": lambda: (torch.max(torch.Tensor([0.1]), torch.randn(10) * 100)),
"ramp": lambda: (torch.arange(0.01, 20, 0.2)),
}


class Log10(torch.nn.Module):
def forward(self, x: torch.Tensor) -> torch.Tensor:
return torch.log10(x)


@common.parametrize("test_data", test_data_suite)
def test_log10_tosa_INT(test_data: input_t1):
pipeline = TosaPipelineINT[input_t1](Log10(), (test_data(),), aten_op, exir_op)
pipeline.run()


@common.parametrize("test_data", test_data_suite)
@common.XfailIfNoCorstone300
def test_log10_u55_INT(test_data: input_t1):
EthosU55PipelineINT[input_t1](
Log10(),
(test_data(),),
aten_op,
exir_op,
).run()


@common.parametrize("test_data", test_data_suite)
@common.XfailIfNoCorstone320
def test_log10_u85_INT(test_data: input_t1):
EthosU85PipelineINT[input_t1](
Log10(),
(test_data(),),
aten_op,
exir_op,
).run()


@common.parametrize("test_data", test_data_suite)
@common.SkipIfNoModelConverter
def test_log10_vgf_quant(test_data: input_t1):
pipeline = VgfPipeline[input_t1](
Log10(),
(test_data(),),
aten_op,
exir_op,
quantize=True,
)
pipeline.run()
1 change: 1 addition & 0 deletions backends/arm/test/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def define_arm_tests():
"ops/test_cat.py",
"ops/test_conv2d.py",
"ops/test_linear.py",
"ops/test_log10.py",
"ops/test_max_pool1d.py",
"ops/test_mul.py",
"ops/test_permute.py",
Expand Down
Loading