blob: 65d3ab1be7635942cdec72c0e6ec3fc381da499c [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
2 * Copyright (c) 2017 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 "Globals.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010025#include "NEON/NEAccessor.h"
Moritz Pflanzer5b512292017-06-21 15:54:07 +010026#include "PaddingCalculator.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010027#include "TensorLibrary.h"
28#include "TypePrinter.h"
29#include "Utils.h"
30#include "validation/Datasets.h"
31#include "validation/Reference.h"
32#include "validation/Validation.h"
33
34#include "arm_compute/core/Helpers.h"
35#include "arm_compute/core/Types.h"
36#include "arm_compute/runtime/NEON/functions/NEDepthConvert.h"
37#include "arm_compute/runtime/Tensor.h"
38#include "arm_compute/runtime/TensorAllocator.h"
39
40#include "boost_wrapper.h"
41
42#include <random>
43#include <string>
44
45using namespace arm_compute;
46using namespace arm_compute::test;
47using namespace arm_compute::test::neon;
48using namespace arm_compute::test::validation;
49
50namespace
51{
52/** Compute Neon depth convert function.
53 *
54 * @param[in] shape Shape of the input and output tensors.
55 * @param[in] dt_in Data type of input tensor.
56 * @param[in] dt_out Data type of the output tensor.
57 * @param[in] policy Conversion policy.
58 * @param[in] shift Value for down/up conversions. Must be 0 <= shift < 8.
59 * @param[in] fixed_point_position Fixed point position.
60 *
61 * @return Computed output tensor.
62 */
63Tensor compute_depth_convert(const TensorShape &shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t shift, uint32_t fixed_point_position)
64{
65 // Create tensors
Moritz Pflanzer94450f12017-06-30 12:48:43 +010066 Tensor src = create_tensor<Tensor>(shape, dt_in, 1, fixed_point_position);
67 Tensor dst = create_tensor<Tensor>(shape, dt_out, 1, fixed_point_position);
Anthony Barbier6ff3b192017-09-04 18:44:23 +010068
69 // Create and configure function
70 NEDepthConvert depth_convert;
71 depth_convert.configure(&src, &dst, policy, shift);
72
73 // Allocate tensors
74 src.allocator()->allocate();
75 dst.allocator()->allocate();
76
77 BOOST_TEST(!src.info()->is_resizable());
78 BOOST_TEST(!dst.info()->is_resizable());
79
80 // Fill tensors
81 library->fill_tensor_uniform(NEAccessor(src), 0);
82
83 // Compute function
84 depth_convert.run();
85
86 return dst;
87}
88/** Configure and validate region/padding function.
89 *
90 * @param[in] shape Shape of the input and output tensors.
91 * @param[in] dt_in Data type of input tensor.
92 * @param[in] dt_out Data type of the output tensor.
93 * @param[in] policy Conversion policy.
94 * @param[in] shift Value for down/up conversions. Must be 0 <= shift < 8.
95 * @param[in] fixed_point_position Fixed point position.
96 *
97 */
98
99void compute_configure_validate(const TensorShape &shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t shift, uint32_t fixed_point_position)
100{
101 // Create tensors
Moritz Pflanzer94450f12017-06-30 12:48:43 +0100102 Tensor src = create_tensor<Tensor>(shape, dt_in, 1, fixed_point_position);
103 Tensor dst = create_tensor<Tensor>(shape, dt_out, 1, fixed_point_position);
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100104
105 BOOST_TEST(src.info()->is_resizable());
106 BOOST_TEST(dst.info()->is_resizable());
107
108 // Create and configure function
109 NEDepthConvert depth_convert;
110 depth_convert.configure(&src, &dst, policy, shift);
111
112 // Validate valid region
113 const ValidRegion valid_region = shape_to_valid_region(shape);
114 validate(src.info()->valid_region(), valid_region);
115 validate(dst.info()->valid_region(), valid_region);
116
117 // Validate padding
Moritz Pflanzer2509fba2017-06-23 14:15:03 +0100118 const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_padding();
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100119 validate(src.info()->padding(), padding);
120 validate(dst.info()->padding(), padding);
121}
122} // namespace
123
124#ifndef DOXYGEN_SKIP_THIS
125BOOST_AUTO_TEST_SUITE(NEON)
126BOOST_AUTO_TEST_SUITE(DepthConvert)
127
128BOOST_AUTO_TEST_SUITE(QS8_to_F32)
129BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
130BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE })
131 * boost::unit_test::data::xrange(1, 7, 1),
132 shape, policy, fixed_point_position)
133{
134 // Compute configure and validate region/padding
135 compute_configure_validate(shape, DataType::QS8, DataType::F32, policy, 0, fixed_point_position);
136}
137
138BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
139BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE })
140 * boost::unit_test::data::xrange(1, 7, 1),
141 shape, policy, fixed_point_position)
142{
143 // Compute function
144 Tensor dst = compute_depth_convert(shape, DataType::QS8, DataType::F32, policy, 0, fixed_point_position);
145
146 // Compute reference
147 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::QS8, DataType::F32, policy, 0, fixed_point_position);
148
149 // Validate output
150 validate(NEAccessor(dst), ref_dst);
151}
152
153BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
154BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE })
155 * boost::unit_test::data::xrange(1, 7, 1),
156 shape, policy, fixed_point_position)
157{
158 // Compute function
159 Tensor dst = compute_depth_convert(shape, DataType::QS8, DataType::F32, policy, 0, fixed_point_position);
160
161 // Compute reference
162 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::QS8, DataType::F32, policy, 0, fixed_point_position);
163
164 // Validate output
165 validate(NEAccessor(dst), ref_dst);
166}
167
168BOOST_AUTO_TEST_SUITE_END()
169
170BOOST_AUTO_TEST_SUITE(F32_to_QS8)
171BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
172BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE })
173 * boost::unit_test::data::xrange(1, 7, 1),
174 shape, policy, fixed_point_position)
175{
176 // Compute configure and validate region/padding
177 compute_configure_validate(shape, DataType::F32, DataType::QS8, policy, 0, fixed_point_position);
178}
179
180BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
181BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE })
182 * boost::unit_test::data::xrange(1, 7, 1),
183 shape, policy, fixed_point_position)
184{
185 // Compute function
186 Tensor dst = compute_depth_convert(shape, DataType::F32, DataType::QS8, policy, 0, fixed_point_position);
187
188 // Compute reference
189 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::F32, DataType::QS8, policy, 0, fixed_point_position);
190
191 // Validate output
192 validate(NEAccessor(dst), ref_dst);
193}
194
195BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
196BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE })
197 * boost::unit_test::data::xrange(1, 7, 1),
198 shape, policy, fixed_point_position)
199{
200 // Compute function
201 Tensor dst = compute_depth_convert(shape, DataType::F32, DataType::QS8, policy, 0, fixed_point_position);
202
203 // Compute reference
204 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::F32, DataType::QS8, policy, 0, fixed_point_position);
205
206 // Validate output
207 validate(NEAccessor(dst), ref_dst);
208}
209BOOST_AUTO_TEST_SUITE_END()
210
Georgios Pinitas21efeb42017-07-04 12:47:17 +0100211BOOST_AUTO_TEST_SUITE(QS16_to_F32)
212BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
213BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE })
214 * boost::unit_test::data::xrange(1, 15, 1),
215 shape, policy, fixed_point_position)
216{
217 // Compute configure and validate region/padding
218 compute_configure_validate(shape, DataType::QS16, DataType::F32, policy, 0, fixed_point_position);
219}
220
221BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
222BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE })
223 * boost::unit_test::data::xrange(1, 15, 1),
224 shape, policy, fixed_point_position)
225{
226 // Compute function
227 Tensor dst = compute_depth_convert(shape, DataType::QS16, DataType::F32, policy, 0, fixed_point_position);
228
229 // Compute reference
230 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::QS16, DataType::F32, policy, 0, fixed_point_position);
231
232 // Validate output
233 validate(NEAccessor(dst), ref_dst);
234}
235
236BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
237BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE })
238 * boost::unit_test::data::xrange(1, 15, 1),
239 shape, policy, fixed_point_position)
240{
241 // Compute function
242 Tensor dst = compute_depth_convert(shape, DataType::QS16, DataType::F32, policy, 0, fixed_point_position);
243
244 // Compute reference
245 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::QS16, DataType::F32, policy, 0, fixed_point_position);
246
247 // Validate output
248 validate(NEAccessor(dst), ref_dst);
249}
250
251BOOST_AUTO_TEST_SUITE_END()
252
253BOOST_AUTO_TEST_SUITE(F32_to_QS16)
254BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
255BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE })
256 * boost::unit_test::data::xrange(1, 7, 1),
257 shape, policy, fixed_point_position)
258{
259 // Compute configure and validate region/padding
260 compute_configure_validate(shape, DataType::F32, DataType::QS16, policy, 0, fixed_point_position);
261}
262
263BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
264BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE })
265 * boost::unit_test::data::xrange(1, 15, 1),
266 shape, policy, fixed_point_position)
267{
268 // Compute function
269 Tensor dst = compute_depth_convert(shape, DataType::F32, DataType::QS16, policy, 0, fixed_point_position);
270
271 // Compute reference
272 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::F32, DataType::QS16, policy, 0, fixed_point_position);
273
274 // Validate output
275 validate(NEAccessor(dst), ref_dst);
276}
277
278BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
279BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE })
280 * boost::unit_test::data::xrange(1, 15, 1),
281 shape, policy, fixed_point_position)
282{
283 // Compute function
284 Tensor dst = compute_depth_convert(shape, DataType::F32, DataType::QS16, policy, 0, fixed_point_position);
285
286 // Compute reference
287 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::F32, DataType::QS16, policy, 0, fixed_point_position);
288
289 // Validate output
290 validate(NEAccessor(dst), ref_dst);
291}
292BOOST_AUTO_TEST_SUITE_END()
293
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100294BOOST_AUTO_TEST_SUITE(U8_to_U16)
295BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
296
297BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
298 * boost::unit_test::data::xrange(0, 7, 1),
299 shape, policy, shift)
300{
301 // Compute configure and validate region/padding
302 compute_configure_validate(shape, DataType::U8, DataType::U16, policy, shift, 0);
303}
304
305BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
306BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
307 * boost::unit_test::data::xrange(0, 7, 1),
308 shape, policy, shift)
309{
310 // Compute function
311 Tensor dst = compute_depth_convert(shape, DataType::U8, DataType::U16, policy, shift, 0);
312
313 // Compute reference
314 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U8, DataType::U16, policy, shift, 0);
315
316 // Validate output
317 validate(NEAccessor(dst), ref_dst);
318}
319BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
320BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
321 * boost::unit_test::data::xrange(0, 7, 1),
322 shape, policy, shift)
323{
324 // Compute function
325 Tensor dst = compute_depth_convert(shape, DataType::U8, DataType::U16, policy, shift, 0);
326
327 // Compute reference
328 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U8, DataType::U16, policy, shift, 0);
329
330 // Validate output
331 validate(NEAccessor(dst), ref_dst);
332}
333BOOST_AUTO_TEST_SUITE_END()
334
335BOOST_AUTO_TEST_SUITE(U8_to_S16)
336BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
337BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
338 * boost::unit_test::data::xrange(0, 7, 1),
339 shape, policy, shift)
340{
341 // Compute configure and validate region/padding
342 compute_configure_validate(shape, DataType::U8, DataType::S16, policy, shift, 0);
343}
344
345BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
346BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
347 * boost::unit_test::data::xrange(0, 7, 1),
348 shape, policy, shift)
349{
350 // Compute function
351 Tensor dst = compute_depth_convert(shape, DataType::U8, DataType::S16, policy, shift, 0);
352
353 // Compute reference
354 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U8, DataType::S16, policy, shift, 0);
355
356 // Validate output
357 validate(NEAccessor(dst), ref_dst);
358}
359
360BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
361BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
362 * boost::unit_test::data::xrange(0, 7, 1),
363 shape, policy, shift)
364{
365 // Compute function
366 Tensor dst = compute_depth_convert(shape, DataType::U8, DataType::S16, policy, shift, 0);
367
368 // Compute reference
369 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U8, DataType::S16, policy, shift, 0);
370
371 // Validate output
372 validate(NEAccessor(dst), ref_dst);
373}
374BOOST_AUTO_TEST_SUITE_END()
375
376BOOST_AUTO_TEST_SUITE(U8_to_S32)
377BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
378BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
379 * boost::unit_test::data::xrange(0, 7, 1),
380 shape, policy, shift)
381{
382 // Compute configure and validate region/padding
383 compute_configure_validate(shape, DataType::U8, DataType::S32, policy, shift, 0);
384}
385
386BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
387BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
388 * boost::unit_test::data::xrange(0, 7, 1),
389 shape, policy, shift)
390{
391 // Compute function
392 Tensor dst = compute_depth_convert(shape, DataType::U8, DataType::S32, policy, shift, 0);
393
394 // Compute reference
395 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U8, DataType::S32, policy, shift, 0);
396
397 // Validate output
398 validate(NEAccessor(dst), ref_dst);
399}
400
401BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
402BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
403 * boost::unit_test::data::xrange(0, 7, 1),
404 shape, policy, shift)
405{
406 // Compute function
407 Tensor dst = compute_depth_convert(shape, DataType::U8, DataType::S32, policy, shift, 0);
408
409 // Compute reference
410 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U8, DataType::S32, policy, shift, 0);
411
412 // Validate output
413 validate(NEAccessor(dst), ref_dst);
414}
415BOOST_AUTO_TEST_SUITE_END()
416
417BOOST_AUTO_TEST_SUITE(U16_to_U8)
418BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
419BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
420 * boost::unit_test::data::xrange(0, 7, 1),
421 shape, policy, shift)
422{
423 // Compute configure and validate region/padding
424 compute_configure_validate(shape, DataType::U16, DataType::U8, policy, shift, 0);
425}
426
427BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
428BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
429 * boost::unit_test::data::xrange(0, 7, 1),
430 shape, policy, shift)
431{
432 // Compute function
433 Tensor dst = compute_depth_convert(shape, DataType::U16, DataType::U8, policy, shift, 0);
434
435 // Compute reference
436 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U16, DataType::U8, policy, shift, 0);
437
438 // Validate output
439 validate(NEAccessor(dst), ref_dst);
440}
441
442BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
443BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
444 * boost::unit_test::data::xrange(0, 7, 1),
445 shape, policy, shift)
446{
447 // Compute function
448 Tensor dst = compute_depth_convert(shape, DataType::U16, DataType::U8, policy, shift, 0);
449
450 // Compute reference
451 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U16, DataType::U8, policy, shift, 0);
452
453 // Validate output
454 validate(NEAccessor(dst), ref_dst);
455}
456BOOST_AUTO_TEST_SUITE_END()
457
458BOOST_AUTO_TEST_SUITE(U16_to_U32)
459BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
460BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
461 * boost::unit_test::data::xrange(0, 7, 1),
462 shape, policy, shift)
463{
464 // Compute configure and validate region/padding
465 compute_configure_validate(shape, DataType::U16, DataType::U32, policy, shift, 0);
466}
467
468BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
469BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
470 * boost::unit_test::data::xrange(0, 7, 1),
471 shape, policy, shift)
472{
473 // Compute function
474 Tensor dst = compute_depth_convert(shape, DataType::U16, DataType::U32, policy, shift, 0);
475
476 // Compute reference
477 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U16, DataType::U32, policy, shift, 0);
478
479 // Validate output
480 validate(NEAccessor(dst), ref_dst);
481}
482
483BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
484BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
485 * boost::unit_test::data::xrange(0, 7, 1),
486 shape, policy, shift)
487{
488 // Compute function
489 Tensor dst = compute_depth_convert(shape, DataType::U16, DataType::U32, policy, shift, 0);
490
491 // Compute reference
492 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U16, DataType::U32, policy, shift, 0);
493
494 // Validate output
495 validate(NEAccessor(dst), ref_dst);
496}
497BOOST_AUTO_TEST_SUITE_END()
498
499BOOST_AUTO_TEST_SUITE(S16_to_U8)
500BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
501BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
502 * boost::unit_test::data::xrange(0, 7, 1),
503 shape, policy, shift)
504{
505 // Compute configure and validate region/padding
506 compute_configure_validate(shape, DataType::S16, DataType::U8, policy, shift, 0);
507}
508
509BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
510BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
511 * boost::unit_test::data::xrange(0, 7, 1),
512 shape, policy, shift)
513{
514 // Compute function
515 Tensor dst = compute_depth_convert(shape, DataType::S16, DataType::U8, policy, shift, 0);
516
517 // Compute reference
518 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::S16, DataType::U8, policy, shift, 0);
519
520 // Validate output
521 validate(NEAccessor(dst), ref_dst);
522}
523
524BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
525BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
526 * boost::unit_test::data::xrange(0, 7, 1),
527 shape, policy, shift)
528{
529 // Compute function
530 Tensor dst = compute_depth_convert(shape, DataType::S16, DataType::U8, policy, shift, 0);
531
532 // Compute reference
533 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::S16, DataType::U8, policy, shift, 0);
534
535 // Validate output
536 validate(NEAccessor(dst), ref_dst);
537}
538BOOST_AUTO_TEST_SUITE_END()
539
540BOOST_AUTO_TEST_SUITE(S16_to_S32)
541BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
542BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
543 * boost::unit_test::data::xrange(0, 7, 1),
544 shape, policy, shift)
545{
546 // Compute configure and validate region/padding
547 compute_configure_validate(shape, DataType::S16, DataType::S32, policy, shift, 0);
548}
549
550BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
551BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
552 * boost::unit_test::data::xrange(0, 7, 1),
553 shape, policy, shift)
554{
555 // Compute function
556 Tensor dst = compute_depth_convert(shape, DataType::S16, DataType::S32, policy, shift, 0);
557
558 // Compute reference
559 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::S16, DataType::S32, policy, shift, 0);
560
561 // Validate output
562 validate(NEAccessor(dst), ref_dst);
563}
564
565BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
566BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
567 * boost::unit_test::data::xrange(0, 7, 1),
568 shape, policy, shift)
569{
570 // Compute function
571 Tensor dst = compute_depth_convert(shape, DataType::S16, DataType::S32, policy, shift, 0);
572
573 // Compute reference
574 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::S16, DataType::S32, policy, shift, 0);
575
576 // Validate output
577 validate(NEAccessor(dst), ref_dst);
578}
579BOOST_AUTO_TEST_SUITE_END()
580
581BOOST_AUTO_TEST_SUITE_END()
582BOOST_AUTO_TEST_SUITE_END()
Anthony Barbierac69aa12017-07-03 17:39:37 +0100583#endif /* DOXYGEN_SKIP_THIS */