blob: 547820e5d78dbc737053b99344dd315d07e681cf [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 "CL/CLAccessor.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010025#include "Globals.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/CL/functions/CLDepthConvert.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::cl;
48using namespace arm_compute::test::validation;
49
50namespace
51{
52/** Compute CL 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 *
60 * @return Computed output CLtensor.
61 */
steniu01da37e2f2017-06-29 10:14:58 +010062CLTensor compute_depth_convert(const TensorShape &shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t shift, uint32_t fixed_point_position = 0)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010063{
64 // Create tensors
steniu01da37e2f2017-06-29 10:14:58 +010065 CLTensor src = create_tensor<CLTensor>(shape, dt_in, 1, fixed_point_position);
66 CLTensor dst = create_tensor<CLTensor>(shape, dt_out, 1, fixed_point_position);
Anthony Barbier6ff3b192017-09-04 18:44:23 +010067
68 // Create and configure function
69 CLDepthConvert depth_convert;
70 depth_convert.configure(&src, &dst, policy, shift);
71
72 // Allocate tensors
73 src.allocator()->allocate();
74 dst.allocator()->allocate();
75
76 BOOST_TEST(!src.info()->is_resizable());
77 BOOST_TEST(!dst.info()->is_resizable());
78
79 // Fill tensors
80 library->fill_tensor_uniform(CLAccessor(src), 0);
81
82 // Compute function
83 depth_convert.run();
84
85 return dst;
86}
87/** Configure and validate region/padding function.
88 *
steniu01da37e2f2017-06-29 10:14:58 +010089 * @param[in] shape Shape of the input and output tensors.
90 * @param[in] dt_in Data type of input tensor.
91 * @param[in] dt_out Data type of the output tensor.
92 * @param[in] policy Conversion policy.
93 * @param[in] shift Value for down/up conversions. Must be 0 <= shift < 8.
94 * @param[in] fixed_point_position Fixed point position.
Anthony Barbier6ff3b192017-09-04 18:44:23 +010095 *
96 */
steniu01da37e2f2017-06-29 10:14:58 +010097void compute_configure_validate(const TensorShape &shape, DataType dt_in, DataType dt_out, ConvertPolicy policy, uint32_t shift, uint32_t fixed_point_position = 0)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010098{
99 // Create tensors
steniu01da37e2f2017-06-29 10:14:58 +0100100 CLTensor src = create_tensor<CLTensor>(shape, dt_in, 1, fixed_point_position);
101 CLTensor dst = create_tensor<CLTensor>(shape, dt_out, 1, fixed_point_position);
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100102
103 BOOST_TEST(src.info()->is_resizable());
104 BOOST_TEST(dst.info()->is_resizable());
105
106 // Create and configure function
107 CLDepthConvert depth_convert;
108 depth_convert.configure(&src, &dst, policy, shift);
109
110 // Validate valid region
111 const ValidRegion valid_region = shape_to_valid_region(shape);
112 validate(src.info()->valid_region(), valid_region);
113 validate(dst.info()->valid_region(), valid_region);
114
115 // Validate padding
Moritz Pflanzer2509fba2017-06-23 14:15:03 +0100116 const PaddingSize padding = PaddingCalculator(shape.x(), 16).required_padding();
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100117 validate(src.info()->padding(), padding);
118 validate(dst.info()->padding(), padding);
119}
120} // namespace
121
122#ifndef DOXYGEN_SKIP_THIS
123BOOST_AUTO_TEST_SUITE(CL)
124BOOST_AUTO_TEST_SUITE(DepthConvert)
125
126BOOST_AUTO_TEST_SUITE(U8_to_U16)
127BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
128BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
129 * boost::unit_test::data::xrange(0, 7, 1),
130 shape, policy, shift)
131{
132 // Compute configure and validate region/padding
133 compute_configure_validate(shape, DataType::U8, DataType::U16, policy, shift);
134}
135
136BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
137BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
138 * boost::unit_test::data::xrange(0, 7, 1),
139 shape, policy, shift)
140{
141 // Compute function
142 CLTensor dst = compute_depth_convert(shape, DataType::U8, DataType::U16, policy, shift);
143
144 // Compute reference
145 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U8, DataType::U16, policy, shift, 0);
146
147 // Validate output
148 validate(CLAccessor(dst), ref_dst);
149}
150BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
151BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
152 * boost::unit_test::data::xrange(0, 7, 1),
153 shape, policy, shift)
154{
155 // Compute function
156 CLTensor dst = compute_depth_convert(shape, DataType::U8, DataType::U16, policy, shift);
157
158 // Compute reference
159 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U8, DataType::U16, policy, shift, 0);
160
161 // Validate output
162 validate(CLAccessor(dst), ref_dst);
163}
164BOOST_AUTO_TEST_SUITE_END()
165
166BOOST_AUTO_TEST_SUITE(U8_to_S16)
167BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
168BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
169 * boost::unit_test::data::xrange(0, 7, 1),
170 shape, policy, shift)
171{
172 // Compute configure and validate region/padding
173 compute_configure_validate(shape, DataType::U8, DataType::S16, policy, shift);
174}
175
176BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
177BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
178 * boost::unit_test::data::xrange(0, 7, 1),
179 shape, policy, shift)
180{
181 // Compute function
182 CLTensor dst = compute_depth_convert(shape, DataType::U8, DataType::S16, policy, shift);
183
184 // Compute reference
185 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U8, DataType::S16, policy, shift, 0);
186
187 // Validate output
188 validate(CLAccessor(dst), ref_dst);
189}
190
191BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
192BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
193 * boost::unit_test::data::xrange(0, 7, 1),
194 shape, policy, shift)
195{
196 // Compute function
197 CLTensor dst = compute_depth_convert(shape, DataType::U8, DataType::S16, policy, shift);
198
199 // Compute reference
200 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U8, DataType::S16, policy, shift, 0);
201
202 // Validate output
203 validate(CLAccessor(dst), ref_dst);
204}
205BOOST_AUTO_TEST_SUITE_END()
206
207BOOST_AUTO_TEST_SUITE(U8_to_S32)
208BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
209BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
210 * boost::unit_test::data::xrange(0, 7, 1),
211 shape, policy, shift)
212{
213 // Compute configure and validate region/padding
214 compute_configure_validate(shape, DataType::U8, DataType::S32, policy, shift);
215}
216
217BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
218BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
219 * boost::unit_test::data::xrange(0, 7, 1),
220 shape, policy, shift)
221{
222 // Compute function
223 CLTensor dst = compute_depth_convert(shape, DataType::U8, DataType::S32, policy, shift);
224
225 // Compute reference
226 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U8, DataType::S32, policy, shift, 0);
227
228 // Validate output
229 validate(CLAccessor(dst), ref_dst);
230}
231
232BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
233BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
234 * boost::unit_test::data::xrange(0, 7, 1),
235 shape, policy, shift)
236{
237 // Compute function
238 CLTensor dst = compute_depth_convert(shape, DataType::U8, DataType::S32, policy, shift);
239
240 // Compute reference
241 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U8, DataType::S32, policy, shift, 0);
242
243 // Validate output
244 validate(CLAccessor(dst), ref_dst);
245}
246BOOST_AUTO_TEST_SUITE_END()
247
248BOOST_AUTO_TEST_SUITE(U16_to_U8)
249BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
250BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
251 * boost::unit_test::data::xrange(0, 7, 1),
252 shape, policy, shift)
253{
254 // Compute configure and validate region/padding
255 compute_configure_validate(shape, DataType::U16, DataType::U8, policy, shift);
256}
257
258BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
259BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
260 * boost::unit_test::data::xrange(0, 7, 1),
261 shape, policy, shift)
262{
263 // Compute function
264 CLTensor dst = compute_depth_convert(shape, DataType::U16, DataType::U8, policy, shift);
265
266 // Compute reference
267 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U16, DataType::U8, policy, shift, 0);
268
269 // Validate output
270 validate(CLAccessor(dst), ref_dst);
271}
272
273BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
274BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
275 * boost::unit_test::data::xrange(0, 7, 1),
276 shape, policy, shift)
277{
278 // Compute function
279 CLTensor dst = compute_depth_convert(shape, DataType::U16, DataType::U8, policy, shift);
280
281 // Compute reference
282 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U16, DataType::U8, policy, shift, 0);
283
284 // Validate output
285 validate(CLAccessor(dst), ref_dst);
286}
287BOOST_AUTO_TEST_SUITE_END()
288
289BOOST_AUTO_TEST_SUITE(U16_to_U32)
290BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
291BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
292 * boost::unit_test::data::xrange(0, 7, 1),
293 shape, policy, shift)
294{
295 // Compute configure and validate region/padding
296 compute_configure_validate(shape, DataType::U16, DataType::U32, policy, shift);
297}
298
299BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
300BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
301 * boost::unit_test::data::xrange(0, 7, 1),
302 shape, policy, shift)
303{
304 // Compute function
305 CLTensor dst = compute_depth_convert(shape, DataType::U16, DataType::U32, policy, shift);
306
307 // Compute reference
308 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U16, DataType::U32, policy, shift, 0);
309
310 // Validate output
311 validate(CLAccessor(dst), ref_dst);
312}
313
314BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
315BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
316 * boost::unit_test::data::xrange(0, 7, 1),
317 shape, policy, shift)
318{
319 // Compute function
320 CLTensor dst = compute_depth_convert(shape, DataType::U16, DataType::U32, policy, shift);
321
322 // Compute reference
323 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::U16, DataType::U32, policy, shift, 0);
324
325 // Validate output
326 validate(CLAccessor(dst), ref_dst);
327}
328BOOST_AUTO_TEST_SUITE_END()
329
330BOOST_AUTO_TEST_SUITE(S16_to_U8)
331BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
332BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
333 * boost::unit_test::data::xrange(0, 7, 1),
334 shape, policy, shift)
335{
336 // Compute configure and validate region/padding
337 compute_configure_validate(shape, DataType::S16, DataType::U8, policy, shift);
338}
339
340BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
341BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
342 * boost::unit_test::data::xrange(0, 7, 1),
343 shape, policy, shift)
344{
345 // Compute function
346 CLTensor dst = compute_depth_convert(shape, DataType::S16, DataType::U8, policy, shift);
347
348 // Compute reference
349 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::S16, DataType::U8, policy, shift, 0);
350
351 // Validate output
352 validate(CLAccessor(dst), ref_dst);
353}
354
355BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
356BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
357 * boost::unit_test::data::xrange(0, 7, 1),
358 shape, policy, shift)
359{
360 // Compute function
361 CLTensor dst = compute_depth_convert(shape, DataType::S16, DataType::U8, policy, shift);
362
363 // Compute reference
364 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::S16, DataType::U8, policy, shift, 0);
365
366 // Validate output
367 validate(CLAccessor(dst), ref_dst);
368}
369BOOST_AUTO_TEST_SUITE_END()
370
371BOOST_AUTO_TEST_SUITE(S16_to_S32)
372BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
373BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
374 * boost::unit_test::data::xrange(0, 7, 1),
375 shape, policy, shift)
376{
377 // Compute configure and validate region/padding
378 compute_configure_validate(shape, DataType::S16, DataType::S32, policy, shift);
379}
380
381BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
382BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
383 * boost::unit_test::data::xrange(0, 7, 1),
384 shape, policy, shift)
385{
386 // Compute function
387 CLTensor dst = compute_depth_convert(shape, DataType::S16, DataType::S32, policy, shift);
388
389 // Compute reference
390 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::S16, DataType::S32, policy, shift, 0);
391
392 // Validate output
393 validate(CLAccessor(dst), ref_dst);
394}
395
396BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
397BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE, ConvertPolicy::WRAP })
398 * boost::unit_test::data::xrange(0, 7, 1),
399 shape, policy, shift)
400{
401 // Compute function
402 CLTensor dst = compute_depth_convert(shape, DataType::S16, DataType::S32, policy, shift);
403
404 // Compute reference
405 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::S16, DataType::S32, policy, shift, 0);
406
407 // Validate output
408 validate(CLAccessor(dst), ref_dst);
409}
410BOOST_AUTO_TEST_SUITE_END()
411
steniu01da37e2f2017-06-29 10:14:58 +0100412BOOST_AUTO_TEST_SUITE(Quantized_to_F32)
413BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
414BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ DataType::QS8, DataType::QS16 })
415 * boost::unit_test::data::make({ ConvertPolicy::SATURATE }) * boost::unit_test::data::xrange(1, 7, 1),
416 shape, dt, policy, fixed_point_position)
417{
418 // Compute configure and validate region/padding
419 compute_configure_validate(shape, dt, DataType::F32, policy, 0, fixed_point_position);
420}
421
422BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
423BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ ConvertPolicy::SATURATE })
424 * boost::unit_test::data::make({ DataType::QS8, DataType::QS16 }) * boost::unit_test::data::xrange(1, 7, 1),
425 shape, policy, dt, fixed_point_position)
426{
427 // Compute function
428 CLTensor dst = compute_depth_convert(shape, dt, DataType::F32, policy, 0, fixed_point_position);
429
430 // Compute reference
431 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, dt, DataType::F32, policy, 0, fixed_point_position);
432
433 // Validate output
434 validate(CLAccessor(dst), ref_dst);
435}
436
437BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
438BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ DataType::QS8, DataType::QS16 })
439 * boost::unit_test::data::make({ ConvertPolicy::SATURATE }) * boost::unit_test::data::xrange(1, 7, 1),
440 shape, dt, policy, fixed_point_position)
441{
442 // Compute function
443 CLTensor dst = compute_depth_convert(shape, dt, DataType::F32, policy, 0, fixed_point_position);
444
445 // Compute reference
446 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, dt, DataType::F32, policy, 0, fixed_point_position);
447
448 // Validate output
449 validate(CLAccessor(dst), ref_dst);
450}
451BOOST_AUTO_TEST_SUITE_END()
452
453BOOST_AUTO_TEST_SUITE(F32_to_Quantized)
454BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
455BOOST_DATA_TEST_CASE(Configuration, (SmallShapes() + LargeShapes()) * boost::unit_test::data::make({ DataType::QS8, DataType::QS16 })
456 * boost::unit_test::data::make({ ConvertPolicy::SATURATE }) * boost::unit_test::data::xrange(1, 7, 1),
457 shape, dt, policy, fixed_point_position)
458{
459 // Compute configure and validate region/padding
460 compute_configure_validate(shape, DataType::F32, dt, policy, 0, fixed_point_position);
461}
462
463BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
464BOOST_DATA_TEST_CASE(RunSmall, SmallShapes() * boost::unit_test::data::make({ DataType::QS8, DataType::QS16 })
465 * boost::unit_test::data::make({ ConvertPolicy::SATURATE }) * boost::unit_test::data::xrange(1, 7, 1),
466 shape, dt, policy, fixed_point_position)
467{
468 // Compute function
469 CLTensor dst = compute_depth_convert(shape, DataType::F32, dt, policy, 0, fixed_point_position);
470
471 // Compute reference
Georgios Pinitase2229412017-07-12 12:30:40 +0100472 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::F32, dt, policy, 0, fixed_point_position, fixed_point_position);
steniu01da37e2f2017-06-29 10:14:58 +0100473
474 // Validate output
475 validate(CLAccessor(dst), ref_dst);
476}
477
478BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly"))
479BOOST_DATA_TEST_CASE(RunLarge, LargeShapes() * boost::unit_test::data::make({ DataType::QS8, DataType::QS16 })
480 * boost::unit_test::data::make({ ConvertPolicy::SATURATE }) * boost::unit_test::data::xrange(1, 7, 1),
481 shape, dt, policy, fixed_point_position)
482{
483 // Compute function
484 CLTensor dst = compute_depth_convert(shape, DataType::F32, dt, policy, 0, fixed_point_position);
485
486 // Compute reference
Georgios Pinitase2229412017-07-12 12:30:40 +0100487 RawTensor ref_dst = Reference::compute_reference_depth_convert(shape, DataType::F32, dt, policy, 0, fixed_point_position, fixed_point_position);
steniu01da37e2f2017-06-29 10:14:58 +0100488
489 // Validate output
490 validate(CLAccessor(dst), ref_dst);
491}
492BOOST_AUTO_TEST_SUITE_END()
493
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100494BOOST_AUTO_TEST_SUITE_END()
495BOOST_AUTO_TEST_SUITE_END()
Anthony Barbierac69aa12017-07-03 17:39:37 +0100496#endif /* DOXYGEN_SKIP_THIS */