blob: 0d9c8e1f8cd69444eecf8de457da6d3852eae64f [file] [log] [blame]
Isabella Gottardi1fab09f2017-07-13 15:55:57 +01001/*
Diego Lopez Recasff860cf2018-02-22 13:08:01 +00002 * Copyright (c) 2017-2018 ARM Limited.
Isabella Gottardi1fab09f2017-07-13 15:55:57 +01003 *
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/Helpers.h"
25#include "arm_compute/core/Types.h"
26#include "arm_compute/runtime/NEON/functions/NEScale.h"
27#include "arm_compute/runtime/Tensor.h"
28#include "arm_compute/runtime/TensorAllocator.h"
Isabella Gottardi1fab09f2017-07-13 15:55:57 +010029#include "tests/NEON/Accessor.h"
30#include "tests/PaddingCalculator.h"
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010031#include "tests/datasets/BorderModeDataset.h"
32#include "tests/datasets/InterpolationPolicyDataset.h"
Daniil Efremov02bf80d2017-11-22 00:26:51 +070033#include "tests/datasets/SamplingPolicyDataset.h"
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010034#include "tests/datasets/ShapeDatasets.h"
35#include "tests/framework/Asserts.h"
36#include "tests/framework/Macros.h"
37#include "tests/framework/datasets/Datasets.h"
38#include "tests/validation/Helpers.h"
39#include "tests/validation/Validation.h"
40#include "tests/validation/fixtures/ScaleFixture.h"
Isabella Gottardi1fab09f2017-07-13 15:55:57 +010041
42namespace arm_compute
43{
44namespace test
45{
46namespace validation
47{
Isabella Gottardi732f3682017-09-05 14:10:12 +010048namespace
49{
Georgios Pinitas583137c2017-08-31 18:12:42 +010050/** Scale data types */
51const auto ScaleDataTypes = framework::dataset::make("DataType",
52{
53 DataType::U8,
54 DataType::S16,
55 DataType::F32,
56});
57
Georgios Pinitas393fa4c2018-05-08 15:54:53 +010058/** Scale data types */
59const auto ScaleDataLayouts = framework::dataset::make("DataLayout",
60{
61 DataLayout::NCHW,
62 DataLayout::NHWC,
63});
64
Georgios Pinitas583137c2017-08-31 18:12:42 +010065/** Tolerance */
Georgios Pinitas99d4f4a2017-09-19 16:51:42 +010066constexpr AbsoluteTolerance<uint8_t> tolerance_u8(1);
67constexpr AbsoluteTolerance<int16_t> tolerance_s16(1);
Georgios Pinitas583137c2017-08-31 18:12:42 +010068RelativeTolerance<float> tolerance_f32(0.01);
Georgios Pinitasc47ef202018-11-16 18:19:43 +000069#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
70RelativeTolerance<half> tolerance_f16(half(0.1));
71#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
Moritz Pflanzerff1c3602017-09-22 12:41:25 +010072
73constexpr float tolerance_num_s16 = 0.01f;
74constexpr float tolerance_num_f32 = 0.01f;
Isabella Gottardi732f3682017-09-05 14:10:12 +010075} // namespace
76
Isabella Gottardi1fab09f2017-07-13 15:55:57 +010077TEST_SUITE(NEON)
78TEST_SUITE(Scale)
79
Georgios Pinitas20b43132018-05-14 16:05:23 +010080// *INDENT-OFF*
81// clang-format off
82DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +010083 framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::U8), // Mismatching data type
84 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Unsupported sampling point
85 TensorInfo(TensorShape(4U, 27U, 13U), 1, DataType::F32), // Invalid policy
86 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Insufficient padding
87 TensorInfo(TensorShape(4U, 27U, 13U), 1, DataType::F32),
Georgios Pinitas20b43132018-05-14 16:05:23 +010088 }),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +010089 framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(132U, 25U, 2U), 1, DataType::F32),
90 TensorInfo(TensorShape(132U, 25U, 2U), 1, DataType::F32),
91 TensorInfo(TensorShape(4U, 132U, 25U), 1, DataType::F32),
92 TensorInfo(TensorShape(132U, 25U, 2U), 1, DataType::F32),
93 TensorInfo(TensorShape(4U, 132U, 25U), 1, DataType::F32),
Georgios Pinitas20b43132018-05-14 16:05:23 +010094 })),
95 framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR,
96 InterpolationPolicy::NEAREST_NEIGHBOR,
97 InterpolationPolicy::AREA,
98 InterpolationPolicy::AREA,
99 InterpolationPolicy::NEAREST_NEIGHBOR,
100 })),
101 framework::dataset::make("BorderMode", { BorderMode::UNDEFINED,
102 BorderMode::UNDEFINED,
103 BorderMode::UNDEFINED,
104 BorderMode::UNDEFINED,
105 BorderMode::REPLICATE,
106 })),
107 framework::dataset::make("SamplingPolicy", { SamplingPolicy::CENTER,
108 SamplingPolicy::TOP_LEFT,
109 SamplingPolicy::CENTER,
110 SamplingPolicy::CENTER,
111 SamplingPolicy::CENTER,
112 })),
113 framework::dataset::make("DataLayout", { DataLayout::NCHW,
114 DataLayout::NCHW,
115 DataLayout::NHWC,
116 DataLayout::NCHW,
117 DataLayout::NHWC,
118 })),
119 framework::dataset::make("Expected", { false, false, false, false ,true })),
120 input_info, output_info, policy,border_mode, sampling_policy, data_layout, expected)
121{
122 const PixelValue constant_border(5);
123 Status status = NEScale::validate(&input_info.clone()->set_is_resizable(false).set_data_layout(data_layout),
124 &output_info.clone()->set_is_resizable(false).set_data_layout(data_layout),
125 policy, border_mode, constant_border, sampling_policy);
126 ARM_COMPUTE_EXPECT(bool(status) == expected, framework::LogLevel::ERRORS);
127}
128// clang-format on
129// *INDENT-ON*
130
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100131DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), ScaleDataTypes), ScaleDataLayouts),
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700132 framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
133 datasets::BorderModes()),
134 framework::dataset::make("SamplingPolicy", { SamplingPolicy::CENTER })),
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100135 shape, data_type, data_layout, policy, border_mode, sampling_policy)
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100136{
137 std::mt19937 generator(library->seed());
138 std::uniform_real_distribution<float> distribution_float(0.25, 2);
139 const float scale_x = distribution_float(generator);
140 const float scale_y = distribution_float(generator);
141 uint8_t constant_border_value = 0;
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100142 TensorShape src_shape = shape;
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100143 if(border_mode == BorderMode::CONSTANT)
144 {
145 std::uniform_int_distribution<uint8_t> distribution_u8(0, 255);
146 constant_border_value = distribution_u8(generator);
147 }
148
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100149 // Get width/height indices depending on layout
150 const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
151 const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
152
153 // Change shape in case of NHWC.
154 if(data_layout == DataLayout::NHWC)
155 {
156 permute(src_shape, PermutationVector(2U, 0U, 1U));
157 }
158
159 // Calculate scaled shape
160 TensorShape shape_scaled(src_shape);
161 shape_scaled.set(idx_width, src_shape[idx_width] * scale_x);
162 shape_scaled.set(idx_height, src_shape[idx_height] * scale_y);
163
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100164 // Create tensors
Vidhya Sudhan Loganathan014333d2018-07-02 09:13:49 +0100165 Tensor src = create_tensor<Tensor>(src_shape, data_type, 1, QuantizationInfo(), data_layout);
166 Tensor dst = create_tensor<Tensor>(shape_scaled, data_type, 1, QuantizationInfo(), data_layout);
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100167
168 ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
169 ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
170
171 // Create and configure function
172 NEScale nescale;
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700173 nescale.configure(&src, &dst, policy, border_mode, constant_border_value, sampling_policy);
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100174
175 // Validate valid region
Diego Lopez Recas00854292018-02-22 13:08:01 +0000176 const ValidRegion dst_valid_region = calculate_valid_region_scale(*(src.info()), shape_scaled, policy, sampling_policy, (border_mode == BorderMode::UNDEFINED));
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100177 validate(dst.info()->valid_region(), dst_valid_region);
178
179 // Validate padding
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100180 int num_elements_processed_x = 16;
181 if(data_layout == DataLayout::NHWC)
182 {
183 num_elements_processed_x = (policy == InterpolationPolicy::BILINEAR) ? 1 : 16 / src.info()->element_size();
184 }
185 PaddingCalculator calculator(shape_scaled.x(), num_elements_processed_x);
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100186 calculator.set_border_mode(border_mode);
187
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100188 PaddingSize read_padding(1);
189 if(data_layout == DataLayout::NHWC)
190 {
191 read_padding = calculator.required_padding(PaddingCalculator::Option::EXCLUDE_BORDER);
192 if(border_mode == BorderMode::CONSTANT && policy == InterpolationPolicy::BILINEAR)
193 {
194 read_padding.top = 1;
195 }
196 }
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100197 const PaddingSize write_padding = calculator.required_padding(PaddingCalculator::Option::EXCLUDE_BORDER);
198 validate(src.info()->padding(), read_padding);
199 validate(dst.info()->padding(), write_padding);
200}
201
202template <typename T>
203using NEScaleFixture = ScaleValidationFixture<Tensor, Accessor, NEScale, T>;
204
Georgios Pinitas583137c2017-08-31 18:12:42 +0100205TEST_SUITE(Float)
206TEST_SUITE(FP32)
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100207FIXTURE_DATA_TEST_CASE(RunSmall, NEScaleFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700208 DataType::F32)),
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100209 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700210 framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
211 datasets::BorderModes()),
212 framework::dataset::make("SamplingPolicy", { SamplingPolicy::CENTER })))
Georgios Pinitas583137c2017-08-31 18:12:42 +0100213{
214 //Create valid region
215 TensorInfo src_info(_shape, 1, _data_type);
Diego Lopez Recas00854292018-02-22 13:08:01 +0000216 ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _policy, _sampling_policy, (_border_mode == BorderMode::UNDEFINED));
Georgios Pinitas583137c2017-08-31 18:12:42 +0100217
218 // Validate output
Moritz Pflanzerff1c3602017-09-22 12:41:25 +0100219 validate(Accessor(_target), _reference, valid_region, tolerance_f32, tolerance_num_f32);
Georgios Pinitas583137c2017-08-31 18:12:42 +0100220}
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100221FIXTURE_DATA_TEST_CASE(RunLarge, NEScaleFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
Georgios Pinitas583137c2017-08-31 18:12:42 +0100222 DataType::F32)),
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100223 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700224 framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
225 datasets::BorderModes()),
226 framework::dataset::make("SamplingPolicy", { SamplingPolicy::CENTER })))
Georgios Pinitas583137c2017-08-31 18:12:42 +0100227{
228 //Create valid region
229 TensorInfo src_info(_shape, 1, _data_type);
Diego Lopez Recas00854292018-02-22 13:08:01 +0000230 ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _policy, _sampling_policy, (_border_mode == BorderMode::UNDEFINED));
Georgios Pinitas583137c2017-08-31 18:12:42 +0100231
232 // Validate output
Moritz Pflanzerff1c3602017-09-22 12:41:25 +0100233 validate(Accessor(_target), _reference, valid_region, tolerance_f32, tolerance_num_f32);
Georgios Pinitas583137c2017-08-31 18:12:42 +0100234}
235TEST_SUITE_END()
Georgios Pinitasc47ef202018-11-16 18:19:43 +0000236#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
237TEST_SUITE(FP16)
238FIXTURE_DATA_TEST_CASE(RunSmall, NEScaleFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
239 DataType::F16)),
240 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
241 framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
242 datasets::BorderModes()),
243 framework::dataset::make("SamplingPolicy", { SamplingPolicy::CENTER })))
244{
245 //Create valid region
246 TensorInfo src_info(_shape, 1, _data_type);
247 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _policy, _sampling_policy, (_border_mode == BorderMode::UNDEFINED));
248
249 // Validate output
250 validate(Accessor(_target), _reference, valid_region, tolerance_f16);
251}
252FIXTURE_DATA_TEST_CASE(RunLarge, NEScaleFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
253 DataType::F16)),
254 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
255 framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
256 datasets::BorderModes()),
257 framework::dataset::make("SamplingPolicy", { SamplingPolicy::CENTER })))
258{
259 //Create valid region
260 TensorInfo src_info(_shape, 1, _data_type);
261 const ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _policy, _sampling_policy, (_border_mode == BorderMode::UNDEFINED));
262
263 // Validate output
264 validate(Accessor(_target), _reference, valid_region, tolerance_f16);
265}
266TEST_SUITE_END() // FP16
267#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
Georgios Pinitas583137c2017-08-31 18:12:42 +0100268TEST_SUITE_END()
269
270TEST_SUITE(Integer)
271TEST_SUITE(U8)
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100272FIXTURE_DATA_TEST_CASE(RunSmall, NEScaleFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700273 DataType::U8)),
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100274 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700275 framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
276 datasets::BorderModes()),
277 framework::dataset::make("SamplingPolicy", { SamplingPolicy::CENTER })))
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100278{
279 //Create valid region
280 TensorInfo src_info(_shape, 1, _data_type);
Diego Lopez Recas00854292018-02-22 13:08:01 +0000281 ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _policy, _sampling_policy, (_border_mode == BorderMode::UNDEFINED));
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100282
283 // Validate output
Georgios Pinitas99d4f4a2017-09-19 16:51:42 +0100284 validate(Accessor(_target), _reference, valid_region, tolerance_u8);
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100285}
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100286FIXTURE_DATA_TEST_CASE(RunLarge, NEScaleFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100287 DataType::U8)),
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100288 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700289 framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
290 datasets::BorderModes()),
291 framework::dataset::make("SamplingPolicy", { SamplingPolicy::CENTER })))
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100292{
293 //Create valid region
294 TensorInfo src_info(_shape, 1, _data_type);
Diego Lopez Recas00854292018-02-22 13:08:01 +0000295 ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _policy, _sampling_policy, (_border_mode == BorderMode::UNDEFINED));
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100296
297 // Validate output
Georgios Pinitas99d4f4a2017-09-19 16:51:42 +0100298 validate(Accessor(_target), _reference, valid_region, tolerance_u8);
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100299}
Georgios Pinitas583137c2017-08-31 18:12:42 +0100300TEST_SUITE_END()
301TEST_SUITE(S16)
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100302FIXTURE_DATA_TEST_CASE(RunSmall, NEScaleFixture<int16_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(datasets::SmallShapes(), framework::dataset::make("DataType",
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700303 DataType::S16)),
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100304 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700305 framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
306 datasets::BorderModes()),
307 framework::dataset::make("SamplingPolicy", { SamplingPolicy::CENTER })))
Georgios Pinitas583137c2017-08-31 18:12:42 +0100308{
309 //Create valid region
310 TensorInfo src_info(_shape, 1, _data_type);
Diego Lopez Recas00854292018-02-22 13:08:01 +0000311 ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _policy, _sampling_policy, (_border_mode == BorderMode::UNDEFINED));
Georgios Pinitas583137c2017-08-31 18:12:42 +0100312
313 // Validate output
Moritz Pflanzerff1c3602017-09-22 12:41:25 +0100314 validate(Accessor(_target), _reference, valid_region, tolerance_s16, tolerance_num_s16);
Georgios Pinitas583137c2017-08-31 18:12:42 +0100315}
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100316FIXTURE_DATA_TEST_CASE(RunLarge, NEScaleFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::LargeShapes(), framework::dataset::make("DataType",
Georgios Pinitas583137c2017-08-31 18:12:42 +0100317 DataType::S16)),
Georgios Pinitas393fa4c2018-05-08 15:54:53 +0100318 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Daniil Efremov02bf80d2017-11-22 00:26:51 +0700319 framework::dataset::make("InterpolationPolicy", { InterpolationPolicy::NEAREST_NEIGHBOR, InterpolationPolicy::BILINEAR })),
320 datasets::BorderModes()),
321 framework::dataset::make("SamplingPolicy", { SamplingPolicy::CENTER })))
Georgios Pinitas583137c2017-08-31 18:12:42 +0100322{
323 //Create valid region
324 TensorInfo src_info(_shape, 1, _data_type);
Diego Lopez Recas00854292018-02-22 13:08:01 +0000325 ValidRegion valid_region = calculate_valid_region_scale(src_info, _reference.shape(), _policy, _sampling_policy, (_border_mode == BorderMode::UNDEFINED));
Georgios Pinitas583137c2017-08-31 18:12:42 +0100326
327 // Validate output
Moritz Pflanzerff1c3602017-09-22 12:41:25 +0100328 validate(Accessor(_target), _reference, valid_region, tolerance_s16, tolerance_num_s16);
Georgios Pinitas583137c2017-08-31 18:12:42 +0100329}
330TEST_SUITE_END()
331TEST_SUITE_END()
Isabella Gottardi1fab09f2017-07-13 15:55:57 +0100332
333TEST_SUITE_END()
334TEST_SUITE_END()
335} // namespace validation
336} // namespace test
337} // namespace arm_compute