blob: 5f99cd6d7835471e0117465c5572d6680b30dab7 [file] [log] [blame]
Jakub Sujak8ae57142022-12-02 16:09:06 +00001/*
Gunes Bayircc287732023-01-19 15:56:00 +00002* Copyright (c) 2022-2023 Arm Limited.
Jakub Sujak8ae57142022-12-02 16:09:06 +00003 *
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
25#include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuResize.h"
26
27#include "tests/CL/CLAccessor.h"
28#include "tests/datasets/ScaleValidationDataset.h"
29#include "tests/framework/Asserts.h"
30#include "tests/framework/Fixture.h"
31#include "tests/framework/Macros.h"
32#include "tests/validation/Validation.h"
33#include "tests/validation/fixtures/dynamic_fusion/operators/ResizeFixture.h"
34
35using namespace arm_compute::experimental::dynamic_fusion;
36namespace arm_compute
37{
38namespace test
39{
40namespace validation
41{
42namespace
43{
44using datasets::ScaleShapesBaseDataSet;
45using datasets::ScaleInterpolationPolicySet;
46using datasets::ScaleSamplingPolicySet;
47using datasets::ScaleAlignCornersSamplingPolicySet;
48
49/** We consider vector size in byte 16 since the maximum size of
50 * a vector used by @ref CLScaleKernel is currently 16-byte (float4).
51 */
52constexpr uint32_t vector_byte = 16;
53
54template <typename T>
55constexpr uint32_t num_elements_per_vector()
56{
57 return vector_byte / sizeof(T);
58}
59
60/** Quantization information data set */
61const auto QuantizationInfoSet = framework::dataset::make("QuantizationInfo",
62{
63 QuantizationInfo(0.5f, -1),
64});
65
66/** Tolerance */
67constexpr AbsoluteTolerance<uint8_t> tolerance_q8(1);
68constexpr AbsoluteTolerance<int8_t> tolerance_qs8(1);
69constexpr AbsoluteTolerance<int16_t> tolerance_s16(1);
70constexpr float tolerance_f32_absolute(0.001f);
71
72RelativeTolerance<float> tolerance_f32(0.05);
73constexpr float abs_tolerance_f16(0.1f);
74RelativeTolerance<half> tolerance_f16(half(0.1));
75
76constexpr float tolerance_num_f32(0.01f);
77
78} // namespace
79
80TEST_SUITE(CL)
81TEST_SUITE(DYNAMIC_FUSION)
82TEST_SUITE(RESIZE)
83
84TEST_SUITE(Validate)
85
86const auto default_input_shape = TensorShape{ 2, 3, 3, 2 };
87const auto default_output_shape = TensorShape{ 4, 6, 3, 2 };
88
Gunes Bayircc287732023-01-19 15:56:00 +000089constexpr auto default_data_type = DataType::U8;
90constexpr auto default_data_layout = DataLayout::NHWC;
Jakub Sujak8ae57142022-12-02 16:09:06 +000091
92TEST_CASE(NullPtr, framework::DatasetMode::ALL)
93{
94 const TensorInfo input_info = TensorInfo{ default_input_shape, 1, default_data_type, default_data_layout };
95 const TensorInfo output_info = TensorInfo{ default_output_shape, 1, default_data_type, default_data_layout };
96
97 CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
Viet-Hoa Do3fcf3dc2023-05-17 15:17:48 +010098 GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
99 GpuWorkloadSketch sketch{ &context };
Jakub Sujak8ae57142022-12-02 16:09:06 +0000100
Viet-Hoa Do3fcf3dc2023-05-17 15:17:48 +0100101 const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
Jakub Sujak8ae57142022-12-02 16:09:06 +0000102
103 // nullptr is given as input
Gunes Bayircc287732023-01-19 15:56:00 +0000104 Status status = GpuResize::validate_op(sketch, nullptr, ResizeAttributes());
Jakub Sujak8ae57142022-12-02 16:09:06 +0000105 ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS);
106}
107
108TEST_CASE(SupportDataType, framework::DatasetMode::ALL)
109{
110 const std::map<DataType, bool> supported_data_types =
111 {
112 { DataType::U8, true },
113 { DataType::S8, false },
114 { DataType::QSYMM8, false },
115 { DataType::QASYMM8, true },
116 { DataType::QASYMM8_SIGNED, true },
117 { DataType::QSYMM8_PER_CHANNEL, false },
118 { DataType::U16, false },
119 { DataType::S16, true },
120 { DataType::QSYMM16, false },
121 { DataType::QASYMM16, false },
122 { DataType::U32, false },
123 { DataType::S32, false },
124 { DataType::U64, false },
125 { DataType::S64, false },
126 { DataType::BFLOAT16, false },
127 { DataType::F16, true },
128 { DataType::F32, true },
129 { DataType::F64, false },
130 { DataType::SIZET, false },
131 };
132
133 for(auto &kv : supported_data_types)
134 {
Gunes Bayircc287732023-01-19 15:56:00 +0000135 const TensorInfo input_info = TensorInfo{ default_input_shape, 1, kv.first, default_data_layout };
Jakub Sujak8ae57142022-12-02 16:09:06 +0000136
137 CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
Viet-Hoa Do3fcf3dc2023-05-17 15:17:48 +0100138 GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
139 GpuWorkloadSketch sketch{ &context };
Jakub Sujak8ae57142022-12-02 16:09:06 +0000140
Viet-Hoa Do3fcf3dc2023-05-17 15:17:48 +0100141 const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
Jakub Sujak8ae57142022-12-02 16:09:06 +0000142
Gunes Bayircc287732023-01-19 15:56:00 +0000143 ResizeAttributes attributes;
144 attributes.output_width(default_output_shape[0]); // shape is not important unless it's empty
145 attributes.output_height(default_output_shape[1]);
146
147 Status status = GpuResize::validate_op(sketch, &sketch_input_info, attributes);
Jakub Sujak8ae57142022-12-02 16:09:06 +0000148 ARM_COMPUTE_EXPECT(bool(status) == kv.second, framework::LogLevel::ERRORS);
149 }
150}
151
152TEST_CASE(MismatchingDataType, framework::DatasetMode::ALL)
153{
154 constexpr DataType non_default_data_type = DataType::F32;
155
156 const TensorInfo input_info = TensorInfo{ default_input_shape, 1, default_data_type, default_data_layout };
157 const TensorInfo output_info = TensorInfo{ default_output_shape, 1, non_default_data_type, default_data_layout };
158
159 CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
Viet-Hoa Do3fcf3dc2023-05-17 15:17:48 +0100160 GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
161 GpuWorkloadSketch sketch{ &context };
Jakub Sujak8ae57142022-12-02 16:09:06 +0000162
Viet-Hoa Do3fcf3dc2023-05-17 15:17:48 +0100163 const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
Jakub Sujak8ae57142022-12-02 16:09:06 +0000164
Gunes Bayircc287732023-01-19 15:56:00 +0000165 Status status = GpuResize::validate_op(sketch, &sketch_input_info, ResizeAttributes());
Jakub Sujak8ae57142022-12-02 16:09:06 +0000166 ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS);
167}
168
169TEST_CASE(AlignedCornerNotSupported, framework::DatasetMode::ALL)
170{
171 // Aligned corners require sampling policy to be TOP_LEFT.
172 constexpr InterpolationPolicy interpolation_policy = InterpolationPolicy::BILINEAR;
173 constexpr bool align_corners = true;
174 constexpr SamplingPolicy sampling_policy = SamplingPolicy::CENTER;
175
176 const TensorInfo input_info = TensorInfo{ default_input_shape, 1, default_data_type, default_data_layout };
177 const TensorInfo output_info = TensorInfo{ default_output_shape, 1, default_data_type, default_data_layout };
178
179 CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
Viet-Hoa Do3fcf3dc2023-05-17 15:17:48 +0100180 GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
181 GpuWorkloadSketch sketch{ &context };
Jakub Sujak8ae57142022-12-02 16:09:06 +0000182
Viet-Hoa Do3fcf3dc2023-05-17 15:17:48 +0100183 const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
Jakub Sujak8ae57142022-12-02 16:09:06 +0000184
185 ResizeAttributes attributes{};
186 attributes.interpolation_policy(interpolation_policy)
187 .sampling_policy(sampling_policy)
188 .align_corners(align_corners);
189
Gunes Bayircc287732023-01-19 15:56:00 +0000190 Status status = GpuResize::validate_op(sketch, &sketch_input_info, attributes);
Jakub Sujak8ae57142022-12-02 16:09:06 +0000191 ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS);
192}
193
194TEST_CASE(UnsupportedInterpolationPolicy, framework::DatasetMode::ALL)
195{
196 const TensorInfo input_info = TensorInfo{ TensorShape(28U, 33U, 2U), 1, DataType::F32, default_data_layout };
197 const TensorInfo output_info = TensorInfo{ TensorShape(26U, 21U, 2U), 1, DataType::F32, default_data_layout };
198 constexpr auto interpolation_policy = InterpolationPolicy::AREA;
199
200 CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
Viet-Hoa Do3fcf3dc2023-05-17 15:17:48 +0100201 GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
202 GpuWorkloadSketch sketch{ &context };
Jakub Sujak8ae57142022-12-02 16:09:06 +0000203
Viet-Hoa Do3fcf3dc2023-05-17 15:17:48 +0100204 const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
Jakub Sujak8ae57142022-12-02 16:09:06 +0000205
206 ResizeAttributes attributes{};
207 attributes.interpolation_policy(interpolation_policy);
208
Gunes Bayircc287732023-01-19 15:56:00 +0000209 Status status = GpuResize::validate_op(sketch, &sketch_input_info, attributes);
Jakub Sujak8ae57142022-12-02 16:09:06 +0000210 ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS);
211}
212
213TEST_CASE(UnsupportedLayout, framework::DatasetMode::ALL)
214{
215 const TensorInfo input_info = TensorInfo{ default_input_shape, 1, default_data_type, DataLayout::NCHW };
216 const TensorInfo output_info = TensorInfo{ default_output_shape, 1, default_data_type, DataLayout::NCHW };
217 constexpr auto interpolation_policy = InterpolationPolicy::BILINEAR;
218
219 CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
Viet-Hoa Do3fcf3dc2023-05-17 15:17:48 +0100220 GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
221 GpuWorkloadSketch sketch{ &context };
Jakub Sujak8ae57142022-12-02 16:09:06 +0000222
Viet-Hoa Do3fcf3dc2023-05-17 15:17:48 +0100223 const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
Jakub Sujak8ae57142022-12-02 16:09:06 +0000224
225 ResizeAttributes attributes{};
226 attributes.interpolation_policy(interpolation_policy);
227
Gunes Bayircc287732023-01-19 15:56:00 +0000228 Status status = GpuResize::validate_op(sketch, &sketch_input_info, attributes);
Jakub Sujak8ae57142022-12-02 16:09:06 +0000229 ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS);
230}
231
232TEST_SUITE_END() // Validate
233
234template <typename T>
235using DynamicFusionResizeFixture = DynamicFusionResizeValidationFixture<CLTensor, CLAccessor, GpuResize, T>;
236
237TEST_SUITE(Float)
238TEST_SUITE(FP32)
239
240const auto f32_shape = combine((SCALE_PRECOMMIT_SHAPE_DATASET(num_elements_per_vector<float>())), framework::dataset::make("DataType", DataType::F32));
241
242FIXTURE_DATA_TEST_CASE(Run, DynamicFusionResizeFixture<float>, framework::DatasetMode::ALL, ASSEMBLE_DATASET_DYNAMIC_FUSION(f32_shape, ScaleSamplingPolicySet))
243{
244 //Create valid region
245 TensorInfo src_info(_shape, 1, _data_type);
246 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
247
248 // Validate output
249 validate(CLAccessor(_target), _reference, valid_region, tolerance_f32, tolerance_num_f32, tolerance_f32_absolute);
250}
251
252FIXTURE_DATA_TEST_CASE(RunAlignCorners, DynamicFusionResizeFixture<float>, framework::DatasetMode::ALL, ASSEMBLE_DATASET_DYNAMIC_FUSION(f32_shape, ScaleAlignCornersSamplingPolicySet))
253{
254 //Create valid region
255 TensorInfo src_info(_shape, 1, _data_type);
256 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
257
258 // Validate output
259 validate(CLAccessor(_target), _reference, valid_region, tolerance_f32, tolerance_num_f32, tolerance_f32_absolute);
260}
261const auto f32_nightly_shape = combine((SCALE_NIGHTLY_SHAPE_DATASET(num_elements_per_vector<float>())), framework::dataset::make("DataType", DataType::F32));
262FIXTURE_DATA_TEST_CASE(RunNightly, DynamicFusionResizeFixture<float>, framework::DatasetMode::NIGHTLY, ASSEMBLE_DATASET_DYNAMIC_FUSION(f32_nightly_shape, ScaleSamplingPolicySet))
263{
264 //Create valid region
265 TensorInfo src_info(_shape, 1, _data_type);
266 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
267
268 // Validate output
269 validate(CLAccessor(_target), _reference, valid_region, tolerance_f32, tolerance_num_f32, tolerance_f32_absolute);
270}
271FIXTURE_DATA_TEST_CASE(RunNightlyAlignCorners, DynamicFusionResizeFixture<float>, framework::DatasetMode::NIGHTLY, ASSEMBLE_DATASET_DYNAMIC_FUSION(f32_nightly_shape,
272 ScaleAlignCornersSamplingPolicySet))
273{
274 //Create valid region
275 TensorInfo src_info(_shape, 1, _data_type);
276 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
277
278 // Validate output
279 validate(CLAccessor(_target), _reference, valid_region, tolerance_f32, tolerance_num_f32, tolerance_f32_absolute);
280}
281TEST_SUITE_END() // FP32
282
283TEST_SUITE(FP16)
284const auto f16_shape = combine((SCALE_PRECOMMIT_SHAPE_DATASET(num_elements_per_vector<half>())), framework::dataset::make("DataType", DataType::F16));
285FIXTURE_DATA_TEST_CASE(Run, DynamicFusionResizeFixture<half>, framework::DatasetMode::ALL, ASSEMBLE_DATASET_DYNAMIC_FUSION(f16_shape, ScaleSamplingPolicySet))
286{
287 //Create valid region
288 TensorInfo src_info(_shape, 1, _data_type);
289 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
290
291 // Validate output
292 validate(CLAccessor(_target), _reference, valid_region, tolerance_f16, 0.0f, abs_tolerance_f16);
293}
294FIXTURE_DATA_TEST_CASE(RunAlignCorners, DynamicFusionResizeFixture<half>, framework::DatasetMode::ALL, ASSEMBLE_DATASET_DYNAMIC_FUSION(f16_shape, ScaleAlignCornersSamplingPolicySet))
295{
296 //Create valid region
297 TensorInfo src_info(_shape, 1, _data_type);
298 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
299
300 // Validate output
301 validate(CLAccessor(_target), _reference, valid_region, tolerance_f16, 0.0f, abs_tolerance_f16);
302}
303const auto f16_nightly_shape = combine((SCALE_NIGHTLY_SHAPE_DATASET(num_elements_per_vector<half>())), framework::dataset::make("DataType", DataType::F16));
304FIXTURE_DATA_TEST_CASE(RunNightly, DynamicFusionResizeFixture<half>, framework::DatasetMode::NIGHTLY, ASSEMBLE_DATASET_DYNAMIC_FUSION(f16_nightly_shape, ScaleSamplingPolicySet))
305{
306 //Create valid region
307 TensorInfo src_info(_shape, 1, _data_type);
308 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
309
310 // Validate output
311 validate(CLAccessor(_target), _reference, valid_region, tolerance_f16, 0.0f, abs_tolerance_f16);
312}
313FIXTURE_DATA_TEST_CASE(RunNightlyAlignCorners, DynamicFusionResizeFixture<half>, framework::DatasetMode::NIGHTLY, ASSEMBLE_DATASET_DYNAMIC_FUSION(f16_nightly_shape,
314 ScaleAlignCornersSamplingPolicySet))
315{
316 //Create valid region
317 TensorInfo src_info(_shape, 1, _data_type);
318 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
319
320 // Validate output
321 validate(CLAccessor(_target), _reference, valid_region, tolerance_f16, 0.0f, abs_tolerance_f16);
322}
323TEST_SUITE_END() // FP16
324TEST_SUITE_END() // Float
325
326TEST_SUITE(Integer)
327TEST_SUITE(U8)
328const auto u8_shape = combine((SCALE_PRECOMMIT_SHAPE_DATASET(num_elements_per_vector<uint8_t>())), framework::dataset::make("DataType", DataType::U8));
329FIXTURE_DATA_TEST_CASE(Run, DynamicFusionResizeFixture<uint8_t>, framework::DatasetMode::ALL, ASSEMBLE_DATASET_DYNAMIC_FUSION(u8_shape, ScaleSamplingPolicySet))
330{
331 //Create valid region
332 TensorInfo src_info(_shape, 1, _data_type);
333 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
334
335 // Validate output
336 validate(CLAccessor(_target), _reference, valid_region, tolerance_q8);
337}
338FIXTURE_DATA_TEST_CASE(RunAlignCorners, DynamicFusionResizeFixture<uint8_t>, framework::DatasetMode::ALL, ASSEMBLE_DATASET_DYNAMIC_FUSION(u8_shape, ScaleAlignCornersSamplingPolicySet))
339{
340 //Create valid region
341 TensorInfo src_info(_shape, 1, _data_type);
342 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
343
344 // Validate output
345 validate(CLAccessor(_target), _reference, valid_region, tolerance_q8);
346}
347const auto u8_nightly_shape = combine((SCALE_NIGHTLY_SHAPE_DATASET(num_elements_per_vector<uint8_t>())), framework::dataset::make("DataType", DataType::U8));
348FIXTURE_DATA_TEST_CASE(RunNightly, DynamicFusionResizeFixture<uint8_t>, framework::DatasetMode::NIGHTLY, ASSEMBLE_DATASET_DYNAMIC_FUSION(u8_nightly_shape, ScaleSamplingPolicySet))
349{
350 //Create valid region
351 TensorInfo src_info(_shape, 1, _data_type);
352 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
353
354 // Validate output
355 validate(CLAccessor(_target), _reference, valid_region, tolerance_q8);
356}
357FIXTURE_DATA_TEST_CASE(RunNightlyAlignCorners, DynamicFusionResizeFixture<uint8_t>, framework::DatasetMode::NIGHTLY, ASSEMBLE_DATASET_DYNAMIC_FUSION(u8_nightly_shape,
358 ScaleAlignCornersSamplingPolicySet))
359{
360 //Create valid region
361 TensorInfo src_info(_shape, 1, _data_type);
362 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
363
364 // Validate output
365 validate(CLAccessor(_target), _reference, valid_region, tolerance_q8);
366}
367TEST_SUITE_END() // U8
368
369TEST_SUITE(S16)
370const auto s16_shape = combine((SCALE_PRECOMMIT_SHAPE_DATASET(num_elements_per_vector<int16_t>())), framework::dataset::make("DataType", DataType::S16));
371FIXTURE_DATA_TEST_CASE(Run, DynamicFusionResizeFixture<int16_t>, framework::DatasetMode::ALL, ASSEMBLE_DATASET_DYNAMIC_FUSION(s16_shape, ScaleSamplingPolicySet))
372{
373 //Create valid region
374 TensorInfo src_info(_shape, 1, _data_type);
375 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
376
377 // Validate output
378 validate(CLAccessor(_target), _reference, valid_region, tolerance_s16);
379}
380FIXTURE_DATA_TEST_CASE(RunAlignCorners, DynamicFusionResizeFixture<int16_t>, framework::DatasetMode::ALL, ASSEMBLE_DATASET_DYNAMIC_FUSION(s16_shape, ScaleAlignCornersSamplingPolicySet))
381{
382 //Create valid region
383 TensorInfo src_info(_shape, 1, _data_type);
384 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
385
386 // Validate output
387 validate(CLAccessor(_target), _reference, valid_region, tolerance_s16);
388}
389const auto s16_nightly_shape = combine((SCALE_NIGHTLY_SHAPE_DATASET(num_elements_per_vector<int16_t>())), framework::dataset::make("DataType", DataType::S16));
390FIXTURE_DATA_TEST_CASE(RunNightly, DynamicFusionResizeFixture<int16_t>, framework::DatasetMode::NIGHTLY, ASSEMBLE_DATASET_DYNAMIC_FUSION(s16_nightly_shape, ScaleSamplingPolicySet))
391{
392 //Create valid region
393 TensorInfo src_info(_shape, 1, _data_type);
394 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
395
396 // Validate output
397 validate(CLAccessor(_target), _reference, valid_region, tolerance_s16);
398}
399FIXTURE_DATA_TEST_CASE(RunNightlyAlignCorners, DynamicFusionResizeFixture<int16_t>, framework::DatasetMode::NIGHTLY, ASSEMBLE_DATASET_DYNAMIC_FUSION(s16_nightly_shape,
400 ScaleAlignCornersSamplingPolicySet))
401{
402 //Create valid region
403 TensorInfo src_info(_shape, 1, _data_type);
404 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
405
406 // Validate output
407 validate(CLAccessor(_target), _reference, valid_region, tolerance_s16);
408}
409TEST_SUITE_END() // S16
410TEST_SUITE_END() // Integer
411
412template <typename T>
413using DynamicFusionResizeQuantizedFixture = DynamicFusionResizeQuantizedValidationFixture<CLTensor, CLAccessor, GpuResize, T>;
414TEST_SUITE(Quantized)
415TEST_SUITE(QASYMM8)
416const auto qasymm8_shape = combine((SCALE_PRECOMMIT_SHAPE_DATASET(num_elements_per_vector<uint8_t>())), framework::dataset::make("DataType", DataType::QASYMM8));
417FIXTURE_DATA_TEST_CASE(Run, DynamicFusionResizeQuantizedFixture<uint8_t>, framework::DatasetMode::ALL, ASSEMBLE_QUANTIZED_DATASET_DYNAMIC_FUSION(qasymm8_shape, ScaleSamplingPolicySet,
418 QuantizationInfoSet))
419{
420 //Create valid region
421 TensorInfo src_info(_shape, 1, _data_type);
422 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
423
424 // Validate output
425 validate(CLAccessor(_target), _reference, valid_region, tolerance_q8);
426}
427FIXTURE_DATA_TEST_CASE(RunAlignCorners, DynamicFusionResizeQuantizedFixture<uint8_t>, framework::DatasetMode::ALL, ASSEMBLE_QUANTIZED_DATASET_DYNAMIC_FUSION(qasymm8_shape,
428 ScaleAlignCornersSamplingPolicySet,
429 QuantizationInfoSet))
430{
431 //Create valid region
432 TensorInfo src_info(_shape, 1, _data_type);
433 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
434
435 // Validate output
436 validate(CLAccessor(_target), _reference, valid_region, tolerance_q8);
437}
438const auto qasymm8_nightly_shape = combine((SCALE_NIGHTLY_SHAPE_DATASET(num_elements_per_vector<uint8_t>())), framework::dataset::make("DataType", DataType::QASYMM8));
439FIXTURE_DATA_TEST_CASE(RunNightly, DynamicFusionResizeQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, ASSEMBLE_QUANTIZED_DATASET_DYNAMIC_FUSION(qasymm8_nightly_shape,
440 ScaleSamplingPolicySet,
441 QuantizationInfoSet))
442{
443 //Create valid region
444 TensorInfo src_info(_shape, 1, _data_type);
445 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
446
447 // Validate output
448 validate(CLAccessor(_target), _reference, valid_region, tolerance_q8);
449}
450FIXTURE_DATA_TEST_CASE(RunNightlyAlignCorners, DynamicFusionResizeQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, ASSEMBLE_QUANTIZED_DATASET_DYNAMIC_FUSION(qasymm8_nightly_shape,
451 ScaleAlignCornersSamplingPolicySet,
452 QuantizationInfoSet))
453{
454 //Create valid region
455 TensorInfo src_info(_shape, 1, _data_type);
456 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
457
458 // Validate output
459 validate(CLAccessor(_target), _reference, valid_region, tolerance_q8);
460}
461TEST_SUITE_END() // QASYMM8
462
463TEST_SUITE(QASYMM8_SIGNED)
464const auto qasymm8_signed_shape = combine((SCALE_PRECOMMIT_SHAPE_DATASET(num_elements_per_vector<int8_t>())), framework::dataset::make("DataType", DataType::QASYMM8_SIGNED));
465FIXTURE_DATA_TEST_CASE(Run, DynamicFusionResizeQuantizedFixture<int8_t>, framework::DatasetMode::ALL, ASSEMBLE_QUANTIZED_DATASET_DYNAMIC_FUSION(qasymm8_signed_shape, ScaleSamplingPolicySet,
466 QuantizationInfoSet))
467{
468 //Create valid region
469 TensorInfo src_info(_shape, 1, _data_type);
470 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
471
472 // Validate output
473 validate(CLAccessor(_target), _reference, valid_region, tolerance_qs8);
474}
475FIXTURE_DATA_TEST_CASE(RunAlignCorners, DynamicFusionResizeQuantizedFixture<int8_t>, framework::DatasetMode::ALL, ASSEMBLE_QUANTIZED_DATASET_DYNAMIC_FUSION(qasymm8_signed_shape,
476 ScaleAlignCornersSamplingPolicySet,
477 QuantizationInfoSet))
478{
479 //Create valid region
480 TensorInfo src_info(_shape, 1, _data_type);
481 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
482
483 // Validate output
484 validate(CLAccessor(_target), _reference, valid_region, tolerance_qs8);
485}
486const auto qasymm8_signed_nightly_shape = combine((SCALE_NIGHTLY_SHAPE_DATASET(num_elements_per_vector<int8_t>())), framework::dataset::make("DataType", DataType::QASYMM8_SIGNED));
487FIXTURE_DATA_TEST_CASE(RunNightly, DynamicFusionResizeQuantizedFixture<int8_t>, framework::DatasetMode::NIGHTLY, ASSEMBLE_QUANTIZED_DATASET_DYNAMIC_FUSION(qasymm8_signed_nightly_shape,
488 ScaleSamplingPolicySet,
489 QuantizationInfoSet))
490{
491 //Create valid region
492 TensorInfo src_info(_shape, 1, _data_type);
493 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
494
495 // Validate output
496 validate(CLAccessor(_target), _reference, valid_region, tolerance_qs8);
497}
498FIXTURE_DATA_TEST_CASE(RunNightlyAlignCorners, DynamicFusionResizeQuantizedFixture<int8_t>, framework::DatasetMode::NIGHTLY, ASSEMBLE_QUANTIZED_DATASET_DYNAMIC_FUSION(qasymm8_signed_nightly_shape,
499 ScaleAlignCornersSamplingPolicySet,
500 QuantizationInfoSet))
501{
502 //Create valid region
503 TensorInfo src_info(_shape, 1, _data_type);
504 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false);
505
506 // Validate output
507 validate(CLAccessor(_target), _reference, valid_region, tolerance_qs8);
508}
509TEST_SUITE_END() // QASYMM8_SIGNED
510
511TEST_SUITE_END() // Quantized
512
513TEST_SUITE_END() // RESIZE
514TEST_SUITE_END() // DYNAMIC_FUSION
515TEST_SUITE_END() // CL
516
517} // namespace validation
518} // namespace test
519} // namespace arm_compute