5
5
# This source code is licensed under the BSD-style license found in the
6
6
# LICENSE file in the root directory of this source tree.
7
7
8
+ import pytest
8
9
import unittest
9
10
10
11
from typing import Tuple
11
12
12
13
import torch
13
- from executorch .backends .arm .test import common
14
+ from executorch .backends .arm .test import common , conftest
14
15
from executorch .backends .arm .test .tester .arm_tester import ArmTester
15
16
from executorch .exir .backend .compile_spec_schema import CompileSpec
16
17
from parameterized import parameterized
@@ -63,7 +64,7 @@ def forward(self, x, y):
63
64
def _test_sigmoid_tosa_MI_pipeline (
64
65
self , module : torch .nn .Module , test_data : Tuple [torch .tensor ]
65
66
):
66
- (
67
+ tester = (
67
68
ArmTester (
68
69
module ,
69
70
example_inputs = test_data ,
@@ -77,11 +78,13 @@ def _test_sigmoid_tosa_MI_pipeline(
77
78
.check_not (["executorch_exir_dialects_edge__ops_aten_sigmoid_default" ])
78
79
.check_count ({"torch.ops.higher_order.executorch_call_delegate" : 1 })
79
80
.to_executorch ()
80
- .run_method_and_compare_outputs (inputs = test_data )
81
81
)
82
82
83
+ if conftest .is_option_enabled ("tosa_ref_model" ):
84
+ tester .run_method_and_compare_outputs (inputs = test_data )
85
+
83
86
def _test_sigmoid_tosa_BI_pipeline (self , module : torch .nn .Module , test_data : Tuple ):
84
- (
87
+ tester = (
85
88
ArmTester (
86
89
module ,
87
90
example_inputs = test_data ,
@@ -96,16 +99,18 @@ def _test_sigmoid_tosa_BI_pipeline(self, module: torch.nn.Module, test_data: Tup
96
99
.check_not (["executorch_exir_dialects_edge__ops_aten_sigmoid_default" ])
97
100
.check_count ({"torch.ops.higher_order.executorch_call_delegate" : 1 })
98
101
.to_executorch ()
99
- .run_method_and_compare_outputs (inputs = test_data )
100
102
)
101
103
104
+ if conftest .is_option_enabled ("tosa_ref_model" ):
105
+ tester .run_method_and_compare_outputs (inputs = test_data )
106
+
102
107
def _test_sigmoid_tosa_ethos_BI_pipeline (
103
108
self ,
104
109
compile_spec : list [CompileSpec ],
105
110
module : torch .nn .Module ,
106
111
test_data : Tuple [torch .tensor ],
107
112
):
108
- (
113
+ tester = (
109
114
ArmTester (
110
115
module ,
111
116
example_inputs = test_data ,
@@ -122,6 +127,9 @@ def _test_sigmoid_tosa_ethos_BI_pipeline(
122
127
.to_executorch ()
123
128
)
124
129
130
+ if conftest .is_option_enabled ("tosa_ref_model" ):
131
+ tester .run_method_and_compare_outputs (inputs = test_data )
132
+
125
133
def _test_sigmoid_tosa_u55_BI_pipeline (
126
134
self , module : torch .nn .Module , test_data : Tuple [torch .tensor ]
127
135
):
@@ -137,6 +145,7 @@ def _test_sigmoid_tosa_u85_BI_pipeline(
137
145
)
138
146
139
147
@parameterized .expand (test_data_suite )
148
+ @pytest .mark .tosa_ref_model
140
149
def test_sigmoid_tosa_MI (
141
150
self ,
142
151
test_name : str ,
@@ -145,35 +154,44 @@ def test_sigmoid_tosa_MI(
145
154
self ._test_sigmoid_tosa_MI_pipeline (self .Sigmoid (), (test_data ,))
146
155
147
156
@parameterized .expand (test_data_suite )
157
+ @pytest .mark .tosa_ref_model
148
158
def test_sigmoid_tosa_BI (self , test_name : str , test_data : torch .Tensor ):
149
159
self ._test_sigmoid_tosa_BI_pipeline (self .Sigmoid (), (test_data ,))
150
160
161
+ @pytest .mark .tosa_ref_model
151
162
def test_add_sigmoid_tosa_MI (self ):
152
163
self ._test_sigmoid_tosa_MI_pipeline (self .AddSigmoid (), (test_data_suite [0 ][1 ],))
153
164
165
+ @pytest .mark .tosa_ref_model
154
166
def test_add_sigmoid_tosa_BI (self ):
155
167
self ._test_sigmoid_tosa_BI_pipeline (self .AddSigmoid (), (test_data_suite [5 ][1 ],))
156
168
169
+ @pytest .mark .tosa_ref_model
157
170
def test_sigmoid_add_tosa_MI (self ):
158
171
self ._test_sigmoid_tosa_MI_pipeline (self .SigmoidAdd (), (test_data_suite [0 ][1 ],))
159
172
173
+ @pytest .mark .tosa_ref_model
160
174
def test_sigmoid_add_tosa_BI (self ):
161
175
self ._test_sigmoid_tosa_BI_pipeline (self .SigmoidAdd (), (test_data_suite [0 ][1 ],))
162
176
177
+ @pytest .mark .tosa_ref_model
163
178
def test_sigmoid_add_sigmoid_tosa_MI (self ):
164
179
self ._test_sigmoid_tosa_MI_pipeline (
165
180
self .SigmoidAddSigmoid (), (test_data_suite [4 ][1 ], test_data_suite [3 ][1 ])
166
181
)
167
182
183
+ @pytest .mark .tosa_ref_model
168
184
def test_sigmoid_add_sigmoid_tosa_BI (self ):
169
185
self ._test_sigmoid_tosa_BI_pipeline (
170
186
self .SigmoidAddSigmoid (), (test_data_suite [4 ][1 ], test_data_suite [3 ][1 ])
171
187
)
172
188
173
189
@parameterized .expand (test_data_suite )
190
+ @pytest .mark .tosa_ref_model
174
191
def test_sigmoid_tosa_u55_BI (self , test_name : str , test_data : torch .Tensor ):
175
192
self ._test_sigmoid_tosa_u55_BI_pipeline (self .Sigmoid (), (test_data ,))
176
193
177
194
@parameterized .expand (test_data_suite )
195
+ @pytest .mark .tosa_ref_model
178
196
def test_sigmoid_tosa_u85_BI (self , test_name : str , test_data : torch .Tensor ):
179
197
self ._test_sigmoid_tosa_u85_BI_pipeline (self .Sigmoid (), (test_data ,))
0 commit comments