9
9
10
10
from typing import Tuple
11
11
12
+ import pytest
13
+
12
14
import torch
13
- from executorch .backends .arm .test import common
15
+ from executorch .backends .arm .test import common , conftest
14
16
from executorch .backends .arm .test .tester .arm_tester import ArmTester
15
17
from executorch .exir .backend .compile_spec_schema import CompileSpec
16
18
from parameterized import parameterized
@@ -63,7 +65,7 @@ def forward(self, x, y):
63
65
def _test_sigmoid_tosa_MI_pipeline (
64
66
self , module : torch .nn .Module , test_data : Tuple [torch .tensor ]
65
67
):
66
- (
68
+ tester = (
67
69
ArmTester (
68
70
module ,
69
71
example_inputs = test_data ,
@@ -77,11 +79,13 @@ def _test_sigmoid_tosa_MI_pipeline(
77
79
.check_not (["executorch_exir_dialects_edge__ops_aten_sigmoid_default" ])
78
80
.check_count ({"torch.ops.higher_order.executorch_call_delegate" : 1 })
79
81
.to_executorch ()
80
- .run_method_and_compare_outputs (inputs = test_data )
81
82
)
82
83
84
+ if conftest .is_option_enabled ("tosa_ref_model" ):
85
+ tester .run_method_and_compare_outputs (inputs = test_data )
86
+
83
87
def _test_sigmoid_tosa_BI_pipeline (self , module : torch .nn .Module , test_data : Tuple ):
84
- (
88
+ tester = (
85
89
ArmTester (
86
90
module ,
87
91
example_inputs = test_data ,
@@ -96,9 +100,11 @@ def _test_sigmoid_tosa_BI_pipeline(self, module: torch.nn.Module, test_data: Tup
96
100
.check_not (["executorch_exir_dialects_edge__ops_aten_sigmoid_default" ])
97
101
.check_count ({"torch.ops.higher_order.executorch_call_delegate" : 1 })
98
102
.to_executorch ()
99
- .run_method_and_compare_outputs (inputs = test_data )
100
103
)
101
104
105
+ if conftest .is_option_enabled ("tosa_ref_model" ):
106
+ tester .run_method_and_compare_outputs (inputs = test_data )
107
+
102
108
def _test_sigmoid_tosa_ethos_BI_pipeline (
103
109
self ,
104
110
compile_spec : list [CompileSpec ],
@@ -137,6 +143,7 @@ def _test_sigmoid_tosa_u85_BI_pipeline(
137
143
)
138
144
139
145
@parameterized .expand (test_data_suite )
146
+ @pytest .mark .tosa_ref_model
140
147
def test_sigmoid_tosa_MI (
141
148
self ,
142
149
test_name : str ,
@@ -145,26 +152,33 @@ def test_sigmoid_tosa_MI(
145
152
self ._test_sigmoid_tosa_MI_pipeline (self .Sigmoid (), (test_data ,))
146
153
147
154
@parameterized .expand (test_data_suite )
155
+ @pytest .mark .tosa_ref_model
148
156
def test_sigmoid_tosa_BI (self , test_name : str , test_data : torch .Tensor ):
149
157
self ._test_sigmoid_tosa_BI_pipeline (self .Sigmoid (), (test_data ,))
150
158
159
+ @pytest .mark .tosa_ref_model
151
160
def test_add_sigmoid_tosa_MI (self ):
152
161
self ._test_sigmoid_tosa_MI_pipeline (self .AddSigmoid (), (test_data_suite [0 ][1 ],))
153
162
163
+ @pytest .mark .tosa_ref_model
154
164
def test_add_sigmoid_tosa_BI (self ):
155
165
self ._test_sigmoid_tosa_BI_pipeline (self .AddSigmoid (), (test_data_suite [5 ][1 ],))
156
166
167
+ @pytest .mark .tosa_ref_model
157
168
def test_sigmoid_add_tosa_MI (self ):
158
169
self ._test_sigmoid_tosa_MI_pipeline (self .SigmoidAdd (), (test_data_suite [0 ][1 ],))
159
170
171
+ @pytest .mark .tosa_ref_model
160
172
def test_sigmoid_add_tosa_BI (self ):
161
173
self ._test_sigmoid_tosa_BI_pipeline (self .SigmoidAdd (), (test_data_suite [0 ][1 ],))
162
174
175
+ @pytest .mark .tosa_ref_model
163
176
def test_sigmoid_add_sigmoid_tosa_MI (self ):
164
177
self ._test_sigmoid_tosa_MI_pipeline (
165
178
self .SigmoidAddSigmoid (), (test_data_suite [4 ][1 ], test_data_suite [3 ][1 ])
166
179
)
167
180
181
+ @pytest .mark .tosa_ref_model
168
182
def test_sigmoid_add_sigmoid_tosa_BI (self ):
169
183
self ._test_sigmoid_tosa_BI_pipeline (
170
184
self .SigmoidAddSigmoid (), (test_data_suite [4 ][1 ], test_data_suite [3 ][1 ])
0 commit comments