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
10 changes: 7 additions & 3 deletions backends/arm/test/ops/test_adaptive_avg_pool2d.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2025 Arm Limited and/or its affiliates.
# Copyright 2025-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.
Expand Down Expand Up @@ -173,7 +173,9 @@ def test_adaptive_avg_pool2d_u55_INT(test_module):
@common.parametrize("test_module", u55_test_modules)
@common.XfailIfNoCorstone300
def test_adaptive_avg_pool2d_u55_INT_a16w8(test_module):
"""Test adaptive_avg_pool2d with 16A8W quantization on U55 (16-bit activations, 8-bit weights)"""
"""Test adaptive_avg_pool2d with 16A8W quantization on U55 (16-bit
activations, 8-bit weights)
"""
model, input_tensor = test_module()
pipeline = EthosU55PipelineINT[input_t](
model,
Expand Down Expand Up @@ -202,7 +204,9 @@ def test_adaptive_avg_pool2d_u85_INT(test_module):
@common.parametrize("test_module", test_modules)
@common.XfailIfNoCorstone320
def test_adaptive_avg_pool2d_u85_INT_a16w8(test_module):
"""Test adaptive_avg_pool2d with 16A8W quantization on U85 (16-bit activations, 8-bit weights)"""
"""Test adaptive_avg_pool2d with 16A8W quantization on U85 (16-bit
activations, 8-bit weights)
"""
model, input_tensor = test_module()
pipeline = EthosU85PipelineINT[input_t](
model,
Expand Down
12 changes: 9 additions & 3 deletions backends/arm/test/ops/test_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ def test_add_tensor_vgf_quant(test_data: input_t1):

@common.parametrize("test_data", Add.test_data)
def test_add_tensor_tosa_INT_16a8w(test_data: input_t1):
"""Test add operation with 16A8W quantization (16-bit activations, 8-bit weights)"""
"""Test add operation with 16A8W quantization (16-bit activations, 8-bit
weights)
"""
per_channel_quantization = False

pipeline = TosaPipelineINT[input_t1](
Expand All @@ -302,7 +304,9 @@ def test_add_tensor_tosa_INT_16a8w(test_data: input_t1):
@common.parametrize("test_data", Add.test_data)
@common.XfailIfNoCorstone300
def test_add_tensor_u55_INT_16a8w(test_data: input_t1):
"""Test add operation with 16A8W quantization on U55 (16-bit activations, 8-bit weights)"""
"""Test add operation with 16A8W quantization on U55 (16-bit activations,
8-bit weights)
"""
per_channel_quantization = False

pipeline = EthosU55PipelineINT[input_t1](
Expand All @@ -323,7 +327,9 @@ def test_add_tensor_u55_INT_16a8w(test_data: input_t1):
@common.parametrize("test_data", Add.test_data)
@common.XfailIfNoCorstone320
def test_add_tensor_u85_INT_16a8w(test_data: input_t1):
"""Test add operation with 16A8W quantization on U85 (16-bit activations, 8-bit weights)"""
"""Test add operation with 16A8W quantization on U85 (16-bit activations,
8-bit weights)
"""
per_channel_quantization = False

pipeline = EthosU85PipelineINT[input_t1](
Expand Down
12 changes: 9 additions & 3 deletions backends/arm/test/ops/test_addmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ def test_addmm_vgf_quant(test_data: input_t1):

@common.parametrize("test_data", test_data_suite)
def test_addmm_16a8w_tosa_INT(test_data: input_t1):
"""Test addmm (FC layer) operation with 16A8W quantization (16-bit activations, 8-bit weights)"""
"""Test addmm (FC layer) operation with 16A8W quantization (16-bit
activations, 8-bit weights)
"""
per_channel_quantization = False

pipeline = TosaPipelineINT[input_t1](
Expand All @@ -214,7 +216,9 @@ def test_addmm_16a8w_tosa_INT(test_data: input_t1):
reason="Vela compilation fails with 'Invalid arguments' for int16 addmm operations"
)
def test_addmm_16a8w_u55_INT(test_data: input_t1):
"""Test addmm (FC layer) operation with 16A8W quantization on U55 (16-bit activations, 8-bit weights)"""
"""Test addmm (FC layer) operation with 16A8W quantization on U55 (16-bit
activations, 8-bit weights)
"""
per_channel_quantization = False

pipeline = EthosU55PipelineINT[input_t1](
Expand All @@ -234,7 +238,9 @@ def test_addmm_16a8w_u55_INT(test_data: input_t1):
@common.parametrize("test_data", test_data_suite)
@common.XfailIfNoCorstone320
def test_addmm_16a8w_u85_INT(test_data: input_t1):
"""Test addmm (FC layer) operation with 16A8W quantization on U85 (16-bit activations, 8-bit weights)"""
"""Test addmm (FC layer) operation with 16A8W quantization on U85 (16-bit
activations, 8-bit weights)
"""
per_channel_quantization = False

pipeline = EthosU85PipelineINT[input_t1](
Expand Down
10 changes: 5 additions & 5 deletions backends/arm/test/ops/test_alias_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@


class AliasCopy(torch.nn.Module):
"""
Tests proper handling of alias_copy when used directly.
"""Tests proper handling of alias_copy when used directly.

alias_copy can also appear from PyTorch/ExecuTorch optimizations such as
`x.transpose(0, 0)`. This is optimized to an alias_copy but not before dq/q
operators are added.

alias_copy can also appear from PyTorch/ExecuTorch optimizations
such as `x.transpose(0, 0)`. This is optimized to an alias_copy but
not before dq/q operators are added.
"""

aten_op = "torch.ops.aten.alias_copy.default"
Expand Down
4 changes: 3 additions & 1 deletion backends/arm/test/ops/test_amax.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ def test_amax_tosa_INT_a16w8(test_data: Amax.input_t):
@common.parametrize("test_data", Amax.test_data)
@common.XfailIfNoCorstone320
def test_amax_u85_INT_a16w8(test_data: Amax.input_t):
"""Test amax with 16A8W quantization on U85 (16-bit activations, 8-bit weights)"""
"""Test amax with 16A8W quantization on U85 (16-bit activations, 8-bit
weights)
"""
data, dim, keep_dims = test_data()
module = Amax(dim, keep_dims)
pipeline = EthosU85PipelineINT[Max.input_t](
Expand Down
4 changes: 3 additions & 1 deletion backends/arm/test/ops/test_amin.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,9 @@ def test_amin_tosa_INT_a16w8(test_data: Amin.input_t):
@common.parametrize("test_data", Amin.test_data)
@common.XfailIfNoCorstone320
def test_amin_u85_INT_a16w8(test_data: Min.input_t):
"""Test amin with 16A8W quantization on U85 (16-bit activations, 8-bit weights)"""
"""Test amin with 16A8W quantization on U85 (16-bit activations, 8-bit
weights)
"""
data, dim, keep_dims = test_data()
pipeline = EthosU85PipelineINT[Amin.input_t](
Amin(dim, keep_dims),
Expand Down
15 changes: 11 additions & 4 deletions backends/arm/test/ops/test_avg_pool2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ def forward(self, *args, **kwargs):


class BecomesMeanInToEdge(torch.nn.Module):
"""This averagepool will be converted to mean when lowering to edge. This causes the decompose_meandim pass to not
trigger until the backend pipeline, which requires extra care.
"""This averagepool will be converted to mean when lowering to edge.

This causes the decompose_meandim pass to not trigger until the backend
pipeline, which requires extra care.

"""

def forward(self, x: torch.Tensor):
Expand Down Expand Up @@ -207,7 +210,9 @@ def test_avg_pool2d_u55_INT(test_module):
@common.parametrize("test_module", test_modules)
@common.XfailIfNoCorstone300
def test_avg_pool2d_16a8w_u55_INT(test_module):
"""Test avg_pool2d with 16A8W quantization on U55 (16-bit activations, 8-bit weights)"""
"""Test avg_pool2d with 16A8W quantization on U55 (16-bit activations, 8-bit
weights)
"""
model, input_tensor = test_module()
pipeline = EthosU55PipelineINT[input_t](
model,
Expand Down Expand Up @@ -238,7 +243,9 @@ def test_avg_pool2d_u85_INT(test_module):
@common.parametrize("test_module", test_modules)
@common.XfailIfNoCorstone320
def test_avg_pool2d_16a8w_u85_INT(test_module):
"""Test avg_pool2d with 16A8W quantization on U85 (16-bit activations, 8-bit weights)"""
"""Test avg_pool2d with 16A8W quantization on U85 (16-bit activations, 8-bit
weights)
"""
model, input_tensor = test_module()
pipeline = EthosU85PipelineINT[input_t](
model,
Expand Down
6 changes: 2 additions & 4 deletions backends/arm/test/ops/test_batch_norm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# Copyright 2024-2025 Arm Limited and/or its affiliates.
# 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.
Expand Down Expand Up @@ -266,9 +266,7 @@ def test_native_batch_norm_legit_no_training_vgf_quant_conv(test_data: Tuple):


class BatchNorm2dNoStats(torch.nn.Module):
"""
Decomposes into _native_batch_norm_legit.no_stats
"""
"""Decomposes into _native_batch_norm_legit.no_stats."""

aten_ops = ["torch.ops.aten.batch_norm.default"]

Expand Down
12 changes: 9 additions & 3 deletions backends/arm/test/ops/test_cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ def test_cat_vgf_quant(test_data: Tuple):

@common.parametrize("test_data", Cat.test_parameters)
def test_cat_16a8w_tosa_INT(test_data: Tuple):
"""Test cat operation with 16A8W quantization (16-bit activations, 8-bit weights)"""
"""Test cat operation with 16A8W quantization (16-bit activations, 8-bit
weights)
"""
per_channel_quantization = False

pipeline = TosaPipelineINT[input_t1](
Expand All @@ -219,7 +221,9 @@ def test_cat_16a8w_tosa_INT(test_data: Tuple):
@common.parametrize("test_data", Cat.test_parameters)
@common.XfailIfNoCorstone300
def test_cat_16a8w_u55_INT(test_data: Tuple):
"""Test cat operation with 16A8W quantization on U55 (16-bit activations, 8-bit weights)"""
"""Test cat operation with 16A8W quantization on U55 (16-bit activations,
8-bit weights)
"""
per_channel_quantization = False

pipeline = EthosU55PipelineINT[input_t1](
Expand All @@ -240,7 +244,9 @@ def test_cat_16a8w_u55_INT(test_data: Tuple):
@common.parametrize("test_data", Cat.test_parameters)
@common.XfailIfNoCorstone320
def test_cat_16a8w_u85_INT(test_data: Tuple):
"""Test cat operation with 16A8W quantization on U85 (16-bit activations, 8-bit weights)"""
"""Test cat operation with 16A8W quantization on U85 (16-bit activations,
8-bit weights)
"""
per_channel_quantization = False

pipeline = EthosU85PipelineINT[input_t1](
Expand Down
16 changes: 12 additions & 4 deletions backends/arm/test/ops/test_clamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ def test_clamp_u55_INT(test_data):
@common.parametrize("test_data", test_data_suite)
@common.XfailIfNoCorstone300
def test_clamp_u55_INT_16a8w(test_data):
"""Test clamp operation with 16A8W quantization on U55 (16-bit activations, 8-bit weights)"""
"""Test clamp operation with 16A8W quantization on U55 (16-bit activations,
8-bit weights)
"""
input_tensor, min_val, max_val = test_data()
model = Clamp(min_val, max_val)
pipeline = EthosU55PipelineINT[input_t](
Expand Down Expand Up @@ -208,7 +210,9 @@ def test_clamp_u85_INT(test_data):
@common.parametrize("test_data", test_data_suite)
@common.XfailIfNoCorstone320
def test_clamp_u85_INT_16a8w(test_data):
"""Test clamp operation with 16A8W quantization on U85 (16-bit activations, 8-bit weights)"""
"""Test clamp operation with 16A8W quantization on U85 (16-bit activations,
8-bit weights)
"""
input_tensor, min_val, max_val = test_data()
model = Clamp(min_val, max_val)
pipeline = EthosU85PipelineINT[input_t](
Expand Down Expand Up @@ -453,7 +457,9 @@ def test_clamp_u55_INT_tensor(test_data):
@common.parametrize("test_data", test_data_suite_tensor_INT32)
@common.XfailIfNoCorstone300
def test_clamp_u55_INT_16a8w_tensor(test_data):
"""Test clamp operation with 16A8W quantization on U55 (16-bit activations, 8-bit weights)"""
"""Test clamp operation with 16A8W quantization on U55 (16-bit activations,
8-bit weights)
"""
input_tensor, min_val, max_val = test_data()
model = Clamp(min_val, max_val)
pipeline = EthosU55PipelineINT[input_t](
Expand Down Expand Up @@ -486,7 +492,9 @@ def test_clamp_u85_INT_tensor(test_data):
@common.parametrize("test_data", test_data_suite_tensor_INT32)
@common.XfailIfNoCorstone320
def test_clamp_u85_INT_16a8w_tensor(test_data):
"""Test clamp operation with 16A8W quantization on U85 (16-bit activations, 8-bit weights)"""
"""Test clamp operation with 16A8W quantization on U85 (16-bit activations,
8-bit weights)
"""
input_tensor, min_val, max_val = test_data()
model = Clamp(min_val, max_val)
pipeline = EthosU85PipelineINT[input_t](
Expand Down
4 changes: 3 additions & 1 deletion backends/arm/test/ops/test_cond.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ def _create() -> tuple[torch.nn.Module, input_t2]:
def _make_calibration_samples(
module: torch.nn.Module, example_inputs: tuple
) -> tuple[tuple[torch.Tensor, ...], ...]:
"""Return one example input that triggers the if branch, and one that triggers the else branch."""
"""Return one example input that triggers the if branch, and one that
triggers the else branch.
"""

if isinstance(module, CondTwoArgsOneOutput):
# Predicate is sum(lhs-rhs) > 0
Expand Down
7 changes: 4 additions & 3 deletions backends/arm/test/ops/test_conv1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@


class Conv1d(torch.nn.Module):
"""
Creates one or many chained 1D-convolutions. For multiple convolutions, the
respective parameteres are provided as lists.
"""Creates one or many chained 1D-convolutions.

For multiple convolutions, the respective parameters are provided as lists.

"""

def __init__(
Expand Down
15 changes: 10 additions & 5 deletions backends/arm/test/ops/test_conv2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@


class Conv2d(torch.nn.Module):
"""
Creates one or many chained 2D-convolutions. For multiple convolutions, the
respective parameteres are provided as lists.
"""Creates one or many chained 2D-convolutions.

For multiple convolutions, the respective parameters are provided as lists.

"""

def __init__(
Expand Down Expand Up @@ -674,7 +675,9 @@ def test_convolution_2d_tosa_INT_a16w8(test_data: input_t):
@common.parametrize("test_data", test_data_INT)
@common.XfailIfNoCorstone300
def test_convolution_2d_u55_INT_a16w8(test_data: input_t):
"""Test conv2d with 16A8W quantization on U55 (16-bit activations, 8-bit weights)"""
"""Test conv2d with 16A8W quantization on U55 (16-bit activations, 8-bit
weights)
"""
model, per_channel_quantization = test_data()
pipeline = EthosU55PipelineINT[input_t](
model,
Expand All @@ -691,7 +694,9 @@ def test_convolution_2d_u55_INT_a16w8(test_data: input_t):
@common.parametrize("test_data", test_data_INT)
@common.XfailIfNoCorstone320
def test_convolution_2d_u85_INT_a16w8(test_data: input_t):
"""Test conv2d with 16A8W quantization on U85 (16-bit activations, 8-bit weights)"""
"""Test conv2d with 16A8W quantization on U85 (16-bit activations, 8-bit
weights)
"""
model, per_channel_quantization = test_data()
pipeline = EthosU85PipelineINT[input_t](
model,
Expand Down
16 changes: 10 additions & 6 deletions backends/arm/test/ops/test_conv3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@


class Conv3d(torch.nn.Module):
"""
Creates one or many chained 3D-convolutions. For multiple convolutions, the
respective parameteres are provided as lists.
"""Creates one or many chained 3D-convolutions.

For multiple convolutions, the respective parameters are provided as lists.

"""

def __init__(
Expand Down Expand Up @@ -128,11 +129,12 @@ def forward(self, x):


class Conv3dMultiOp(torch.nn.Module):
"""
Mixed Conv3d/Conv2d pipeline used to verify spatial-rank propagation across ops.
"""Mixed Conv3d/Conv2d pipeline used to verify spatial-rank propagation
across ops.

Topology:
conv3d -> reshape -> conv2d -> reshape/permutation -> conv2d -> reshape -> add(5D)

"""

def __init__(self, dtype=torch.float):
Expand Down Expand Up @@ -578,7 +580,9 @@ def test_convolution_3d_tosa_INT_multi_op():


def test_convolution_3d_tosa_FP_depthwise():
"""Depthwise or Grouped Conv3d should be rejected until grouped support exists."""
"""Depthwise or Grouped Conv3d should be rejected until grouped support
exists.
"""
model = DepthwiseConv3d()
pipeline = TosaPipelineFP[input_t](
model,
Expand Down
3 changes: 1 addition & 2 deletions backends/arm/test/ops/test_conv_combos.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@

from torch.nn.parameter import Parameter


"""
This file contain unit tests where conv are combined with other ops.
This file contains unit tests where conv are combined with other ops.
"""


Expand Down
4 changes: 1 addition & 3 deletions backends/arm/test/ops/test_conv_constant_pad_nd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2025 Arm Limited and/or its affiliates.
# Copyright 2025-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.
Expand Down Expand Up @@ -35,8 +35,6 @@
"2dim_last1dim": (torch.rand(1, 1, 16), (1, 1, 0, 0), 1),
"2dim_last2dim": (torch.rand(1, 1, 16), (1, 0, 1, 1), 2),
}


"""Tests conv + pad."""


Expand Down
Loading
Loading