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,9 +79,11 @@ 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
(
85
89
ArmTester (
@@ -96,7 +100,6 @@ 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
102
105
def _test_sigmoid_tosa_ethos_BI_pipeline (
@@ -137,6 +140,7 @@ def _test_sigmoid_tosa_u85_BI_pipeline(
137
140
)
138
141
139
142
@parameterized .expand (test_data_suite )
143
+ @pytest .mark .tosa_ref_model
140
144
def test_sigmoid_tosa_MI (
141
145
self ,
142
146
test_name : str ,
@@ -145,26 +149,33 @@ def test_sigmoid_tosa_MI(
145
149
self ._test_sigmoid_tosa_MI_pipeline (self .Sigmoid (), (test_data ,))
146
150
147
151
@parameterized .expand (test_data_suite )
152
+ @pytest .mark .tosa_ref_model
148
153
def test_sigmoid_tosa_BI (self , test_name : str , test_data : torch .Tensor ):
149
154
self ._test_sigmoid_tosa_BI_pipeline (self .Sigmoid (), (test_data ,))
150
155
156
+ @pytest .mark .tosa_ref_model
151
157
def test_add_sigmoid_tosa_MI (self ):
152
158
self ._test_sigmoid_tosa_MI_pipeline (self .AddSigmoid (), (test_data_suite [0 ][1 ],))
153
159
160
+ @pytest .mark .tosa_ref_model
154
161
def test_add_sigmoid_tosa_BI (self ):
155
162
self ._test_sigmoid_tosa_BI_pipeline (self .AddSigmoid (), (test_data_suite [5 ][1 ],))
156
163
164
+ @pytest .mark .tosa_ref_model
157
165
def test_sigmoid_add_tosa_MI (self ):
158
166
self ._test_sigmoid_tosa_MI_pipeline (self .SigmoidAdd (), (test_data_suite [0 ][1 ],))
159
167
168
+ @pytest .mark .tosa_ref_model
160
169
def test_sigmoid_add_tosa_BI (self ):
161
170
self ._test_sigmoid_tosa_BI_pipeline (self .SigmoidAdd (), (test_data_suite [0 ][1 ],))
162
171
172
+ @pytest .mark .tosa_ref_model
163
173
def test_sigmoid_add_sigmoid_tosa_MI (self ):
164
174
self ._test_sigmoid_tosa_MI_pipeline (
165
175
self .SigmoidAddSigmoid (), (test_data_suite [4 ][1 ], test_data_suite [3 ][1 ])
166
176
)
167
177
178
+ @pytest .mark .tosa_ref_model
168
179
def test_sigmoid_add_sigmoid_tosa_BI (self ):
169
180
self ._test_sigmoid_tosa_BI_pipeline (
170
181
self .SigmoidAddSigmoid (), (test_data_suite [4 ][1 ], test_data_suite [3 ][1 ])
0 commit comments