• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2017-2023 Arm Limited.
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #include "arm_compute/core/Types.h"
25 #include "arm_compute/runtime/NEON/functions/NEDepthConvertLayer.h"
26 #include "arm_compute/runtime/Tensor.h"
27 #include "arm_compute/runtime/TensorAllocator.h"
28 #include "tests/NEON/Accessor.h"
29 #include "tests/PaddingCalculator.h"
30 #include "tests/datasets/ConvertPolicyDataset.h"
31 #include "tests/datasets/ShapeDatasets.h"
32 #include "tests/framework/Asserts.h"
33 #include "tests/framework/Macros.h"
34 #include "tests/framework/datasets/Datasets.h"
35 #include "tests/validation/Validation.h"
36 #include "tests/validation/fixtures/DepthConvertLayerFixture.h"
37 
38 namespace arm_compute
39 {
40 namespace test
41 {
42 namespace validation
43 {
44 namespace
45 {
46 /** Input data sets **/
47 const auto DepthConvertLayerQASYMM8toF16Dataset = combine(framework::dataset::make("DataType", DataType::QASYMM8), framework::dataset::make("DataType", DataType::F16));
48 const auto DepthConvertLayerQASYMM8toF32Dataset = combine(framework::dataset::make("DataType", DataType::QASYMM8), framework::dataset::make("DataType", DataType::F32));
49 const auto DepthConvertLayerQASYMM8toS32Dataset = combine(framework::dataset::make("DataType", DataType::QASYMM8), framework::dataset::make("DataType", DataType::S32));
50 const auto DepthConvertLayerU8toU16Dataset      = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::U16));
51 const auto DepthConvertLayerU8toS16Dataset      = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::S16));
52 const auto DepthConvertLayerU8toS32Dataset      = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::S32));
53 const auto DepthConvertLayerU8toF16Dataset      = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::F16));
54 const auto DepthConvertLayerU8toF32Dataset      = combine(framework::dataset::make("DataType", DataType::U8), framework::dataset::make("DataType", DataType::F32));
55 const auto DepthConvertLayerU16toU8Dataset      = combine(framework::dataset::make("DataType", DataType::U16), framework::dataset::make("DataType", DataType::U8));
56 const auto DepthConvertLayerU16toU32Dataset     = combine(framework::dataset::make("DataType", DataType::U16), framework::dataset::make("DataType", DataType::U32));
57 const auto DepthConvertLayerS16toU8Dataset      = combine(framework::dataset::make("DataType", DataType::S16), framework::dataset::make("DataType", DataType::U8));
58 const auto DepthConvertLayerS16toS32Dataset     = combine(framework::dataset::make("DataType", DataType::S16), framework::dataset::make("DataType", DataType::S32));
59 const auto DepthConvertLayerF16toU8Dataset      = combine(framework::dataset::make("DataType", DataType::F16), framework::dataset::make("DataType", DataType::U8));
60 const auto DepthConvertLayerF16toF32Dataset     = combine(framework::dataset::make("DataType", DataType::F16), framework::dataset::make("DataType", DataType::F32));
61 const auto DepthConvertLayerF16toS32Dataset     = combine(framework::dataset::make("DataType", DataType::F16), framework::dataset::make("DataType", DataType::S32));
62 const auto DepthConvertLayerF32toF16Dataset     = combine(framework::dataset::make("DataType", DataType::F32), framework::dataset::make("DataType", DataType::F16));
63 const auto DepthConvertLayerF32toS32Dataset     = combine(framework::dataset::make("DataType", DataType::F32), framework::dataset::make("DataType", DataType::S32));
64 const auto DepthConvertLayerF32toU8Dataset      = combine(framework::dataset::make("DataType", DataType::F32), framework::dataset::make("DataType", DataType::U8));
65 
66 const auto DepthConvertLayerS32toF32Dataset     = combine(framework::dataset::make("DataType", DataType::S32), framework::dataset::make("DataType", DataType::F32));
67 const auto DepthConvertLayerS32toQASYMM8Dataset = combine(framework::dataset::make("DataType", DataType::S32), framework::dataset::make("DataType", DataType::QASYMM8));
68 const auto DepthConvertLayerS32toF16Dataset     = combine(framework::dataset::make("DataType", DataType::S32), framework::dataset::make("DataType", DataType::F16));
69 const auto DepthConvertLayerS32toU8Dataset      = combine(framework::dataset::make("DataType", DataType::S32), framework::dataset::make("DataType", DataType::U8));
70 
71 const auto DepthConvertLayerF16toQASYMM8Dataset = combine(framework::dataset::make("DataType", DataType::F16), framework::dataset::make("DataType", DataType::QASYMM8));
72 const auto DepthConvertLayerF32toQASYMM8Dataset = combine(framework::dataset::make("DataType", DataType::F32), framework::dataset::make("DataType", DataType::QASYMM8));
73 const auto DepthConvertLayerZeroShiftDataset    = framework::dataset::make("Shift", 0);
74 
75 constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1);
76 constexpr AbsoluteTolerance<int32_t> tolerance_one_int32(1);
77 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
78 constexpr AbsoluteTolerance<uint8_t> tolerance_one_uint8(1);
79 #endif /*  __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
80 } // namespace
81 
82 TEST_SUITE(NEON)
TEST_SUITE(DepthConvertLayer)83 TEST_SUITE(DepthConvertLayer)
84 
85 // *INDENT-OFF*
86 // clang-format off
87 DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
88                framework::dataset::make("InputInfo", { TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U16),  // Invalid data type combination
89                                                        TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::S16),  // Invalid data type combination
90                                                        TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),  // Mismatching shapes
91                                                        TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),  // Invalid shift
92                                                        TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),  // Valid
93                                                      }),
94                framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
95                                                        TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32),
96                                                        TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::U8),
97                                                        TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8),
98                                                      })),
99                framework::dataset::make("Policy",{ ConvertPolicy::WRAP,
100                                                    ConvertPolicy::WRAP,
101                                                    ConvertPolicy::WRAP,
102                                                    ConvertPolicy::WRAP,
103                                                    ConvertPolicy::WRAP,
104                                                    ConvertPolicy::WRAP,
105                                                    ConvertPolicy::WRAP,
106                                                      })),
107                framework::dataset::make("Shift",{ 0, 0, 0, 1, 1, 1, 8, 1,
108                                                      })),
109                framework::dataset::make("Expected", { false, false, false, false, true})),
110                input_info, output_info, policy, shift, expected)
111 {
112     ARM_COMPUTE_EXPECT(bool(NEDepthConvertLayer::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), policy, shift)) == expected, framework::LogLevel::ERRORS);
113 }
114 // clang-format on
115 // *INDENT-ON*
116 
117 template <typename T>
118 using NEDepthConvertLayerToU16Fixture = DepthConvertLayerValidationFixture<Tensor, Accessor, NEDepthConvertLayer, T, uint16_t>;
119 template <typename T>
120 using NEDepthConvertLayerToS16Fixture = DepthConvertLayerValidationFixture<Tensor, Accessor, NEDepthConvertLayer, T, int16_t>;
121 template <typename T>
122 using NEDepthConvertLayerToS32Fixture = DepthConvertLayerValidationFixture<Tensor, Accessor, NEDepthConvertLayer, T, int32_t>;
123 template <typename T>
124 using NEDepthConvertLayerToU8Fixture = DepthConvertLayerValidationFixture<Tensor, Accessor, NEDepthConvertLayer, T, uint8_t>;
125 template <typename T>
126 using NEDepthConvertLayerToU32Fixture = DepthConvertLayerValidationFixture<Tensor, Accessor, NEDepthConvertLayer, T, uint32_t>;
127 template <typename T>
128 using NEDepthConvertLayerToF16Fixture = DepthConvertLayerValidationFixture<Tensor, Accessor, NEDepthConvertLayer, T, half>;
129 template <typename T>
130 using NEDepthConvertLayerToF32Fixture = DepthConvertLayerValidationFixture<Tensor, Accessor, NEDepthConvertLayer, T, float>;
131 template <typename T>
132 using NEDepthConvertLayerToQASYMM8Fixture = DepthConvertLayerValidationQuantizedFixture<Tensor, Accessor, NEDepthConvertLayer, T, uint8_t>;
133 template <typename T>
134 using NEDepthConvertLayerQuantizedToF16Fixture = DepthConvertLayerValidationQuantizedFixture<Tensor, Accessor, NEDepthConvertLayer, T, half>;
135 template <typename T>
136 using NEDepthConvertLayerQuantizedToF32Fixture = DepthConvertLayerValidationQuantizedFixture<Tensor, Accessor, NEDepthConvertLayer, T, float>;
137 template <typename T>
138 using NEDepthConvertLayerQuantizedToS32Fixture = DepthConvertLayerValidationQuantizedFixture<Tensor, Accessor, NEDepthConvertLayer, T, int32_t>;
139 
140 TEST_SUITE(QASYMM8_to_F32)
141 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerQuantizedToF32Fixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallShapes(),
142                        DepthConvertLayerQASYMM8toF32Dataset),
143                        framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
144                        DepthConvertLayerZeroShiftDataset),
145                        framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })))
146 {
147     // Validate output
148     validate(Accessor(_target), _reference);
149 }
150 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerQuantizedToF32Fixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeShapes(),
151                        DepthConvertLayerQASYMM8toF32Dataset),
152                        framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
153                        DepthConvertLayerZeroShiftDataset),
154                        framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })))
155 {
156     // Validate output
157     validate(Accessor(_target), _reference);
158 }
159 TEST_SUITE_END() // QASYMM8_to_F32
160 
TEST_SUITE(QASYMM8_to_S32)161 TEST_SUITE(QASYMM8_to_S32)
162 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerQuantizedToS32Fixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallShapes(),
163                        DepthConvertLayerQASYMM8toS32Dataset),
164                        framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
165                        DepthConvertLayerZeroShiftDataset),
166                        framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })))
167 {
168     // Validate output
169     validate(Accessor(_target), _reference);
170 }
171 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerQuantizedToS32Fixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeShapes(),
172                        DepthConvertLayerQASYMM8toS32Dataset),
173                        framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
174                        DepthConvertLayerZeroShiftDataset),
175                        framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })))
176 {
177     // Validate output
178     validate(Accessor(_target), _reference);
179 }
180 TEST_SUITE_END() // QASYMM8_to_S32
181 
TEST_SUITE(U8_to_U16)182 TEST_SUITE(U8_to_U16)
183 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToU16Fixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerU8toU16Dataset),
184                                                                                                                       framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
185                                                                                                                       DepthConvertLayerZeroShiftDataset))
186 {
187     // Validate output
188     validate(Accessor(_target), _reference);
189 }
190 
191 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToU16Fixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerU8toU16Dataset),
192                                                                                                                     framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
193                                                                                                                     DepthConvertLayerZeroShiftDataset))
194 {
195     // Validate output
196     validate(Accessor(_target), _reference);
197 }
198 TEST_SUITE_END() // U8_to_U16
199 
TEST_SUITE(U8_to_S16)200 TEST_SUITE(U8_to_S16)
201 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToS16Fixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerU8toS16Dataset),
202                                                                                                                       framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
203                                                                                                                       DepthConvertLayerZeroShiftDataset))
204 {
205     // Validate output
206     validate(Accessor(_target), _reference);
207 }
208 
209 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToS16Fixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerU8toS16Dataset),
210                                                                                                                     framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
211                                                                                                                     DepthConvertLayerZeroShiftDataset))
212 {
213     // Validate output
214     validate(Accessor(_target), _reference);
215 }
216 TEST_SUITE_END() // U8_to_S16
TEST_SUITE(U8_to_S32)217 TEST_SUITE(U8_to_S32)
218 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToS32Fixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerU8toS32Dataset),
219                                                                                                                       framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
220                                                                                                                       DepthConvertLayerZeroShiftDataset))
221 {
222     // Validate output
223     validate(Accessor(_target), _reference);
224 }
225 
226 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToS32Fixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerU8toS32Dataset),
227                                                                                                                     framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
228                                                                                                                     DepthConvertLayerZeroShiftDataset))
229 {
230     // Validate output
231     validate(Accessor(_target), _reference);
232 }
233 TEST_SUITE_END() // U8_to_S32
234 
TEST_SUITE(U8_to_F32)235 TEST_SUITE(U8_to_F32)
236 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToF32Fixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerU8toF32Dataset),
237                                                                                                                       framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
238                                                                                                                       DepthConvertLayerZeroShiftDataset))
239 {
240     // Validate output
241     validate(Accessor(_target), _reference);
242 }
243 
244 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToF32Fixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerU8toF32Dataset),
245                                                                                                                     framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
246                                                                                                                     DepthConvertLayerZeroShiftDataset))
247 {
248     // Validate output
249     validate(Accessor(_target), _reference);
250 }
251 TEST_SUITE_END() // U8_to_F32
252 
253 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
TEST_SUITE(U8_to_F16)254 TEST_SUITE(U8_to_F16)
255 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToF16Fixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerU8toF16Dataset),
256                                                                                                                       framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
257                                                                                                                       DepthConvertLayerZeroShiftDataset))
258 {
259     // Validate output
260     validate(Accessor(_target), _reference);
261 }
262 
263 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToF16Fixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerU8toF16Dataset),
264                                                                                                                     framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
265                                                                                                                     DepthConvertLayerZeroShiftDataset))
266 {
267     // Validate output
268     validate(Accessor(_target), _reference);
269 }
270 TEST_SUITE_END() // U8_to_F36
271 #endif           // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
272 
TEST_SUITE(U16_to_U8)273 TEST_SUITE(U16_to_U8)
274 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToU8Fixture<uint16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerU16toU8Dataset),
275                                                                                                                       framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
276                                                                                                                       DepthConvertLayerZeroShiftDataset))
277 {
278     // Validate output
279     validate(Accessor(_target), _reference);
280 }
281 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToU8Fixture<uint16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerU16toU8Dataset),
282                                                                                                                     framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
283                                                                                                                     DepthConvertLayerZeroShiftDataset))
284 {
285     // Validate output
286     validate(Accessor(_target), _reference);
287 }
288 TEST_SUITE_END() // U16_to_U8
289 
TEST_SUITE(U16_to_U32)290 TEST_SUITE(U16_to_U32)
291 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToU32Fixture<uint16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerU16toU32Dataset),
292                                                                                                                        framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
293                                                                                                                        DepthConvertLayerZeroShiftDataset))
294 {
295     // Validate output
296     validate(Accessor(_target), _reference);
297 }
298 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToU32Fixture<uint16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerU16toU32Dataset),
299                                                                                                                      framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
300                                                                                                                      DepthConvertLayerZeroShiftDataset))
301 {
302     // Validate output
303     validate(Accessor(_target), _reference);
304 }
305 TEST_SUITE_END() // U16_to_U32
306 
TEST_SUITE(S16_to_U8)307 TEST_SUITE(S16_to_U8)
308 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToU8Fixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerS16toU8Dataset),
309                                                                                                                      framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
310                                                                                                                      DepthConvertLayerZeroShiftDataset))
311 {
312     // Validate output
313     validate(Accessor(_target), _reference);
314 }
315 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToU8Fixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerS16toU8Dataset),
316                                                                                                                    framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
317                                                                                                                    DepthConvertLayerZeroShiftDataset))
318 {
319     // Validate output
320     validate(Accessor(_target), _reference);
321 }
322 TEST_SUITE_END() // S16_to_U8
323 
TEST_SUITE(S16_to_S32)324 TEST_SUITE(S16_to_S32)
325 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToS32Fixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerS16toS32Dataset),
326                                                                                                                       framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
327                                                                                                                       DepthConvertLayerZeroShiftDataset))
328 {
329     // Validate output
330     validate(Accessor(_target), _reference);
331 }
332 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToS32Fixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerS16toS32Dataset),
333                                                                                                                     framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
334                                                                                                                     DepthConvertLayerZeroShiftDataset))
335 {
336     // Validate output
337     validate(Accessor(_target), _reference);
338 }
339 TEST_SUITE_END() // S16_to_S32
340 
341 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
TEST_SUITE(F16_to_QASYMM8)342 TEST_SUITE(F16_to_QASYMM8)
343 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToQASYMM8Fixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallShapes(),
344                                                                                                                        DepthConvertLayerF16toQASYMM8Dataset),
345                                                                                                                        framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
346                                                                                                                        DepthConvertLayerZeroShiftDataset),
347                                                                                                                        framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })))
348 {
349     // Validate output
350     validate(Accessor(_target), _reference, tolerance_qasymm8);
351 }
352 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToQASYMM8Fixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeShapes(),
353                                                                                                                      DepthConvertLayerF16toQASYMM8Dataset),
354                                                                                                                      framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
355                                                                                                                      DepthConvertLayerZeroShiftDataset),
356                                                                                                                      framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })))
357 {
358     // Validate output
359     validate(Accessor(_target), _reference, tolerance_qasymm8);
360 }
361 TEST_SUITE_END() // F16_to_QASYMM8
362 
TEST_SUITE(F16_to_U8)363 TEST_SUITE(F16_to_U8)
364 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToU8Fixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerF16toU8Dataset),
365                                                                                                                   framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
366                                                                                                                   DepthConvertLayerZeroShiftDataset))
367 {
368     // Validate output
369     validate(Accessor(_target), _reference, tolerance_one_uint8);
370 }
371 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToU8Fixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerF16toU8Dataset),
372                                                                                                                         framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
373                                                                                                                 DepthConvertLayerZeroShiftDataset))
374 {
375     // Validate output
376     validate(Accessor(_target), _reference, tolerance_one_uint8);
377 }
378 TEST_SUITE_END() // F16_to_U8
379 
TEST_SUITE(F16_to_F32)380 TEST_SUITE(F16_to_F32)
381 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToF32Fixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerF16toF32Dataset),
382                                                                                                                    framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
383                                                                                                                    DepthConvertLayerZeroShiftDataset))
384 {
385     // Validate output
386     validate(Accessor(_target), _reference);
387 }
388 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToF32Fixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerF16toF32Dataset),
389                                                                                                                  framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
390                                                                                                                  DepthConvertLayerZeroShiftDataset))
391 {
392     // Validate output
393     validate(Accessor(_target), _reference);
394 }
395 TEST_SUITE_END() // F16_to_F32
396 
TEST_SUITE(F16_to_S32)397 TEST_SUITE(F16_to_S32)
398 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToS32Fixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerF16toS32Dataset),
399                                                                                                                    framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
400                                                                                                                    DepthConvertLayerZeroShiftDataset))
401 {
402     // Validate output
403     validate(Accessor(_target), _reference, tolerance_one_int32);
404 }
405 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToS32Fixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerF16toS32Dataset),
406                                                                                                                  framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
407                                                                                                                  DepthConvertLayerZeroShiftDataset))
408 {
409     // Validate output
410     validate(Accessor(_target), _reference, tolerance_one_int32);
411 }
412 
413 TEST_SUITE_END() // F16_to_S32
414 
TEST_SUITE(QASYMM8_to_F16)415 TEST_SUITE(QASYMM8_to_F16)
416 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerQuantizedToF16Fixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallShapes(),
417                        DepthConvertLayerQASYMM8toF16Dataset),
418                        framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
419                        DepthConvertLayerZeroShiftDataset),
420                        framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })))
421 {
422     // Validate output
423     validate(Accessor(_target), _reference);
424 }
425 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerQuantizedToF16Fixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeShapes(),
426                        DepthConvertLayerQASYMM8toF16Dataset),
427                        framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
428                        DepthConvertLayerZeroShiftDataset),
429                        framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })))
430 {
431     // Validate output
432     validate(Accessor(_target), _reference);
433 }
434 TEST_SUITE_END() // QASYMM8_to_F16
435 
TEST_SUITE(F32_to_F16)436 TEST_SUITE(F32_to_F16)
437 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToF16Fixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerF32toF16Dataset),
438                                                                                                                     framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
439                                                                                                                     DepthConvertLayerZeroShiftDataset))
440 {
441     // Validate output
442     validate(Accessor(_target), _reference);
443 }
444 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToF16Fixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerF32toF16Dataset),
445                                                                                                                   framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
446                                                                                                                   DepthConvertLayerZeroShiftDataset))
447 {
448     // Validate output
449     validate(Accessor(_target), _reference);
450 }
451 TEST_SUITE_END() // F32_to_F16
452 
TEST_SUITE(S32_to_F16)453 TEST_SUITE(S32_to_F16)
454 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToF16Fixture<int32_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerS32toF16Dataset),
455                                                                                                                       framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
456                                                                                                                       DepthConvertLayerZeroShiftDataset))
457 {
458     // Validate output
459     validate(Accessor(_target), _reference);
460 }
461 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToF16Fixture<int32_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerS32toF16Dataset),
462                                                                                                                     framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
463                                                                                                                     DepthConvertLayerZeroShiftDataset))
464 {
465     // Validate output
466     validate(Accessor(_target), _reference);
467 }
468 TEST_SUITE_END() // S32_to_F16
469 
470 #endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
471 
TEST_SUITE(F32_to_S32)472 TEST_SUITE(F32_to_S32)
473 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToS32Fixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerF32toS32Dataset),
474                                                                                                                     framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
475                                                                                                                     DepthConvertLayerZeroShiftDataset))
476 {
477     // Validate output
478     validate(Accessor(_target), _reference, tolerance_one_int32);
479 }
480 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToS32Fixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerF32toS32Dataset),
481                                                                                                                   framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
482                                                                                                                   DepthConvertLayerZeroShiftDataset))
483 {
484     // Validate output
485     validate(Accessor(_target), _reference, tolerance_one_int32);
486 }
487 TEST_SUITE_END() // F32_to_S32
488 
TEST_SUITE(F32_to_U8)489 TEST_SUITE(F32_to_U8)
490 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToU8Fixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerF32toU8Dataset),
491                                                                                                                    framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
492                                                                                                                    DepthConvertLayerZeroShiftDataset))
493 {
494     // Validate output
495     validate(Accessor(_target), _reference, tolerance_one_int32);
496 }
497 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToU8Fixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerF32toU8Dataset),
498                                                                                                                  framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
499                                                                                                                  DepthConvertLayerZeroShiftDataset))
500 {
501     // Validate output
502     validate(Accessor(_target), _reference, tolerance_one_int32);
503 }
504 TEST_SUITE_END() // F32_to_U8
505 
TEST_SUITE(F32_to_QASYMM8)506 TEST_SUITE(F32_to_QASYMM8)
507 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToQASYMM8Fixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallShapes(),
508                                                                                                                         DepthConvertLayerF32toQASYMM8Dataset),
509                                                                                                                         framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
510                                                                                                                         DepthConvertLayerZeroShiftDataset),
511                                                                                                                         framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })))
512 {
513     // Validate output
514     validate(Accessor(_target), _reference, tolerance_qasymm8);
515 }
516 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToQASYMM8Fixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeShapes(),
517                                                                                                                       DepthConvertLayerF32toQASYMM8Dataset),
518                                                                                                                       framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
519                                                                                                                       DepthConvertLayerZeroShiftDataset),
520                                                                                                                       framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })))
521 {
522     // Validate output
523     validate(Accessor(_target), _reference, tolerance_qasymm8);
524 }
525 TEST_SUITE_END() // F32_to_QASYMM8
526 
TEST_SUITE(S32_to_F32)527 TEST_SUITE(S32_to_F32)
528 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToF32Fixture<int32_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerS32toF32Dataset),
529                                                                                                                       framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
530                                                                                                                       DepthConvertLayerZeroShiftDataset))
531 {
532     // Validate output
533     validate(Accessor(_target), _reference);
534 }
535 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToF32Fixture<int32_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerS32toF32Dataset),
536                                                                                                                     framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
537                                                                                                                     DepthConvertLayerZeroShiftDataset))
538 {
539     // Validate output
540     validate(Accessor(_target), _reference);
541 }
542 TEST_SUITE_END() // S32_to_F32
543 
TEST_SUITE(S32_to_QASYMM8)544 TEST_SUITE(S32_to_QASYMM8)
545 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToQASYMM8Fixture<int32_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallShapes(),
546                        DepthConvertLayerS32toQASYMM8Dataset),
547                        framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
548                        DepthConvertLayerZeroShiftDataset),
549                        framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })))
550 {
551     // Validate output
552     validate(Accessor(_target), _reference, tolerance_qasymm8);
553 }
554 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToQASYMM8Fixture<int32_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeShapes(),
555                                                                                                                         DepthConvertLayerS32toQASYMM8Dataset),
556                                                                                                                         framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE })),
557                                                                                                                         DepthConvertLayerZeroShiftDataset),
558                                                                                                                         framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })))
559 {
560     // Validate output
561     validate(Accessor(_target), _reference, tolerance_qasymm8);
562 }
563 TEST_SUITE_END() // S32_to_QASYMM8
564 
TEST_SUITE(S32_to_U8)565 TEST_SUITE(S32_to_U8)
566 FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConvertLayerToU8Fixture<int32_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallShapes(), DepthConvertLayerS32toU8Dataset),
567                                                                                                                      framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
568                                                                                                                      DepthConvertLayerZeroShiftDataset))
569 {
570     // Validate output
571     validate(Accessor(_target), _reference);
572 }
573 FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConvertLayerToU8Fixture<int32_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeShapes(), DepthConvertLayerS32toU8Dataset),
574                                                                                                                    framework::dataset::make("ConvertPolicy", { ConvertPolicy::SATURATE, ConvertPolicy::WRAP })),
575                                                                                                                    DepthConvertLayerZeroShiftDataset))
576 {
577     // Validate output
578     validate(Accessor(_target), _reference);
579 }
580 TEST_SUITE_END() // S32_to_U8
581 
582 TEST_SUITE_END() // DepthConvertLayer
583 TEST_SUITE_END() // Neon
584 } // namespace validation
585 } // namespace test
586 } // namespace arm_compute
587