Skip to content

Commit 535dd92

Browse files
Arm backend: Restore expected failures on torch_functions (pytorch#23408)
Restore the expected failure after the pytorch#23126 commit. Change-Id: I118c092f51dd0de231426831ab1d5683117ae4c4 cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani Signed-off-by: George Gekov <george.gekov@arm.com> Co-authored-by: George Gekov <george.gekov@arm.com>
1 parent c55c31b commit 535dd92

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

‎backends/arm/test/models/test_torch_functions.py‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@
2121
from typing import Callable
2222

2323
import torch
24+
2425
from executorch.backends.arm.test.common import parametrize
2526
from executorch.backends.arm.test.tester.test_pipeline import (
2627
TosaPipelineFP,
2728
TosaPipelineINT,
2829
)
30+
from torch.utils import _pytree
2931

3032

3133
def module_add_factory(function: Callable) -> torch.nn.Module:
@@ -93,8 +95,22 @@ def forward(self, *args):
9395

9496
test_parameters = {test[0]: test[1:] for test in module_tests}
9597

98+
# For torch versions < 1.15.0, xfail these tests due to missing functionality.
99+
return_type_serialization_xfails: dict[str, tuple[str, type[Exception]]] = {}
100+
for name, result in (
101+
("topk", torch.topk(torch.arange(2), 1)),
102+
("sort", torch.sort(torch.arange(2))),
103+
):
104+
try:
105+
_pytree.treespec_dumps(_pytree.tree_structure(result))
106+
except NotImplementedError:
107+
return_type_serialization_xfails[name] = (
108+
f"torch.return_types.{name} cannot be serialized",
109+
NotImplementedError,
110+
)
111+
96112

97-
@parametrize("test_data", test_parameters)
113+
@parametrize("test_data", test_parameters, xfails=return_type_serialization_xfails)
98114
def test_torch_functions_tosa_FP(test_data):
99115
module, inputs = test_data
100116
pipeline = TosaPipelineFP[input_t](
@@ -112,7 +128,7 @@ def test_torch_functions_tosa_FP(test_data):
112128
raise e
113129

114130

115-
@parametrize("test_data", test_parameters)
131+
@parametrize("test_data", test_parameters, xfails=return_type_serialization_xfails)
116132
def test_torch_functions_tosa_INT(test_data):
117133
module, inputs = test_data
118134
pipeline = TosaPipelineINT[input_t](

0 commit comments

Comments
 (0)