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,16 +100,18 @@ 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 ],
105
111
module : torch .nn .Module ,
106
112
test_data : Tuple [torch .tensor ],
107
113
):
108
- (
114
+ tester = (
109
115
ArmTester (
110
116
module ,
111
117
example_inputs = test_data ,
@@ -122,6 +128,9 @@ def _test_sigmoid_tosa_ethos_BI_pipeline(
122
128
.to_executorch ()
123
129
)
124
130
131
+ if conftest .is_option_enabled ("tosa_ref_model" ):
132
+ tester .run_method_and_compare_outputs (inputs = test_data )
133
+
125
134
def _test_sigmoid_tosa_u55_BI_pipeline (
126
135
self , module : torch .nn .Module , test_data : Tuple [torch .tensor ]
127
136
):
@@ -137,6 +146,7 @@ def _test_sigmoid_tosa_u85_BI_pipeline(
137
146
)
138
147
139
148
@parameterized .expand (test_data_suite )
149
+ @pytest .mark .tosa_ref_model
140
150
def test_sigmoid_tosa_MI (
141
151
self ,
142
152
test_name : str ,
@@ -145,26 +155,33 @@ def test_sigmoid_tosa_MI(
145
155
self ._test_sigmoid_tosa_MI_pipeline (self .Sigmoid (), (test_data ,))
146
156
147
157
@parameterized .expand (test_data_suite )
158
+ @pytest .mark .tosa_ref_model
148
159
def test_sigmoid_tosa_BI (self , test_name : str , test_data : torch .Tensor ):
149
160
self ._test_sigmoid_tosa_BI_pipeline (self .Sigmoid (), (test_data ,))
150
161
162
+ @pytest .mark .tosa_ref_model
151
163
def test_add_sigmoid_tosa_MI (self ):
152
164
self ._test_sigmoid_tosa_MI_pipeline (self .AddSigmoid (), (test_data_suite [0 ][1 ],))
153
165
166
+ @pytest .mark .tosa_ref_model
154
167
def test_add_sigmoid_tosa_BI (self ):
155
168
self ._test_sigmoid_tosa_BI_pipeline (self .AddSigmoid (), (test_data_suite [5 ][1 ],))
156
169
170
+ @pytest .mark .tosa_ref_model
157
171
def test_sigmoid_add_tosa_MI (self ):
158
172
self ._test_sigmoid_tosa_MI_pipeline (self .SigmoidAdd (), (test_data_suite [0 ][1 ],))
159
173
174
+ @pytest .mark .tosa_ref_model
160
175
def test_sigmoid_add_tosa_BI (self ):
161
176
self ._test_sigmoid_tosa_BI_pipeline (self .SigmoidAdd (), (test_data_suite [0 ][1 ],))
162
177
178
+ @pytest .mark .tosa_ref_model
163
179
def test_sigmoid_add_sigmoid_tosa_MI (self ):
164
180
self ._test_sigmoid_tosa_MI_pipeline (
165
181
self .SigmoidAddSigmoid (), (test_data_suite [4 ][1 ], test_data_suite [3 ][1 ])
166
182
)
167
183
184
+ @pytest .mark .tosa_ref_model
168
185
def test_sigmoid_add_sigmoid_tosa_BI (self ):
169
186
self ._test_sigmoid_tosa_BI_pipeline (
170
187
self .SigmoidAddSigmoid (), (test_data_suite [4 ][1 ], test_data_suite [3 ][1 ])
0 commit comments