Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 1 | /* |
SiCong Li | 1b2f868 | 2023-01-04 10:04:26 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2023 Arm Limited. |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [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 | #include "arm_compute/core/Types.h" |
| 25 | #include "arm_compute/runtime/CL/CLTensor.h" |
| 26 | #include "arm_compute/runtime/CL/CLTensorAllocator.h" |
| 27 | #include "arm_compute/runtime/CL/functions/CLDirectConvolutionLayer.h" |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 28 | #include "tests/CL/CLAccessor.h" |
| 29 | #include "tests/PaddingCalculator.h" |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 30 | #include "tests/datasets/DirectConvolutionLayerDataset.h" |
Moritz Pflanzer | a09de0c | 2017-09-01 20:41:12 +0100 | [diff] [blame] | 31 | #include "tests/datasets/ShapeDatasets.h" |
| 32 | #include "tests/framework/Asserts.h" |
| 33 | #include "tests/framework/Macros.h" |
| 34 | #include "tests/framework/datasets/Datasets.h" |
| 35 | #include "tests/validation/Validation.h" |
| 36 | #include "tests/validation/fixtures/DirectConvolutionLayerFixture.h" |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 37 | |
SiCong Li | 54eafd8 | 2023-01-26 17:36:08 +0000 | [diff] [blame] | 38 | /** Synced with tests/validation/dynamic_fusion/gpu/cl/DirectConv2d.cpp |
| 39 | * Please check there for any differences in the coverage |
| 40 | */ |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 41 | namespace arm_compute |
| 42 | { |
| 43 | namespace test |
| 44 | { |
| 45 | namespace validation |
| 46 | { |
| 47 | namespace |
| 48 | { |
Gunes Bayir | 38ce29d | 2021-08-04 12:45:33 +0100 | [diff] [blame] | 49 | RelativeTolerance<half> tolerance_fp16(half(0.2)); /**< Tolerance for floating point tests */ |
| 50 | RelativeTolerance<float> tolerance_fp32(0.05f); /**< Tolerance for floating point tests */ |
| 51 | constexpr float abs_tolerance_f32(0.0001f); /**< Absolute tolerance for FP32 tests*/ |
| 52 | |
| 53 | constexpr float tolerance_num = 0.07f; /**< Tolerance number */ |
| 54 | constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1); /**< Tolerance for quantized tests */ |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 55 | |
Michalis Spyrou | 4509173 | 2019-05-13 17:41:01 +0100 | [diff] [blame] | 56 | const auto data_strides = combine(framework::dataset::make("StrideX", 1, 3), framework::dataset::make("StrideY", 1, 3)); |
| 57 | const auto data_strides_small = combine(framework::dataset::make("StrideX", 1), framework::dataset::make("StrideY", 1)); |
| 58 | const auto data_ksize_one = combine(framework::dataset::make("PadX", 0, 1), combine(framework::dataset::make("PadY", 0, 1), framework::dataset::make("KernelSize", 1))); |
| 59 | const auto data_ksize_one_small = combine(framework::dataset::make("PadX", 0), combine(framework::dataset::make("PadY", 0), framework::dataset::make("KernelSize", 1))); |
| 60 | const auto data_ksize_three = combine(framework::dataset::make("PadX", 0, 2), combine(framework::dataset::make("PadY", 0, 2), framework::dataset::make("KernelSize", 3))); |
| 61 | const auto data_ksize_five = combine(framework::dataset::make("PadX", 0, 3), combine(framework::dataset::make("PadY", 0, 3), framework::dataset::make("KernelSize", 5))); |
| 62 | const auto data_ksize_nine = combine(framework::dataset::make("PadX", 0, 3), combine(framework::dataset::make("PadY", 0, 3), framework::dataset::make("KernelSize", 9))); |
| 63 | const auto data_ksize_nine_small = combine(framework::dataset::make("PadX", 0, 1), combine(framework::dataset::make("PadY", 0, 1), framework::dataset::make("KernelSize", 9))); |
Michalis Spyrou | def665a | 2017-08-14 11:26:37 +0100 | [diff] [blame] | 64 | |
Michalis Spyrou | 4509173 | 2019-05-13 17:41:01 +0100 | [diff] [blame] | 65 | const auto data_all_kernels = concat(concat(data_ksize_one, data_ksize_three), data_ksize_five); |
| 66 | |
| 67 | const auto data = combine(datasets::SmallDirectConvolutionShapes(), combine(data_strides, data_all_kernels)); |
| 68 | const auto data9x9 = combine(datasets::SmallDirectConvolutionShapes(), combine(data_strides, data_ksize_nine)); |
| 69 | const auto data_small = combine(datasets::SmallDirectConvolutionShapes(), combine(data_strides_small, data_ksize_one_small)); |
| 70 | const auto data_small9x9 = combine(datasets::SmallDirectConvolutionShapes(), combine(data_strides_small, data_ksize_nine_small)); |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 71 | |
| 72 | /** Direct convolution nightly data set. */ |
Michele Di Giorgio | ba2cc1a | 2020-07-15 17:39:30 +0100 | [diff] [blame] | 73 | const auto data_nightly = combine(data, framework::dataset::make("NumKernels", { 1, 4 })); |
| 74 | const auto data_nightly_9x9 = combine(data9x9, framework::dataset::make("NumKernels", { 1, 4 })); |
| 75 | const auto data_nightly_usecase = combine(framework::dataset::make("InputShape", { TensorShape{ 3U, 800U, 800U } }), |
| 76 | combine(framework::dataset::make("StrideX", { 1 }), |
| 77 | combine(framework::dataset::make("StrideY", { 1 }), |
| 78 | combine(framework::dataset::make("PadX", { 4 }), |
| 79 | combine(framework::dataset::make("PadY", { 4 }), |
| 80 | combine(framework::dataset::make("KernelSize", 9), |
| 81 | framework::dataset::make("NumKernels", { 16 }))))))); |
| 82 | |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 83 | /** Direct convolution precommit data set. */ |
Michalis Spyrou | 4509173 | 2019-05-13 17:41:01 +0100 | [diff] [blame] | 84 | const auto data_precommit = combine(data_small, framework::dataset::make("NumKernels", { 1 })); |
| 85 | const auto data_precommit_9x9 = combine(data_small9x9, framework::dataset::make("NumKernels", { 1 })); |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 86 | |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 87 | /** Activation function Dataset*/ |
| 88 | const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo", |
Michalis Spyrou | 5ce99a2 | 2019-01-25 14:17:49 +0000 | [diff] [blame] | 89 | { ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 0.5f) }); |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 90 | } // namespace |
| 91 | |
| 92 | TEST_SUITE(CL) |
| 93 | TEST_SUITE(DirectConvolutionLayer) |
| 94 | |
Michele Di Giorgio | 97e2580 | 2021-03-25 12:37:45 +0000 | [diff] [blame] | 95 | /** Check whether the configuration of a Direct Convolution layer with no |
| 96 | * bias leads to a successful execution. |
| 97 | */ |
| 98 | TEST_CASE(NoBias, framework::DatasetMode::PRECOMMIT) |
| 99 | { |
| 100 | const auto src_shape = TensorShape(27U, 13U, 2U); |
| 101 | const auto weights_shape = TensorShape(3U, 3U, 2U, 4U); |
| 102 | const auto bias_shape = TensorShape(4U); |
| 103 | const auto dst_shape = TensorShape(25U, 11U, 4U); |
| 104 | constexpr auto dt = DataType::F32; |
| 105 | |
| 106 | auto src = create_tensor<CLTensor>(src_shape, dt); |
| 107 | auto weights = create_tensor<CLTensor>(weights_shape, dt); |
| 108 | auto dst = create_tensor<CLTensor>(dst_shape, dt); |
| 109 | |
| 110 | const auto conv_info = PadStrideInfo(1, 1, 0, 0); |
| 111 | |
| 112 | // Create Direct Convolution function |
| 113 | CLDirectConvolutionLayer conv{}; |
| 114 | conv.configure(&src, &weights, nullptr, &dst, conv_info); |
| 115 | |
| 116 | src.allocator()->allocate(); |
| 117 | weights.allocator()->allocate(); |
| 118 | dst.allocator()->allocate(); |
| 119 | |
| 120 | library->fill_tensor_value(CLAccessor(src), 1.f); |
| 121 | library->fill_tensor_value(CLAccessor(weights), 1.f); |
| 122 | |
| 123 | conv.run(); |
| 124 | |
| 125 | // Compute reference to compare |
| 126 | SimpleTensor<float> ref_src{ src_shape, dt }; |
| 127 | SimpleTensor<float> ref_weights{ weights_shape, dt }; |
| 128 | SimpleTensor<float> ref_bias{ bias_shape, dt }; |
| 129 | library->fill_tensor_value(ref_src, 1.f); |
| 130 | library->fill_tensor_value(ref_weights, 1.f); |
| 131 | // No bias |
| 132 | library->fill_tensor_value(ref_bias, 0.f); |
| 133 | auto ref_dst = reference::convolution_layer<float>(ref_src, ref_weights, ref_bias, dst_shape, conv_info); |
| 134 | |
| 135 | validate(CLAccessor(dst), ref_dst); |
| 136 | } |
| 137 | |
Ramy Elgammal | 73f19af | 2022-10-23 11:44:49 +0100 | [diff] [blame] | 138 | /** Check whether the case of rectangle kernels i.e. when width and height of the weight_shape are not equal |
| 139 | * would lead to successful run |
| 140 | */ |
| 141 | TEST_CASE(NonSquareKernel, framework::DatasetMode::PRECOMMIT) |
| 142 | { |
| 143 | auto src_shape = TensorShape(33U, 27U, 3U); |
| 144 | auto weights_shape = TensorShape(5U, 7U, 3U, 4U); // non-square kernel |
| 145 | const auto bias_shape = TensorShape(4U); |
| 146 | auto dst_shape = TensorShape(11U, 12U, 4U); |
| 147 | constexpr auto dt = DataType::F32; |
| 148 | |
| 149 | TensorShape src_shape_nhwc(src_shape); |
| 150 | TensorShape weights_shape_nhwc(weights_shape); |
| 151 | TensorShape dst_shape_nhwc(dst_shape); |
| 152 | |
| 153 | // Non-square shapes are only allowed for NHWC |
| 154 | permute(src_shape_nhwc, PermutationVector(2U, 0U, 1U)); |
| 155 | permute(weights_shape_nhwc, PermutationVector(2U, 0U, 1U)); |
| 156 | permute(dst_shape_nhwc, PermutationVector(2U, 0U, 1U)); |
| 157 | |
| 158 | auto src = create_tensor<CLTensor>(src_shape_nhwc, dt, 1, QuantizationInfo(), DataLayout::NHWC); |
| 159 | auto weights = create_tensor<CLTensor>(weights_shape_nhwc, dt, 1, QuantizationInfo(), DataLayout::NHWC); |
| 160 | auto dst = create_tensor<CLTensor>(dst_shape_nhwc, dt, 1, QuantizationInfo(), DataLayout::NHWC); |
| 161 | const auto conv_info = PadStrideInfo(3, 2, 1, 1, 2, 0, DimensionRoundingType::FLOOR); |
| 162 | |
| 163 | // Create direct convolution function |
| 164 | CLDirectConvolutionLayer conv{}; |
| 165 | conv.configure(&src, &weights, nullptr, &dst, conv_info); |
| 166 | |
| 167 | src.allocator()->allocate(); |
| 168 | weights.allocator()->allocate(); |
| 169 | dst.allocator()->allocate(); |
| 170 | |
| 171 | library->fill_tensor_value(CLAccessor(src), 1.f); |
| 172 | library->fill_tensor_value(CLAccessor(weights), 1.f); |
| 173 | |
| 174 | conv.run(); |
| 175 | |
| 176 | // Compute reference to compare |
| 177 | SimpleTensor<float> ref_src{ src_shape, dt }; |
| 178 | SimpleTensor<float> ref_weights{ weights_shape, dt }; |
| 179 | SimpleTensor<float> ref_bias{ bias_shape, dt }; |
| 180 | library->fill_tensor_value(ref_src, 1.f); |
| 181 | library->fill_tensor_value(ref_weights, 1.f); |
| 182 | // No bias |
| 183 | library->fill_tensor_value(ref_bias, 0.f); |
| 184 | auto ref_dst = reference::convolution_layer<float>(ref_src, ref_weights, ref_bias, dst_shape, conv_info); |
| 185 | |
| 186 | validate(CLAccessor(dst), ref_dst); |
| 187 | } |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 188 | // *INDENT-OFF* |
| 189 | // clang-format off |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 190 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip( |
SiCong Li | 1b2f868 | 2023-01-04 10:04:26 +0000 | [diff] [blame] | 191 | framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid: Mismatching data type input/weights |
| 192 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid: Mismatching input feature maps |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 193 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid weights dimensions |
SiCong Li | 1b2f868 | 2023-01-04 10:04:26 +0000 | [diff] [blame] | 194 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Unsupported biases size |
| 195 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Unsupported biases dimensions |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 196 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid output size |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 197 | TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32), |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 198 | }), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 199 | framework::dataset::make("WeightsInfo",{ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F16), |
| 200 | TensorInfo(TensorShape(3U, 3U, 3U, 4U), 1, DataType::F32), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 201 | TensorInfo(TensorShape(3U, 3U, 2U, 4U, 3U), 1, DataType::F32), |
| 202 | TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32), |
| 203 | TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32), |
| 204 | TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 205 | TensorInfo(TensorShape(1U, 1U, 2U, 4U), 1, DataType::F32), |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 206 | })), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 207 | framework::dataset::make("BiasesInfo",{ TensorInfo(TensorShape(4U), 1, DataType::F32), |
| 208 | TensorInfo(TensorShape(4U), 1, DataType::F32), |
| 209 | TensorInfo(TensorShape(4U), 1, DataType::F32), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 210 | TensorInfo(TensorShape(3U), 1, DataType::F32), |
| 211 | TensorInfo(TensorShape(4U, 2U), 1, DataType::F32), |
| 212 | TensorInfo(TensorShape(4U), 1, DataType::F32), |
| 213 | TensorInfo(TensorShape(4U), 1, DataType::F32), |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 214 | })), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 215 | framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32), |
| 216 | TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32), |
| 217 | TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32), |
| 218 | TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32), |
| 219 | TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 220 | TensorInfo(TensorShape(26U, 11U, 4U), 1, DataType::F32), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 221 | TensorInfo(TensorShape(32U, 16U, 4U), 1, DataType::F32), |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 222 | })), |
| 223 | framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0), |
| 224 | PadStrideInfo(1, 1, 0, 0), |
| 225 | PadStrideInfo(1, 1, 0, 0), |
| 226 | PadStrideInfo(1, 1, 0, 0), |
| 227 | PadStrideInfo(1, 1, 0, 0), |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 228 | PadStrideInfo(1, 1, 0, 0), |
Giorgio Arena | 5948634 | 2017-12-01 10:42:47 +0000 | [diff] [blame] | 229 | PadStrideInfo(1, 1, 0, 0), |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 230 | })), |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 231 | framework::dataset::make("ActivationInfo", |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 232 | { |
SiCong Li | 1b2f868 | 2023-01-04 10:04:26 +0000 | [diff] [blame] | 233 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 234 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 235 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 236 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 237 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 238 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 239 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) |
| 240 | })), |
SiCong Li | 1b2f868 | 2023-01-04 10:04:26 +0000 | [diff] [blame] | 241 | framework::dataset::make("Expected", { false, false, false, false, false, false, true })), |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 242 | input_info, weights_info, biases_info, output_info, conv_info, act_info, expected) |
| 243 | { |
| 244 | bool is_valid = bool(CLDirectConvolutionLayer::validate(&input_info.clone()->set_is_resizable(false), &weights_info.clone()->set_is_resizable(false), &biases_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), conv_info, act_info)); |
Georgios Pinitas | 631c41a | 2017-12-06 11:53:03 +0000 | [diff] [blame] | 245 | ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS); |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 246 | } |
SiCong Li | 1b2f868 | 2023-01-04 10:04:26 +0000 | [diff] [blame] | 247 | // clang-format on |
| 248 | // *INDENT-ON* |
Georgios Pinitas | 30902ed | 2017-11-14 15:32:57 +0000 | [diff] [blame] | 249 | |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 250 | template <typename T> |
| 251 | using CLDirectConvolutionLayerFixture = DirectConvolutionValidationFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>; |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 252 | template <typename T> |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 253 | using CLDirectConvolutionLayerMixedDataLayoutFixture = DirectConvolutionValidationFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T, true>; |
| 254 | template <typename T> |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 255 | using CLDirectConvolutionValidationWithTensorShapesFixture = DirectConvolutionValidationWithTensorShapesFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>; |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 256 | template <typename T> |
| 257 | using CLDirectConvolutionLayerQuantizedFixture = DirectConvolutionValidationQuantizedFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>; |
| 258 | template <typename T> |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 259 | using CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture = DirectConvolutionValidationQuantizedFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T, true>; |
| 260 | template <typename T> |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 261 | using CLDirectConvolutionValidationWithTensorShapesQuantizedFixture = DirectConvolutionValidationWithTensorShapesQuantizedFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>; |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 262 | |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 263 | TEST_SUITE(NHWC) |
SiCong Li | 1b2f868 | 2023-01-04 10:04:26 +0000 | [diff] [blame] | 264 | // *INDENT-OFF* |
| 265 | // clang-format off |
| 266 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip( |
| 267 | framework::dataset::make("InputInfo", { |
| 268 | TensorInfo(TensorShape(2U, 27U, 13U), 1, DataType::F32, DataLayout::NHWC), // Arbitrary weight sizes for NHWC are supported |
| 269 | TensorInfo(TensorShape(2U, 27U, 13U), 1, DataType::F32, DataLayout::NHWC), // Non-rectangular weights dimensions for NHWC are supported |
| 270 | TensorInfo(TensorShape(2U, 27U, 13U), 1, DataType::F32, DataLayout::NHWC), // Strides > 2 for any kernel sizes for NHWC are supported |
| 271 | }), |
| 272 | framework::dataset::make("WeightsInfo",{ |
| 273 | TensorInfo(TensorShape(2U, 13U, 13U, 4U), 1, DataType::F32, DataLayout::NHWC), |
| 274 | TensorInfo(TensorShape(2U, 5U, 3U, 4U), 1, DataType::F32, DataLayout::NHWC), |
| 275 | TensorInfo(TensorShape(2U, 3U, 3U, 4U), 1, DataType::F32, DataLayout::NHWC), |
| 276 | })), |
| 277 | framework::dataset::make("BiasesInfo",{ |
| 278 | TensorInfo(TensorShape(4U), 1, DataType::F32, DataLayout::NHWC), |
| 279 | TensorInfo(TensorShape(4U), 1, DataType::F32, DataLayout::NHWC), |
| 280 | TensorInfo(TensorShape(4U), 1, DataType::F32, DataLayout::NHWC), |
| 281 | })), |
| 282 | framework::dataset::make("OutputInfo",{ |
| 283 | TensorInfo(TensorShape(4U, 15U, 1U), 1, DataType::F32, DataLayout::NHWC), |
| 284 | TensorInfo(TensorShape(4U, 23U, 11U), 1, DataType::F32, DataLayout::NHWC), |
| 285 | TensorInfo(TensorShape(4U, 9U, 4U), 1, DataType::F32, DataLayout::NHWC), |
| 286 | })), |
| 287 | framework::dataset::make("ConvInfo", { |
| 288 | PadStrideInfo(1, 1, 0, 0), |
| 289 | PadStrideInfo(1, 1, 0, 0), |
| 290 | PadStrideInfo(3, 3, 0, 0), |
| 291 | })), |
| 292 | framework::dataset::make("ActivationInfo", |
| 293 | { |
| 294 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 295 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 296 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 297 | })), |
| 298 | framework::dataset::make("Expected", { true, true, true })), |
| 299 | input_info, weights_info, biases_info, output_info, conv_info, act_info, expected) |
| 300 | { |
| 301 | bool is_valid = bool(CLDirectConvolutionLayer::validate(&input_info.clone()->set_is_resizable(false), &weights_info.clone()->set_is_resizable(false), &biases_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), conv_info, act_info)); |
| 302 | ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS); |
| 303 | } |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 304 | TEST_SUITE(FP16) |
| 305 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, |
| 306 | combine(combine(combine(zip(zip(zip(zip(zip(zip( |
Gian Marco Iodice | 2ba39b6 | 2021-05-07 09:21:47 +0100 | [diff] [blame] | 307 | framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U), |
| 308 | TensorShape(19U, 5U, 16U, 4U), |
| 309 | TensorShape(13U, 5U, 17U, 2U), |
| 310 | TensorShape(32U, 37U, 13U) } ), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 311 | framework::dataset::make("StrideX", { 1, 3, 1, 1 })), |
| 312 | framework::dataset::make("StrideY", { 1, 3, 2, 1 })), |
| 313 | framework::dataset::make("PadX", { 1, 3, 0, 4 })), |
| 314 | framework::dataset::make("PadY", { 1, 3, 0, 4 })), |
| 315 | framework::dataset::make("KernelSize", { 3, 8, 1, 9 })), |
Gian Marco Iodice | 5c9eed8 | 2021-03-19 11:26:20 +0000 | [diff] [blame] | 316 | framework::dataset::make("NumKernels", { 17, 3, 1, 19 })), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 317 | framework::dataset::make("DataType", DataType::F16)), |
| 318 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 319 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 320 | { |
| 321 | validate(CLAccessor(_target), _reference, tolerance_fp16, tolerance_num); |
| 322 | } |
| 323 | |
| 324 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, |
| 325 | combine(combine(combine(zip(zip(zip(zip(zip(zip( |
| 326 | framework::dataset::make("InputShape", { TensorShape(800U, 800U, 3U) } ), |
| 327 | framework::dataset::make("StrideX", { 1 })), |
| 328 | framework::dataset::make("StrideY", { 1 })), |
| 329 | framework::dataset::make("PadX", { 1 })), |
| 330 | framework::dataset::make("PadY", { 1 })), |
| 331 | framework::dataset::make("KernelSize", { 9 })), |
| 332 | framework::dataset::make("NumKernels", { 3 })), |
| 333 | framework::dataset::make("DataType", DataType::F16)), |
| 334 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::IDENTITY) )), |
| 335 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 336 | { |
| 337 | validate(CLAccessor(_target), _reference, tolerance_fp16, tolerance_num); |
| 338 | } |
| 339 | |
| 340 | TEST_SUITE_END() // FP16 |
| 341 | |
| 342 | TEST_SUITE(FP32) |
| 343 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 344 | combine(combine(combine(zip(zip(zip(zip(zip(zip( |
Gian Marco Iodice | 2ba39b6 | 2021-05-07 09:21:47 +0100 | [diff] [blame] | 345 | framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U), |
| 346 | TensorShape(19U, 5U, 16U, 4U), |
| 347 | TensorShape(13U, 5U, 17U, 2U), |
| 348 | TensorShape(32U, 37U, 13U) } ), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 349 | framework::dataset::make("StrideX", { 1, 3, 1, 1 })), |
| 350 | framework::dataset::make("StrideY", { 1, 3, 2, 1 })), |
| 351 | framework::dataset::make("PadX", { 1, 3, 0, 4 })), |
| 352 | framework::dataset::make("PadY", { 1, 3, 0, 4 })), |
| 353 | framework::dataset::make("KernelSize", { 3, 8, 1, 9 })), |
Gian Marco Iodice | 5c9eed8 | 2021-03-19 11:26:20 +0000 | [diff] [blame] | 354 | framework::dataset::make("NumKernels", { 17, 3, 1, 19 })), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 355 | framework::dataset::make("DataType", DataType::F32)), |
| 356 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 357 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 358 | { |
Gunes Bayir | 38ce29d | 2021-08-04 12:45:33 +0100 | [diff] [blame] | 359 | validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32); |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 360 | } |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 361 | FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerMixedDataLayoutFixture<float>, framework::DatasetMode::PRECOMMIT, |
| 362 | combine(combine(combine(zip(zip(zip(zip(zip(zip( |
Gian Marco Iodice | 2ba39b6 | 2021-05-07 09:21:47 +0100 | [diff] [blame] | 363 | framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U), |
| 364 | TensorShape(19U, 5U, 16U, 4U), |
| 365 | TensorShape(13U, 5U, 17U, 2U), |
| 366 | TensorShape(32U, 37U, 13U) } ), |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 367 | framework::dataset::make("StrideX", { 1 })), |
| 368 | framework::dataset::make("StrideY", { 2 })), |
| 369 | framework::dataset::make("PadX", { 1 })), |
| 370 | framework::dataset::make("PadY", { 3 })), |
| 371 | framework::dataset::make("KernelSize", { 3 })), |
| 372 | framework::dataset::make("NumKernels", { 3 })), |
| 373 | framework::dataset::make("DataType", DataType::F32)), |
| 374 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 375 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 376 | { |
Gunes Bayir | 38ce29d | 2021-08-04 12:45:33 +0100 | [diff] [blame] | 377 | validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32); |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 378 | } |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 379 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, |
| 380 | combine(combine(combine(zip(zip(zip(zip(zip(zip( |
| 381 | framework::dataset::make("InputShape", { TensorShape(800U, 800U, 3U) } ), |
| 382 | framework::dataset::make("StrideX", { 1 })), |
| 383 | framework::dataset::make("StrideY", { 1 })), |
| 384 | framework::dataset::make("PadX", { 1 })), |
| 385 | framework::dataset::make("PadY", { 1 })), |
| 386 | framework::dataset::make("KernelSize", { 9 })), |
| 387 | framework::dataset::make("NumKernels", { 3 })), |
| 388 | framework::dataset::make("DataType", DataType::F32)), |
| 389 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::IDENTITY) )), |
| 390 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 391 | { |
Gunes Bayir | 38ce29d | 2021-08-04 12:45:33 +0100 | [diff] [blame] | 392 | validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32); |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 393 | } |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 394 | TEST_SUITE_END() // FP32 |
| 395 | |
| 396 | TEST_SUITE(Quantized) |
| 397 | TEST_SUITE(QASYMM8) |
| 398 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 399 | combine(combine(combine(combine(zip(zip(zip(zip(zip(zip( |
Gian Marco Iodice | 2ba39b6 | 2021-05-07 09:21:47 +0100 | [diff] [blame] | 400 | framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U), |
| 401 | TensorShape(19U, 5U, 16U, 4U), |
| 402 | TensorShape(13U, 5U, 17U, 2U), |
| 403 | TensorShape(32U, 37U, 13U) } ), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 404 | framework::dataset::make("StrideX", { 1, 3, 1, 1 })), |
| 405 | framework::dataset::make("StrideY", { 1, 3, 2, 1 })), |
| 406 | framework::dataset::make("PadX", { 1, 3, 0, 4 })), |
| 407 | framework::dataset::make("PadY", { 1, 3, 0, 4 })), |
| 408 | framework::dataset::make("KernelSize", { 3, 8, 1, 9 })), |
| 409 | framework::dataset::make("NumKernels", { 7, 3, 1, 3 })), |
| 410 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 411 | framework::dataset::make("QuantizationInfo", QuantizationInfo(1.1f / 255, 10))), |
| 412 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 413 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 414 | { |
| 415 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 416 | } |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 417 | FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 418 | combine(combine(combine(combine(zip(zip(zip(zip(zip(zip( |
Gian Marco Iodice | 2ba39b6 | 2021-05-07 09:21:47 +0100 | [diff] [blame] | 419 | framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U), |
| 420 | TensorShape(19U, 5U, 16U, 4U), |
| 421 | TensorShape(13U, 5U, 17U, 2U), |
| 422 | TensorShape(32U, 37U, 13U) } ), |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 423 | framework::dataset::make("StrideX", { 1 })), |
| 424 | framework::dataset::make("StrideY", { 2 })), |
| 425 | framework::dataset::make("PadX", { 1 })), |
| 426 | framework::dataset::make("PadY", { 1 })), |
| 427 | framework::dataset::make("KernelSize", { 3 })), |
| 428 | framework::dataset::make("NumKernels", { 3 })), |
| 429 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 430 | framework::dataset::make("QuantizationInfo", QuantizationInfo(1.1f / 255, 10))), |
| 431 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 432 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 433 | { |
| 434 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 435 | } |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 436 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 437 | combine(combine(combine(combine(zip(zip(zip(zip(zip(zip( |
| 438 | framework::dataset::make("InputShape", { TensorShape(800U, 800U, 3U) } ), |
| 439 | framework::dataset::make("StrideX", { 1 })), |
| 440 | framework::dataset::make("StrideY", { 1 })), |
| 441 | framework::dataset::make("PadX", { 1 })), |
| 442 | framework::dataset::make("PadY", { 1 })), |
| 443 | framework::dataset::make("KernelSize", { 9 })), |
| 444 | framework::dataset::make("NumKernels", { 3 })), |
| 445 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 446 | framework::dataset::make("QuantizationInfo", QuantizationInfo(2.f / 255, 10))), |
| 447 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 448 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 449 | { |
| 450 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 451 | } |
| 452 | |
| 453 | TEST_SUITE_END() // QASYMM8 |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 454 | TEST_SUITE(QASYMM8_SIGNED) |
| 455 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::PRECOMMIT, |
| 456 | combine(combine(combine(combine(zip(zip(zip(zip(zip(zip( |
Gian Marco Iodice | 2ba39b6 | 2021-05-07 09:21:47 +0100 | [diff] [blame] | 457 | framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U), |
| 458 | TensorShape(19U, 5U, 16U, 4U), |
| 459 | TensorShape(13U, 5U, 17U, 2U), |
| 460 | TensorShape(32U, 37U, 13U) } ), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 461 | framework::dataset::make("StrideX", { 1, 3, 1, 1 })), |
| 462 | framework::dataset::make("StrideY", { 1, 3, 2, 1 })), |
| 463 | framework::dataset::make("PadX", { 1, 3, 0, 4 })), |
| 464 | framework::dataset::make("PadY", { 1, 3, 0, 4 })), |
| 465 | framework::dataset::make("KernelSize", { 3, 8, 1, 9 })), |
| 466 | framework::dataset::make("NumKernels", { 7, 3, 1, 3 })), |
| 467 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), |
| 468 | framework::dataset::make("QuantizationInfo", QuantizationInfo(2.f / 255, 10))), |
| 469 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 470 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 471 | { |
| 472 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 473 | } |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 474 | FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<int8_t>, framework::DatasetMode::PRECOMMIT, |
| 475 | combine(combine(combine(combine(zip(zip(zip(zip(zip(zip( |
Gian Marco Iodice | 2ba39b6 | 2021-05-07 09:21:47 +0100 | [diff] [blame] | 476 | framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U), |
| 477 | TensorShape(19U, 5U, 16U, 4U), |
| 478 | TensorShape(13U, 5U, 17U, 2U), |
| 479 | TensorShape(32U, 37U, 13U) } ), |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 480 | framework::dataset::make("StrideX", { 1 })), |
| 481 | framework::dataset::make("StrideY", { 1 })), |
| 482 | framework::dataset::make("PadX", { 1 })), |
| 483 | framework::dataset::make("PadY", { 1 })), |
| 484 | framework::dataset::make("KernelSize", { 3 })), |
| 485 | framework::dataset::make("NumKernels", { 3 })), |
| 486 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), |
| 487 | framework::dataset::make("QuantizationInfo", QuantizationInfo(2.f / 255, 10))), |
| 488 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 489 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 490 | { |
| 491 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 492 | } |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 493 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::NIGHTLY, |
| 494 | combine(combine(combine(combine(zip(zip(zip(zip(zip(zip( |
| 495 | framework::dataset::make("InputShape", { TensorShape(800U, 800U, 3U) } ), |
| 496 | framework::dataset::make("StrideX", { 1 })), |
| 497 | framework::dataset::make("StrideY", { 1 })), |
| 498 | framework::dataset::make("PadX", { 1 })), |
| 499 | framework::dataset::make("PadY", { 1 })), |
| 500 | framework::dataset::make("KernelSize", { 9 })), |
| 501 | framework::dataset::make("NumKernels", { 3 })), |
| 502 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), |
| 503 | framework::dataset::make("QuantizationInfo", QuantizationInfo(2.f / 255, 10))), |
| 504 | framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )), |
| 505 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 506 | { |
| 507 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 508 | } |
| 509 | TEST_SUITE_END() // QASYMM8_SIGNED |
| 510 | TEST_SUITE_END() // Quantized |
| 511 | TEST_SUITE_END() // NHWC |
| 512 | |
SiCong Li | 1b2f868 | 2023-01-04 10:04:26 +0000 | [diff] [blame] | 513 | TEST_SUITE(NCHW) |
| 514 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip( |
| 515 | framework::dataset::make("InputInfo", { |
| 516 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, DataLayout::NCHW), // Unsupported kernel width |
| 517 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, DataLayout::NCHW), // Non-rectangular weights dimensions are unsupported |
| 518 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32, DataLayout::NCHW) // Unsupported stride |
| 519 | }), |
| 520 | framework::dataset::make("WeightsInfo",{ |
| 521 | TensorInfo(TensorShape(11U, 11U, 2U, 4U), 1, DataType::F32, DataLayout::NCHW), |
| 522 | TensorInfo(TensorShape(5U, 3U, 2U, 4U), 1, DataType::F32, DataLayout::NCHW), |
| 523 | TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32, DataLayout::NCHW) |
| 524 | })), |
| 525 | framework::dataset::make("BiasesInfo",{ |
| 526 | TensorInfo(TensorShape(4U), 1, DataType::F32, DataLayout::NCHW), |
| 527 | TensorInfo(TensorShape(4U), 1, DataType::F32, DataLayout::NCHW), |
| 528 | TensorInfo(TensorShape(4U), 1, DataType::F32, DataLayout::NCHW) |
| 529 | })), |
| 530 | framework::dataset::make("OutputInfo",{ |
| 531 | TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, DataLayout::NCHW), |
| 532 | TensorInfo(TensorShape(23U, 11U, 4U), 1, DataType::F32, DataLayout::NCHW), |
| 533 | TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32, DataLayout::NCHW) |
| 534 | })), |
| 535 | framework::dataset::make("ConvInfo", { |
| 536 | PadStrideInfo(1, 1, 0, 0), |
| 537 | PadStrideInfo(1, 1, 0, 0), |
| 538 | PadStrideInfo(3, 3, 0, 0) |
| 539 | })), |
| 540 | framework::dataset::make("ActivationInfo", |
| 541 | { |
| 542 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 543 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 544 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) |
| 545 | })), |
| 546 | framework::dataset::make("Expected", { false, false, false})), |
| 547 | input_info, weights_info, biases_info, output_info, conv_info, act_info, expected) |
| 548 | { |
| 549 | bool is_valid = bool(CLDirectConvolutionLayer::validate(&input_info.clone()->set_is_resizable(false), &weights_info.clone()->set_is_resizable(false), &biases_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), conv_info, act_info)); |
| 550 | ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS); |
| 551 | } |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 552 | // clang-format on |
| 553 | // *INDENT-ON* |
SiCong Li | 1b2f868 | 2023-01-04 10:04:26 +0000 | [diff] [blame] | 554 | |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 555 | TEST_SUITE(Float) |
| 556 | TEST_SUITE(FP16) |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 557 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(data_precommit, framework::dataset::make("DataType", DataType::F16)), |
| 558 | ActivationFunctionsDataset), |
| 559 | framework::dataset::make("DataLayout", DataLayout::NCHW))) |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 560 | { |
| 561 | // Validate output |
steniu01 | 3e05e4e | 2017-08-25 17:18:01 +0100 | [diff] [blame] | 562 | validate(CLAccessor(_target), _reference, tolerance_fp16, tolerance_num); |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 563 | } |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 564 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(data_nightly, framework::dataset::make("DataType", DataType::F16)), |
| 565 | ActivationFunctionsDataset), |
| 566 | framework::dataset::make("DataLayout", DataLayout::NCHW))) |
| 567 | { |
| 568 | // Validate output |
| 569 | validate(CLAccessor(_target), _reference, tolerance_fp16, tolerance_num); |
| 570 | } |
| 571 | TEST_SUITE_END() // FP16 |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 572 | |
| 573 | TEST_SUITE(FP32) |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 574 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(data_precommit, framework::dataset::make("DataType", |
| 575 | DataType::F32)), |
| 576 | ActivationFunctionsDataset), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 577 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 578 | { |
Gunes Bayir | 38ce29d | 2021-08-04 12:45:33 +0100 | [diff] [blame] | 579 | validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32); |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 580 | } |
Gunes Bayir | 38ce29d | 2021-08-04 12:45:33 +0100 | [diff] [blame] | 581 | FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerMixedDataLayoutFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(data_precommit, |
| 582 | framework::dataset::make("DataType", |
| 583 | DataType::F32)), |
| 584 | ActivationFunctionsDataset), |
| 585 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 586 | { |
Gunes Bayir | 38ce29d | 2021-08-04 12:45:33 +0100 | [diff] [blame] | 587 | validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32); |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 588 | } |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 589 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(data_nightly, framework::dataset::make("DataType", DataType::F32)), |
| 590 | ActivationFunctionsDataset), |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 591 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 592 | { |
Gunes Bayir | 38ce29d | 2021-08-04 12:45:33 +0100 | [diff] [blame] | 593 | validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32); |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 594 | } |
| 595 | TEST_SUITE_END() // FP32 |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 596 | |
| 597 | TEST_SUITE(FP32_CustomDataset) |
Michalis Spyrou | 8094325 | 2019-01-10 17:19:50 +0000 | [diff] [blame] | 598 | FIXTURE_DATA_TEST_CASE(Run, CLDirectConvolutionValidationWithTensorShapesFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::DirectConvolutionLayerDataset(), |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 599 | framework::dataset::make("DataType", DataType::F32)), |
| 600 | ActivationFunctionsDataset)) |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 601 | { |
| 602 | // Validate output |
Gunes Bayir | 38ce29d | 2021-08-04 12:45:33 +0100 | [diff] [blame] | 603 | validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32); |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 604 | } |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 605 | TEST_SUITE_END() // FP32_CustomDataset |
| 606 | TEST_SUITE_END() // Float |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 607 | |
Gunes Bayir | dfcd41a | 2023-10-11 09:56:05 +0100 | [diff] [blame] | 608 | /// @note: Every quantized test has a version with or without activation because the quantization info given is |
| 609 | /// ignored when there is no activation. Instead of using the same quantization information for all the tensors, the |
| 610 | /// fixture generates separate quantization info for each input and the output tensor. |
| 611 | /// When we can also support dynamic quantization with the presence of activation, these two versions should be merged |
| 612 | /// again, with the explicitly specified quantization info removed |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 613 | const auto QuantizedActivationFunctionsDataset = framework::dataset::make("ActivationInfo", |
| 614 | { |
Isabella Gottardi | 3f217ec | 2018-02-12 14:59:19 +0000 | [diff] [blame] | 615 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 616 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f) |
| 617 | }); |
Gunes Bayir | dfcd41a | 2023-10-11 09:56:05 +0100 | [diff] [blame] | 618 | const auto NoActivation = framework::dataset::make("ActivationInfo", |
| 619 | { |
| 620 | ActivationLayerInfo() |
| 621 | }); |
| 622 | const auto IgnoredQuantizationInfo = framework::dataset::make("IgnoredQuantizationInfo", |
| 623 | { |
| 624 | QuantizationInfo() |
| 625 | }); |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 626 | TEST_SUITE(Quantized) |
| 627 | TEST_SUITE(QASYMM8) |
Gunes Bayir | dfcd41a | 2023-10-11 09:56:05 +0100 | [diff] [blame] | 628 | FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(data_precommit, |
| 629 | framework::dataset::make("DataType", DataType::QASYMM8), |
| 630 | IgnoredQuantizationInfo, |
| 631 | NoActivation, |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 632 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
| 633 | { |
| 634 | // Validate output |
| 635 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 636 | } |
Gunes Bayir | dfcd41a | 2023-10-11 09:56:05 +0100 | [diff] [blame] | 637 | FIXTURE_DATA_TEST_CASE(RunMixedDataLayoutWithActivation, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(data_precommit, |
| 638 | framework::dataset::make("DataType", DataType::QASYMM8), |
| 639 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10) }), |
| 640 | QuantizedActivationFunctionsDataset, |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 641 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Sang-Hoon Park | ab5b1a2 | 2019-10-15 09:29:13 +0100 | [diff] [blame] | 642 | { |
| 643 | // Validate output |
| 644 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 645 | } |
Gunes Bayir | dfcd41a | 2023-10-11 09:56:05 +0100 | [diff] [blame] | 646 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(data_precommit, |
| 647 | framework::dataset::make("DataType", DataType::QASYMM8), |
| 648 | IgnoredQuantizationInfo, |
| 649 | NoActivation, |
| 650 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
| 651 | { |
| 652 | // Validate output |
| 653 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 654 | } |
| 655 | FIXTURE_DATA_TEST_CASE(RunSmallWithActivation, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(data_precommit, |
| 656 | framework::dataset::make("DataType", DataType::QASYMM8), |
| 657 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10), QuantizationInfo(1.1f, 10) }), |
| 658 | QuantizedActivationFunctionsDataset, |
| 659 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
| 660 | { |
| 661 | // Validate output |
| 662 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 663 | } |
| 664 | FIXTURE_DATA_TEST_CASE(RunSmall9x9, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(data_precommit_9x9, |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 665 | framework::dataset::make("DataType", |
Gunes Bayir | dfcd41a | 2023-10-11 09:56:05 +0100 | [diff] [blame] | 666 | DataType::QASYMM8), |
| 667 | IgnoredQuantizationInfo, |
| 668 | NoActivation, |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 669 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 670 | { |
| 671 | // Validate output |
| 672 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 673 | } |
Gunes Bayir | dfcd41a | 2023-10-11 09:56:05 +0100 | [diff] [blame] | 674 | FIXTURE_DATA_TEST_CASE(RunSmall9x9WithActivation, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(data_precommit_9x9, |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 675 | framework::dataset::make("DataType", |
Gunes Bayir | dfcd41a | 2023-10-11 09:56:05 +0100 | [diff] [blame] | 676 | DataType::QASYMM8), |
| 677 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(3.f / 255, 10), QuantizationInfo(1.1f, 10) }), |
| 678 | QuantizedActivationFunctionsDataset, |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 679 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Sang-Hoon Park | ab5b1a2 | 2019-10-15 09:29:13 +0100 | [diff] [blame] | 680 | { |
| 681 | // Validate output |
| 682 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 683 | } |
Gunes Bayir | dfcd41a | 2023-10-11 09:56:05 +0100 | [diff] [blame] | 684 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(data_nightly, framework::dataset::make("DataType", |
| 685 | DataType::QASYMM8), |
| 686 | IgnoredQuantizationInfo, |
| 687 | NoActivation, |
| 688 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
| 689 | { |
| 690 | // Validate output |
| 691 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 692 | } |
| 693 | FIXTURE_DATA_TEST_CASE(RunLargeWithActivation, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(data_nightly, framework::dataset::make("DataType", |
| 694 | DataType::QASYMM8), |
| 695 | framework::dataset::make("QuantizationInfoIf", { QuantizationInfo(2.f / 255, 10), QuantizationInfo(1.1f, 10) }), |
| 696 | QuantizedActivationFunctionsDataset, |
| 697 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
| 698 | { |
| 699 | // Validate output |
| 700 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 701 | } |
| 702 | FIXTURE_DATA_TEST_CASE(RunLarge9x9, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(data_nightly_9x9, |
| 703 | framework::dataset::make("DataType", |
| 704 | DataType::QASYMM8), |
| 705 | IgnoredQuantizationInfo, |
| 706 | NoActivation, |
| 707 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
| 708 | { |
| 709 | // Validate output |
| 710 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 711 | } |
| 712 | FIXTURE_DATA_TEST_CASE(RunLarge9x9WithActivation, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(data_nightly_9x9, |
| 713 | framework::dataset::make("DataType", |
| 714 | DataType::QASYMM8), |
| 715 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(3.f / 255, 10), QuantizationInfo(1.1f, 10) }), |
| 716 | QuantizedActivationFunctionsDataset, |
| 717 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
| 718 | { |
| 719 | // Validate output |
| 720 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 721 | } |
| 722 | FIXTURE_DATA_TEST_CASE(CustomDataset, CLDirectConvolutionValidationWithTensorShapesQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 723 | combine(datasets::DirectConvolutionLayerDataset(), |
| 724 | framework::dataset::make("DataType", DataType::QASYMM8), |
| 725 | IgnoredQuantizationInfo, |
| 726 | NoActivation, |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 727 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Jaroslaw Rzepecki | 2ecbada | 2017-11-29 13:51:34 +0000 | [diff] [blame] | 728 | { |
| 729 | // Validate output |
| 730 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 731 | } |
Gunes Bayir | dfcd41a | 2023-10-11 09:56:05 +0100 | [diff] [blame] | 732 | FIXTURE_DATA_TEST_CASE(CustomDatasetWithActivation, CLDirectConvolutionValidationWithTensorShapesQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 733 | combine(datasets::DirectConvolutionLayerDataset(), |
| 734 | framework::dataset::make("DataType", DataType::QASYMM8), |
| 735 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 127), QuantizationInfo(1.1f, 10) }), |
| 736 | QuantizedActivationFunctionsDataset, |
| 737 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
| 738 | { |
| 739 | // Validate output |
| 740 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 741 | } |
| 742 | TEST_SUITE_END() // QASYMM8 |
Sheri Zhang | 681f2d4 | 2020-02-20 11:23:08 +0000 | [diff] [blame] | 743 | |
| 744 | TEST_SUITE(QASYMM8_SIGNED) |
| 745 | |
Gunes Bayir | dfcd41a | 2023-10-11 09:56:05 +0100 | [diff] [blame] | 746 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, combine(data_precommit, framework::dataset::make("DataType", |
| 747 | DataType::QASYMM8_SIGNED), |
| 748 | IgnoredQuantizationInfo, |
| 749 | NoActivation, |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 750 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Sheri Zhang | 681f2d4 | 2020-02-20 11:23:08 +0000 | [diff] [blame] | 751 | { |
| 752 | // Validate output |
| 753 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 754 | } |
Gunes Bayir | dfcd41a | 2023-10-11 09:56:05 +0100 | [diff] [blame] | 755 | FIXTURE_DATA_TEST_CASE(RunSmallWithActivation, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, combine(data_precommit, framework::dataset::make("DataType", |
| 756 | DataType::QASYMM8_SIGNED), |
| 757 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10), QuantizationInfo(1.1f, -10) }), |
| 758 | QuantizedActivationFunctionsDataset, |
| 759 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 760 | { |
| 761 | // Validate output |
| 762 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 763 | } |
| 764 | FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<int8_t>, framework::DatasetMode::ALL, combine(data_precommit, |
Gunes Bayir | 38ce29d | 2021-08-04 12:45:33 +0100 | [diff] [blame] | 765 | framework::dataset::make("DataType", |
Gunes Bayir | dfcd41a | 2023-10-11 09:56:05 +0100 | [diff] [blame] | 766 | DataType::QASYMM8_SIGNED), |
| 767 | IgnoredQuantizationInfo, |
| 768 | NoActivation, |
Gunes Bayir | 38ce29d | 2021-08-04 12:45:33 +0100 | [diff] [blame] | 769 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Manuel Bottini | ca62c6f | 2021-03-23 11:50:34 +0000 | [diff] [blame] | 770 | { |
| 771 | // Validate output |
| 772 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 773 | } |
Gunes Bayir | dfcd41a | 2023-10-11 09:56:05 +0100 | [diff] [blame] | 774 | FIXTURE_DATA_TEST_CASE(RunMixedDataLayoutWithActivation, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<int8_t>, framework::DatasetMode::ALL, combine(data_precommit, |
Sheri Zhang | 681f2d4 | 2020-02-20 11:23:08 +0000 | [diff] [blame] | 775 | framework::dataset::make("DataType", |
Gunes Bayir | dfcd41a | 2023-10-11 09:56:05 +0100 | [diff] [blame] | 776 | DataType::QASYMM8_SIGNED), |
| 777 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(1.1f, -10) }), |
| 778 | QuantizedActivationFunctionsDataset, |
| 779 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
| 780 | { |
| 781 | // Validate output |
| 782 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 783 | } |
| 784 | FIXTURE_DATA_TEST_CASE(RunSmall9x9, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, combine(data_precommit_9x9, |
| 785 | framework::dataset::make("DataType", |
| 786 | DataType::QASYMM8_SIGNED), |
| 787 | IgnoredQuantizationInfo, |
| 788 | NoActivation, |
| 789 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
| 790 | { |
| 791 | // Validate output |
| 792 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 793 | } |
| 794 | FIXTURE_DATA_TEST_CASE(RunSmall9x9WithActivation, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, combine(data_precommit_9x9, |
| 795 | framework::dataset::make("DataType", |
| 796 | DataType::QASYMM8_SIGNED), |
| 797 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10), QuantizationInfo(1.1f, 10) }), |
| 798 | QuantizedActivationFunctionsDataset, |
Giorgio Arena | e620a83 | 2020-02-17 16:33:20 +0000 | [diff] [blame] | 799 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Sheri Zhang | 681f2d4 | 2020-02-20 11:23:08 +0000 | [diff] [blame] | 800 | { |
| 801 | // Validate output |
| 802 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 803 | } |
| 804 | |
| 805 | FIXTURE_DATA_TEST_CASE(RunCustomDataset, CLDirectConvolutionValidationWithTensorShapesQuantizedFixture<int8_t>, framework::DatasetMode::NIGHTLY, |
Gunes Bayir | dfcd41a | 2023-10-11 09:56:05 +0100 | [diff] [blame] | 806 | combine(datasets::DirectConvolutionLayerDataset(), |
| 807 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED), |
| 808 | IgnoredQuantizationInfo, |
| 809 | NoActivation, |
| 810 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
| 811 | { |
| 812 | // Validate output |
| 813 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 814 | } |
| 815 | |
| 816 | FIXTURE_DATA_TEST_CASE(RunCustomDatasetWithActivation, CLDirectConvolutionValidationWithTensorShapesQuantizedFixture<int8_t>, framework::DatasetMode::NIGHTLY, |
| 817 | combine(datasets::DirectConvolutionLayerDataset(), |
| 818 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED), |
| 819 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 127), QuantizationInfo(1.1f, 10) }), |
| 820 | QuantizedActivationFunctionsDataset, |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 821 | framework::dataset::make("DataLayout", { DataLayout::NCHW }))) |
Sheri Zhang | 681f2d4 | 2020-02-20 11:23:08 +0000 | [diff] [blame] | 822 | { |
| 823 | // Validate output |
| 824 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 825 | } |
| 826 | |
| 827 | TEST_SUITE_END() // QASYMM8_SIGNED |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 828 | TEST_SUITE_END() // Quantized |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 829 | TEST_SUITE_END() // NCHW |
Michalis Spyrou | 064add6 | 2018-11-01 18:14:27 +0000 | [diff] [blame] | 830 | TEST_SUITE_END() // DirectConvolutionLayer |
Gian Marco Iodice | 0841ca0 | 2021-02-01 14:37:02 +0000 | [diff] [blame] | 831 | TEST_SUITE_END() // CL |
| 832 | |
Moritz Pflanzer | b3d2579 | 2017-07-26 11:49:37 +0100 | [diff] [blame] | 833 | } // namespace validation |
| 834 | } // namespace test |
Anthony Barbier | 1c0d0ff | 2018-01-31 13:05:09 +0000 | [diff] [blame] | 835 | } // namespace arm_compute |