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
6 changes: 3 additions & 3 deletions backends/arm/operator_support/pool_2d_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def stride_check(strides: tuple[int, int]) -> bool:


def dim_check(shape=torch.Size) -> bool:
check = shape[0] == 1
for dim in shape:
check = True
for dim in shape[1:]:
check &= 1 <= dim <= 65536
return check
Comment on lines -29 to 32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JFYI this function could be written more idiomatically as return all([1 <= dim <= 65536 for dim in shape[1:]])


Expand Down Expand Up @@ -59,7 +59,7 @@ def is_node_tosa_supported(self, node: fx.Node, tosa_spec: TosaSpecification):
if not kernel_check(kernel):
return False

return dim_check(shape) and stride_check(stride)
return dim_check(shape) and shape[0] == 1 and stride_check(stride)


@register_tosa_support_check
Expand Down
20 changes: 18 additions & 2 deletions backends/arm/test/ops/test_max_pool.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# Copyright 2024-2025 Arm Limited and/or its affiliates.
# All rights reserved.
# Copyright 2024-2025 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 @@ -232,8 +232,24 @@ def test_maxpool2d_tosa_u85_BI_mult_batches(
if conftest.is_option_enabled("corstone_fvp"):
tester.run_method_and_compare_outputs(qtol=1, inputs=(test_data,))

@parameterized.expand(test_data_suite_mult_batches)
@pytest.mark.corstone_fvp
@conftest.expectedFailureOnFVP # TODO: MLETORCH-433
def test_maxpool2d_tosa_u55_BI_mult_batches(
self,
test_name: str,
test_data: torch.Tensor,
model_params: int | Tuple[int, int],
):
tester = self._test_maxpool2d_tosa_ethos_BI_pipeline(
self.MaxPool2d(*model_params),
common.get_u55_compile_spec(),
(test_data,),
)
if conftest.is_option_enabled("corstone_fvp"):
tester.run_method_and_compare_outputs(qtol=1, inputs=(test_data,))

reject_data_suite = [
(MaxPool2d(1, 1, 0), torch.rand(2, 5, 5, 5)),
(MaxPool2d(1, 4, 0), torch.rand(1, 10, 10, 10)),
(MaxPool2d((1, 257), 1, 0), torch.rand(1, 16, 5, 300)),
(MaxPool2d((800, 90), 1, 0), torch.rand(1, 16, 850, 100)),
Expand Down
Loading