Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 1 | /* |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 2 | * Copyright (c) 2022-2024 Arm Limited. |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 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 | |
| 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" |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 32 | #include "tests/validation/fixtures/dynamic_fusion/operators/ResizeFixture.h" |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 33 | #include "tests/validation/Validation.h" |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 34 | |
| 35 | using namespace arm_compute::experimental::dynamic_fusion; |
| 36 | namespace arm_compute |
| 37 | { |
| 38 | namespace test |
| 39 | { |
| 40 | namespace validation |
| 41 | { |
| 42 | namespace |
| 43 | { |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 44 | using datasets::ScaleAlignCornersSamplingPolicySet; |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 45 | using datasets::ScaleInterpolationPolicySet; |
| 46 | using datasets::ScaleSamplingPolicySet; |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 47 | using datasets::ScaleShapesBaseDataSet; |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 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 | */ |
| 52 | constexpr uint32_t vector_byte = 16; |
| 53 | |
| 54 | template <typename T> |
| 55 | constexpr uint32_t num_elements_per_vector() |
| 56 | { |
| 57 | return vector_byte / sizeof(T); |
| 58 | } |
| 59 | |
| 60 | /** Quantization information data set */ |
| 61 | const auto QuantizationInfoSet = framework::dataset::make("QuantizationInfo", |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 62 | { |
| 63 | QuantizationInfo(0.5f, -1), |
| 64 | }); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 65 | |
| 66 | /** Tolerance */ |
| 67 | constexpr AbsoluteTolerance<uint8_t> tolerance_q8(1); |
| 68 | constexpr AbsoluteTolerance<int8_t> tolerance_qs8(1); |
| 69 | constexpr AbsoluteTolerance<int16_t> tolerance_s16(1); |
| 70 | constexpr float tolerance_f32_absolute(0.001f); |
| 71 | |
| 72 | RelativeTolerance<float> tolerance_f32(0.05); |
| 73 | constexpr float abs_tolerance_f16(0.1f); |
| 74 | RelativeTolerance<half> tolerance_f16(half(0.1)); |
| 75 | |
| 76 | constexpr float tolerance_num_f32(0.01f); |
| 77 | |
| 78 | } // namespace |
| 79 | |
| 80 | TEST_SUITE(CL) |
| 81 | TEST_SUITE(DYNAMIC_FUSION) |
| 82 | TEST_SUITE(RESIZE) |
| 83 | |
| 84 | TEST_SUITE(Validate) |
| 85 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 86 | const auto default_input_shape = TensorShape{2, 3, 3, 2}; |
| 87 | const auto default_output_shape = TensorShape{4, 6, 3, 2}; |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 88 | |
Gunes Bayir | cc28773 | 2023-01-19 15:56:00 +0000 | [diff] [blame] | 89 | constexpr auto default_data_type = DataType::U8; |
| 90 | constexpr auto default_data_layout = DataLayout::NHWC; |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 91 | |
| 92 | TEST_CASE(NullPtr, framework::DatasetMode::ALL) |
| 93 | { |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 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}; |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 96 | |
| 97 | CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context(); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 98 | GpuWorkloadContext context = GpuWorkloadContext{&cl_compile_ctx}; |
| 99 | GpuWorkloadSketch sketch{&context}; |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 100 | |
| 101 | // nullptr is given as input |
Gunes Bayir | cc28773 | 2023-01-19 15:56:00 +0000 | [diff] [blame] | 102 | Status status = GpuResize::validate_op(sketch, nullptr, ResizeAttributes()); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 103 | ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS); |
| 104 | } |
| 105 | |
| 106 | TEST_CASE(SupportDataType, framework::DatasetMode::ALL) |
| 107 | { |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 108 | const std::map<DataType, bool> supported_data_types = { |
| 109 | {DataType::U8, true}, |
| 110 | {DataType::S8, false}, |
| 111 | {DataType::QSYMM8, false}, |
| 112 | {DataType::QASYMM8, true}, |
| 113 | {DataType::QASYMM8_SIGNED, true}, |
| 114 | {DataType::QSYMM8_PER_CHANNEL, false}, |
| 115 | {DataType::U16, false}, |
| 116 | {DataType::S16, true}, |
| 117 | {DataType::QSYMM16, false}, |
| 118 | {DataType::QASYMM16, false}, |
| 119 | {DataType::U32, false}, |
| 120 | {DataType::S32, false}, |
| 121 | {DataType::U64, false}, |
| 122 | {DataType::S64, false}, |
| 123 | {DataType::BFLOAT16, false}, |
| 124 | {DataType::F16, true}, |
| 125 | {DataType::F32, true}, |
| 126 | {DataType::F64, false}, |
| 127 | {DataType::SIZET, false}, |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 128 | }; |
| 129 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 130 | for (auto &kv : supported_data_types) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 131 | { |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 132 | const TensorInfo input_info = TensorInfo{default_input_shape, 1, kv.first, default_data_layout}; |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 133 | |
| 134 | CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context(); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 135 | GpuWorkloadContext context = GpuWorkloadContext{&cl_compile_ctx}; |
| 136 | GpuWorkloadSketch sketch{&context}; |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 137 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 138 | const ITensorInfo *sketch_input_info = context.create_tensor_info(input_info); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 139 | |
Gunes Bayir | cc28773 | 2023-01-19 15:56:00 +0000 | [diff] [blame] | 140 | ResizeAttributes attributes; |
| 141 | attributes.output_width(default_output_shape[0]); // shape is not important unless it's empty |
| 142 | attributes.output_height(default_output_shape[1]); |
| 143 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 144 | Status status = GpuResize::validate_op(sketch, sketch_input_info, attributes); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 145 | ARM_COMPUTE_EXPECT(bool(status) == kv.second, framework::LogLevel::ERRORS); |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | TEST_CASE(MismatchingDataType, framework::DatasetMode::ALL) |
| 150 | { |
| 151 | constexpr DataType non_default_data_type = DataType::F32; |
| 152 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 153 | const TensorInfo input_info = TensorInfo{default_input_shape, 1, default_data_type, default_data_layout}; |
| 154 | const TensorInfo output_info = TensorInfo{default_output_shape, 1, non_default_data_type, default_data_layout}; |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 155 | |
| 156 | CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context(); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 157 | GpuWorkloadContext context = GpuWorkloadContext{&cl_compile_ctx}; |
| 158 | GpuWorkloadSketch sketch{&context}; |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 159 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 160 | const ITensorInfo *sketch_input_info = context.create_tensor_info(input_info); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 161 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 162 | Status status = GpuResize::validate_op(sketch, sketch_input_info, ResizeAttributes()); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 163 | ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS); |
| 164 | } |
| 165 | |
| 166 | TEST_CASE(AlignedCornerNotSupported, framework::DatasetMode::ALL) |
| 167 | { |
| 168 | // Aligned corners require sampling policy to be TOP_LEFT. |
| 169 | constexpr InterpolationPolicy interpolation_policy = InterpolationPolicy::BILINEAR; |
| 170 | constexpr bool align_corners = true; |
| 171 | constexpr SamplingPolicy sampling_policy = SamplingPolicy::CENTER; |
| 172 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 173 | const TensorInfo input_info = TensorInfo{default_input_shape, 1, default_data_type, default_data_layout}; |
| 174 | const TensorInfo output_info = TensorInfo{default_output_shape, 1, default_data_type, default_data_layout}; |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 175 | |
| 176 | CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context(); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 177 | GpuWorkloadContext context = GpuWorkloadContext{&cl_compile_ctx}; |
| 178 | GpuWorkloadSketch sketch{&context}; |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 179 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 180 | const ITensorInfo *sketch_input_info = context.create_tensor_info(input_info); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 181 | |
| 182 | ResizeAttributes attributes{}; |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 183 | attributes.interpolation_policy(interpolation_policy).sampling_policy(sampling_policy).align_corners(align_corners); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 184 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 185 | Status status = GpuResize::validate_op(sketch, sketch_input_info, attributes); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 186 | ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS); |
| 187 | } |
| 188 | |
| 189 | TEST_CASE(UnsupportedInterpolationPolicy, framework::DatasetMode::ALL) |
| 190 | { |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 191 | const TensorInfo input_info = TensorInfo{TensorShape(28U, 33U, 2U), 1, DataType::F32, default_data_layout}; |
| 192 | const TensorInfo output_info = TensorInfo{TensorShape(26U, 21U, 2U), 1, DataType::F32, default_data_layout}; |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 193 | constexpr auto interpolation_policy = InterpolationPolicy::AREA; |
| 194 | |
| 195 | CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context(); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 196 | GpuWorkloadContext context = GpuWorkloadContext{&cl_compile_ctx}; |
| 197 | GpuWorkloadSketch sketch{&context}; |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 198 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 199 | const ITensorInfo *sketch_input_info = context.create_tensor_info(input_info); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 200 | |
| 201 | ResizeAttributes attributes{}; |
| 202 | attributes.interpolation_policy(interpolation_policy); |
| 203 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 204 | Status status = GpuResize::validate_op(sketch, sketch_input_info, attributes); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 205 | ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS); |
| 206 | } |
| 207 | |
| 208 | TEST_CASE(UnsupportedLayout, framework::DatasetMode::ALL) |
| 209 | { |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 210 | const TensorInfo input_info = TensorInfo{default_input_shape, 1, default_data_type, DataLayout::NCHW}; |
| 211 | const TensorInfo output_info = TensorInfo{default_output_shape, 1, default_data_type, DataLayout::NCHW}; |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 212 | constexpr auto interpolation_policy = InterpolationPolicy::BILINEAR; |
| 213 | |
| 214 | CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context(); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 215 | GpuWorkloadContext context = GpuWorkloadContext{&cl_compile_ctx}; |
| 216 | GpuWorkloadSketch sketch{&context}; |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 217 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 218 | const ITensorInfo *sketch_input_info = context.create_tensor_info(input_info); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 219 | |
| 220 | ResizeAttributes attributes{}; |
| 221 | attributes.interpolation_policy(interpolation_policy); |
| 222 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 223 | Status status = GpuResize::validate_op(sketch, sketch_input_info, attributes); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 224 | ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS); |
| 225 | } |
| 226 | |
| 227 | TEST_SUITE_END() // Validate |
| 228 | |
| 229 | template <typename T> |
| 230 | using DynamicFusionResizeFixture = DynamicFusionResizeValidationFixture<CLTensor, CLAccessor, GpuResize, T>; |
| 231 | |
| 232 | TEST_SUITE(Float) |
| 233 | TEST_SUITE(FP32) |
| 234 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 235 | const auto f32_shape = combine((SCALE_PRECOMMIT_SHAPE_DATASET(num_elements_per_vector<float>())), |
| 236 | framework::dataset::make("DataType", DataType::F32)); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 237 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 238 | FIXTURE_DATA_TEST_CASE(Run, |
| 239 | DynamicFusionResizeFixture<float>, |
| 240 | framework::DatasetMode::ALL, |
| 241 | ASSEMBLE_DATASET_DYNAMIC_FUSION(f32_shape, ScaleSamplingPolicySet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 242 | { |
| 243 | //Create valid region |
| 244 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 245 | const ValidRegion valid_region = |
| 246 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 247 | |
| 248 | // Validate output |
| 249 | validate(CLAccessor(_target), _reference, valid_region, tolerance_f32, tolerance_num_f32, tolerance_f32_absolute); |
| 250 | } |
| 251 | |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 252 | FIXTURE_DATA_TEST_CASE(RunAlignCorners, |
| 253 | DynamicFusionResizeFixture<float>, |
| 254 | framework::DatasetMode::ALL, |
| 255 | ASSEMBLE_DATASET_DYNAMIC_FUSION(f32_shape, ScaleAlignCornersSamplingPolicySet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 256 | { |
| 257 | //Create valid region |
| 258 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 259 | const ValidRegion valid_region = |
| 260 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 261 | |
| 262 | // Validate output |
| 263 | validate(CLAccessor(_target), _reference, valid_region, tolerance_f32, tolerance_num_f32, tolerance_f32_absolute); |
| 264 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 265 | const auto f32_nightly_shape = combine((SCALE_NIGHTLY_SHAPE_DATASET(num_elements_per_vector<float>())), |
| 266 | framework::dataset::make("DataType", DataType::F32)); |
| 267 | FIXTURE_DATA_TEST_CASE(RunNightly, |
| 268 | DynamicFusionResizeFixture<float>, |
| 269 | framework::DatasetMode::NIGHTLY, |
| 270 | ASSEMBLE_DATASET_DYNAMIC_FUSION(f32_nightly_shape, ScaleSamplingPolicySet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 271 | { |
| 272 | //Create valid region |
| 273 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 274 | const ValidRegion valid_region = |
| 275 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 276 | |
| 277 | // Validate output |
| 278 | validate(CLAccessor(_target), _reference, valid_region, tolerance_f32, tolerance_num_f32, tolerance_f32_absolute); |
| 279 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 280 | FIXTURE_DATA_TEST_CASE(RunNightlyAlignCorners, |
| 281 | DynamicFusionResizeFixture<float>, |
| 282 | framework::DatasetMode::NIGHTLY, |
| 283 | ASSEMBLE_DATASET_DYNAMIC_FUSION(f32_nightly_shape, ScaleAlignCornersSamplingPolicySet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 284 | { |
| 285 | //Create valid region |
| 286 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 287 | const ValidRegion valid_region = |
| 288 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 289 | |
| 290 | // Validate output |
| 291 | validate(CLAccessor(_target), _reference, valid_region, tolerance_f32, tolerance_num_f32, tolerance_f32_absolute); |
| 292 | } |
| 293 | TEST_SUITE_END() // FP32 |
| 294 | |
| 295 | TEST_SUITE(FP16) |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 296 | const auto f16_shape = combine((SCALE_PRECOMMIT_SHAPE_DATASET(num_elements_per_vector<half>())), |
| 297 | framework::dataset::make("DataType", DataType::F16)); |
| 298 | FIXTURE_DATA_TEST_CASE(Run, |
| 299 | DynamicFusionResizeFixture<half>, |
| 300 | framework::DatasetMode::ALL, |
| 301 | ASSEMBLE_DATASET_DYNAMIC_FUSION(f16_shape, ScaleSamplingPolicySet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 302 | { |
| 303 | //Create valid region |
| 304 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 305 | const ValidRegion valid_region = |
| 306 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 307 | |
| 308 | // Validate output |
| 309 | validate(CLAccessor(_target), _reference, valid_region, tolerance_f16, 0.0f, abs_tolerance_f16); |
| 310 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 311 | FIXTURE_DATA_TEST_CASE(RunAlignCorners, |
| 312 | DynamicFusionResizeFixture<half>, |
| 313 | framework::DatasetMode::ALL, |
| 314 | ASSEMBLE_DATASET_DYNAMIC_FUSION(f16_shape, ScaleAlignCornersSamplingPolicySet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 315 | { |
| 316 | //Create valid region |
| 317 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 318 | const ValidRegion valid_region = |
| 319 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 320 | |
| 321 | // Validate output |
| 322 | validate(CLAccessor(_target), _reference, valid_region, tolerance_f16, 0.0f, abs_tolerance_f16); |
| 323 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 324 | const auto f16_nightly_shape = combine((SCALE_NIGHTLY_SHAPE_DATASET(num_elements_per_vector<half>())), |
| 325 | framework::dataset::make("DataType", DataType::F16)); |
| 326 | FIXTURE_DATA_TEST_CASE(RunNightly, |
| 327 | DynamicFusionResizeFixture<half>, |
| 328 | framework::DatasetMode::NIGHTLY, |
| 329 | ASSEMBLE_DATASET_DYNAMIC_FUSION(f16_nightly_shape, ScaleSamplingPolicySet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 330 | { |
| 331 | //Create valid region |
| 332 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 333 | const ValidRegion valid_region = |
| 334 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 335 | |
| 336 | // Validate output |
| 337 | validate(CLAccessor(_target), _reference, valid_region, tolerance_f16, 0.0f, abs_tolerance_f16); |
| 338 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 339 | FIXTURE_DATA_TEST_CASE(RunNightlyAlignCorners, |
| 340 | DynamicFusionResizeFixture<half>, |
| 341 | framework::DatasetMode::NIGHTLY, |
| 342 | ASSEMBLE_DATASET_DYNAMIC_FUSION(f16_nightly_shape, ScaleAlignCornersSamplingPolicySet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 343 | { |
| 344 | //Create valid region |
| 345 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 346 | const ValidRegion valid_region = |
| 347 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 348 | |
| 349 | // Validate output |
| 350 | validate(CLAccessor(_target), _reference, valid_region, tolerance_f16, 0.0f, abs_tolerance_f16); |
| 351 | } |
| 352 | TEST_SUITE_END() // FP16 |
| 353 | TEST_SUITE_END() // Float |
| 354 | |
| 355 | TEST_SUITE(Integer) |
| 356 | TEST_SUITE(U8) |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 357 | const auto u8_shape = combine((SCALE_PRECOMMIT_SHAPE_DATASET(num_elements_per_vector<uint8_t>())), |
| 358 | framework::dataset::make("DataType", DataType::U8)); |
| 359 | FIXTURE_DATA_TEST_CASE(Run, |
| 360 | DynamicFusionResizeFixture<uint8_t>, |
| 361 | framework::DatasetMode::ALL, |
| 362 | ASSEMBLE_DATASET_DYNAMIC_FUSION(u8_shape, ScaleSamplingPolicySet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 363 | { |
| 364 | //Create valid region |
| 365 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 366 | const ValidRegion valid_region = |
| 367 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 368 | |
| 369 | // Validate output |
| 370 | validate(CLAccessor(_target), _reference, valid_region, tolerance_q8); |
| 371 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 372 | FIXTURE_DATA_TEST_CASE(RunAlignCorners, |
| 373 | DynamicFusionResizeFixture<uint8_t>, |
| 374 | framework::DatasetMode::ALL, |
| 375 | ASSEMBLE_DATASET_DYNAMIC_FUSION(u8_shape, ScaleAlignCornersSamplingPolicySet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 376 | { |
| 377 | //Create valid region |
| 378 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 379 | const ValidRegion valid_region = |
| 380 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 381 | |
| 382 | // Validate output |
| 383 | validate(CLAccessor(_target), _reference, valid_region, tolerance_q8); |
| 384 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 385 | const auto u8_nightly_shape = combine((SCALE_NIGHTLY_SHAPE_DATASET(num_elements_per_vector<uint8_t>())), |
| 386 | framework::dataset::make("DataType", DataType::U8)); |
| 387 | FIXTURE_DATA_TEST_CASE(RunNightly, |
| 388 | DynamicFusionResizeFixture<uint8_t>, |
| 389 | framework::DatasetMode::NIGHTLY, |
| 390 | ASSEMBLE_DATASET_DYNAMIC_FUSION(u8_nightly_shape, ScaleSamplingPolicySet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 391 | { |
| 392 | //Create valid region |
| 393 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 394 | const ValidRegion valid_region = |
| 395 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 396 | |
| 397 | // Validate output |
| 398 | validate(CLAccessor(_target), _reference, valid_region, tolerance_q8); |
| 399 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 400 | FIXTURE_DATA_TEST_CASE(RunNightlyAlignCorners, |
| 401 | DynamicFusionResizeFixture<uint8_t>, |
| 402 | framework::DatasetMode::NIGHTLY, |
| 403 | ASSEMBLE_DATASET_DYNAMIC_FUSION(u8_nightly_shape, ScaleAlignCornersSamplingPolicySet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 404 | { |
| 405 | //Create valid region |
| 406 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 407 | const ValidRegion valid_region = |
| 408 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 409 | |
| 410 | // Validate output |
| 411 | validate(CLAccessor(_target), _reference, valid_region, tolerance_q8); |
| 412 | } |
| 413 | TEST_SUITE_END() // U8 |
| 414 | |
| 415 | TEST_SUITE(S16) |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 416 | const auto s16_shape = combine((SCALE_PRECOMMIT_SHAPE_DATASET(num_elements_per_vector<int16_t>())), |
| 417 | framework::dataset::make("DataType", DataType::S16)); |
| 418 | FIXTURE_DATA_TEST_CASE(Run, |
| 419 | DynamicFusionResizeFixture<int16_t>, |
| 420 | framework::DatasetMode::ALL, |
| 421 | ASSEMBLE_DATASET_DYNAMIC_FUSION(s16_shape, ScaleSamplingPolicySet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 422 | { |
| 423 | //Create valid region |
| 424 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 425 | const ValidRegion valid_region = |
| 426 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 427 | |
| 428 | // Validate output |
| 429 | validate(CLAccessor(_target), _reference, valid_region, tolerance_s16); |
| 430 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 431 | FIXTURE_DATA_TEST_CASE(RunAlignCorners, |
| 432 | DynamicFusionResizeFixture<int16_t>, |
| 433 | framework::DatasetMode::ALL, |
| 434 | ASSEMBLE_DATASET_DYNAMIC_FUSION(s16_shape, ScaleAlignCornersSamplingPolicySet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 435 | { |
| 436 | //Create valid region |
| 437 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 438 | const ValidRegion valid_region = |
| 439 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 440 | |
| 441 | // Validate output |
| 442 | validate(CLAccessor(_target), _reference, valid_region, tolerance_s16); |
| 443 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 444 | const auto s16_nightly_shape = combine((SCALE_NIGHTLY_SHAPE_DATASET(num_elements_per_vector<int16_t>())), |
| 445 | framework::dataset::make("DataType", DataType::S16)); |
| 446 | FIXTURE_DATA_TEST_CASE(RunNightly, |
| 447 | DynamicFusionResizeFixture<int16_t>, |
| 448 | framework::DatasetMode::NIGHTLY, |
| 449 | ASSEMBLE_DATASET_DYNAMIC_FUSION(s16_nightly_shape, ScaleSamplingPolicySet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 450 | { |
| 451 | //Create valid region |
| 452 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 453 | const ValidRegion valid_region = |
| 454 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 455 | |
| 456 | // Validate output |
| 457 | validate(CLAccessor(_target), _reference, valid_region, tolerance_s16); |
| 458 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 459 | FIXTURE_DATA_TEST_CASE(RunNightlyAlignCorners, |
| 460 | DynamicFusionResizeFixture<int16_t>, |
| 461 | framework::DatasetMode::NIGHTLY, |
| 462 | ASSEMBLE_DATASET_DYNAMIC_FUSION(s16_nightly_shape, ScaleAlignCornersSamplingPolicySet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 463 | { |
| 464 | //Create valid region |
| 465 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 466 | const ValidRegion valid_region = |
| 467 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 468 | |
| 469 | // Validate output |
| 470 | validate(CLAccessor(_target), _reference, valid_region, tolerance_s16); |
| 471 | } |
| 472 | TEST_SUITE_END() // S16 |
| 473 | TEST_SUITE_END() // Integer |
| 474 | |
| 475 | template <typename T> |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 476 | using DynamicFusionResizeQuantizedFixture = |
| 477 | DynamicFusionResizeQuantizedValidationFixture<CLTensor, CLAccessor, GpuResize, T>; |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 478 | TEST_SUITE(Quantized) |
| 479 | TEST_SUITE(QASYMM8) |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 480 | const auto qasymm8_shape = combine((SCALE_PRECOMMIT_SHAPE_DATASET(num_elements_per_vector<uint8_t>())), |
| 481 | framework::dataset::make("DataType", DataType::QASYMM8)); |
| 482 | FIXTURE_DATA_TEST_CASE(Run, |
| 483 | DynamicFusionResizeQuantizedFixture<uint8_t>, |
| 484 | framework::DatasetMode::ALL, |
| 485 | ASSEMBLE_QUANTIZED_DATASET_DYNAMIC_FUSION(qasymm8_shape, |
| 486 | ScaleSamplingPolicySet, |
| 487 | QuantizationInfoSet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 488 | { |
| 489 | //Create valid region |
| 490 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 491 | const ValidRegion valid_region = |
| 492 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 493 | |
| 494 | // Validate output |
| 495 | validate(CLAccessor(_target), _reference, valid_region, tolerance_q8); |
| 496 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 497 | FIXTURE_DATA_TEST_CASE(RunAlignCorners, |
| 498 | DynamicFusionResizeQuantizedFixture<uint8_t>, |
| 499 | framework::DatasetMode::ALL, |
| 500 | ASSEMBLE_QUANTIZED_DATASET_DYNAMIC_FUSION(qasymm8_shape, |
| 501 | ScaleAlignCornersSamplingPolicySet, |
| 502 | QuantizationInfoSet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 503 | { |
| 504 | //Create valid region |
| 505 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 506 | const ValidRegion valid_region = |
| 507 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 508 | |
| 509 | // Validate output |
| 510 | validate(CLAccessor(_target), _reference, valid_region, tolerance_q8); |
| 511 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 512 | const auto qasymm8_nightly_shape = combine((SCALE_NIGHTLY_SHAPE_DATASET(num_elements_per_vector<uint8_t>())), |
| 513 | framework::dataset::make("DataType", DataType::QASYMM8)); |
| 514 | FIXTURE_DATA_TEST_CASE(RunNightly, |
| 515 | DynamicFusionResizeQuantizedFixture<uint8_t>, |
| 516 | framework::DatasetMode::NIGHTLY, |
| 517 | ASSEMBLE_QUANTIZED_DATASET_DYNAMIC_FUSION(qasymm8_nightly_shape, |
| 518 | ScaleSamplingPolicySet, |
| 519 | QuantizationInfoSet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 520 | { |
| 521 | //Create valid region |
| 522 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 523 | const ValidRegion valid_region = |
| 524 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 525 | |
| 526 | // Validate output |
| 527 | validate(CLAccessor(_target), _reference, valid_region, tolerance_q8); |
| 528 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 529 | FIXTURE_DATA_TEST_CASE(RunNightlyAlignCorners, |
| 530 | DynamicFusionResizeQuantizedFixture<uint8_t>, |
| 531 | framework::DatasetMode::NIGHTLY, |
| 532 | ASSEMBLE_QUANTIZED_DATASET_DYNAMIC_FUSION(qasymm8_nightly_shape, |
| 533 | ScaleAlignCornersSamplingPolicySet, |
| 534 | QuantizationInfoSet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 535 | { |
| 536 | //Create valid region |
| 537 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 538 | const ValidRegion valid_region = |
| 539 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 540 | |
| 541 | // Validate output |
| 542 | validate(CLAccessor(_target), _reference, valid_region, tolerance_q8); |
| 543 | } |
| 544 | TEST_SUITE_END() // QASYMM8 |
| 545 | |
| 546 | TEST_SUITE(QASYMM8_SIGNED) |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 547 | const auto qasymm8_signed_shape = combine((SCALE_PRECOMMIT_SHAPE_DATASET(num_elements_per_vector<int8_t>())), |
| 548 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)); |
| 549 | FIXTURE_DATA_TEST_CASE(Run, |
| 550 | DynamicFusionResizeQuantizedFixture<int8_t>, |
| 551 | framework::DatasetMode::ALL, |
| 552 | ASSEMBLE_QUANTIZED_DATASET_DYNAMIC_FUSION(qasymm8_signed_shape, |
| 553 | ScaleSamplingPolicySet, |
| 554 | QuantizationInfoSet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 555 | { |
| 556 | //Create valid region |
| 557 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 558 | const ValidRegion valid_region = |
| 559 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 560 | |
| 561 | // Validate output |
| 562 | validate(CLAccessor(_target), _reference, valid_region, tolerance_qs8); |
| 563 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 564 | FIXTURE_DATA_TEST_CASE(RunAlignCorners, |
| 565 | DynamicFusionResizeQuantizedFixture<int8_t>, |
| 566 | framework::DatasetMode::ALL, |
| 567 | ASSEMBLE_QUANTIZED_DATASET_DYNAMIC_FUSION(qasymm8_signed_shape, |
| 568 | ScaleAlignCornersSamplingPolicySet, |
| 569 | QuantizationInfoSet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 570 | { |
| 571 | //Create valid region |
| 572 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 573 | const ValidRegion valid_region = |
| 574 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 575 | |
| 576 | // Validate output |
| 577 | validate(CLAccessor(_target), _reference, valid_region, tolerance_qs8); |
| 578 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 579 | const auto qasymm8_signed_nightly_shape = combine((SCALE_NIGHTLY_SHAPE_DATASET(num_elements_per_vector<int8_t>())), |
| 580 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)); |
| 581 | FIXTURE_DATA_TEST_CASE(RunNightly, |
| 582 | DynamicFusionResizeQuantizedFixture<int8_t>, |
| 583 | framework::DatasetMode::NIGHTLY, |
| 584 | ASSEMBLE_QUANTIZED_DATASET_DYNAMIC_FUSION(qasymm8_signed_nightly_shape, |
| 585 | ScaleSamplingPolicySet, |
| 586 | QuantizationInfoSet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 587 | { |
| 588 | //Create valid region |
| 589 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 590 | const ValidRegion valid_region = |
| 591 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 592 | |
| 593 | // Validate output |
| 594 | validate(CLAccessor(_target), _reference, valid_region, tolerance_qs8); |
| 595 | } |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 596 | FIXTURE_DATA_TEST_CASE(RunNightlyAlignCorners, |
| 597 | DynamicFusionResizeQuantizedFixture<int8_t>, |
| 598 | framework::DatasetMode::NIGHTLY, |
| 599 | ASSEMBLE_QUANTIZED_DATASET_DYNAMIC_FUSION(qasymm8_signed_nightly_shape, |
| 600 | ScaleAlignCornersSamplingPolicySet, |
| 601 | QuantizationInfoSet)) |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 602 | { |
| 603 | //Create valid region |
| 604 | TensorInfo src_info(_shape, 1, _data_type); |
Viet-Hoa Do | fdf56fb | 2024-01-18 16:10:46 +0000 | [diff] [blame^] | 605 | const ValidRegion valid_region = |
| 606 | calculate_valid_region_scale(src_info, _reference.shape(), _interpolation_policy, _sampling_policy, false); |
Jakub Sujak | 8ae5714 | 2022-12-02 16:09:06 +0000 | [diff] [blame] | 607 | |
| 608 | // Validate output |
| 609 | validate(CLAccessor(_target), _reference, valid_region, tolerance_qs8); |
| 610 | } |
| 611 | TEST_SUITE_END() // QASYMM8_SIGNED |
| 612 | |
| 613 | TEST_SUITE_END() // Quantized |
| 614 | |
| 615 | TEST_SUITE_END() // RESIZE |
| 616 | TEST_SUITE_END() // DYNAMIC_FUSION |
| 617 | TEST_SUITE_END() // CL |
| 618 | |
| 619 | } // namespace validation |
| 620 | } // namespace test |
| 621 | } // namespace arm_compute |