Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 1 | /* |
Gian Marco Iodice | 211a55d | 2022-08-31 11:47:08 +0100 | [diff] [blame^] | 2 | * Copyright (c) 2019-2022 Arm Limited. |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +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 | */ |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 24 | #include "arm_compute/core/KernelDescriptors.h" |
| 25 | #include "arm_compute/core/Types.h" |
| 26 | #include "arm_compute/core/utils/misc/ShapeCalculator.h" |
| 27 | #include "arm_compute/runtime/CL/CLTensor.h" |
| 28 | #include "arm_compute/runtime/CL/CLTensorAllocator.h" |
Sang-Hoon Park | bef7fa2 | 2020-10-21 15:58:54 +0100 | [diff] [blame] | 29 | #include "src/core/CL/kernels/CLDepthwiseConvolutionLayerNativeKernel.h" |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 30 | #include "tests/CL/CLAccessor.h" |
| 31 | #include "tests/CL/Helper.h" |
| 32 | #include "tests/PaddingCalculator.h" |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 33 | #include "tests/framework/Asserts.h" |
| 34 | #include "tests/framework/Macros.h" |
| 35 | #include "tests/framework/datasets/Datasets.h" |
| 36 | #include "tests/validation/Validation.h" |
| 37 | #include "tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h" |
| 38 | |
| 39 | namespace arm_compute |
| 40 | { |
| 41 | namespace test |
| 42 | { |
| 43 | namespace validation |
| 44 | { |
| 45 | using namespace arm_compute::misc::shape_calculator; |
| 46 | |
| 47 | // Create function for CLDepthwiseConvolutionLayerNativeKernel |
| 48 | using CLDepthwiseConvolutionLayerNative = CLSynthetizeFunction<CLDepthwiseConvolutionLayerNativeKernel>; |
| 49 | |
| 50 | // Fixture for CLDepthwiseConvolutionLayerNative |
| 51 | template <typename T> |
| 52 | using CLDepthwiseConvolutionLayerNativeFixture = DepthwiseConvolutionLayerNativeConfigurableValidationFixture<CLTensor, CLAccessor, CLDepthwiseConvolutionLayerNative, T>; |
| 53 | |
| 54 | namespace |
| 55 | { |
| 56 | // *INDENT-OFF* |
| 57 | // clang-format off |
| 58 | RelativeTolerance<float> rel_tolerance_f32(0.001f); |
| 59 | constexpr float abs_tolerance_f32(0.0001f); |
| 60 | |
Giorgio Arena | dac622a | 2019-12-23 15:01:17 +0000 | [diff] [blame] | 61 | RelativeTolerance<half_float::half> rel_tolerance_f16(half_float::half(0.01f)); |
Michele Di Giorgio | 7d7c420 | 2020-02-25 20:13:36 +0000 | [diff] [blame] | 62 | constexpr float abs_tolerance_f16(0.03f); |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 63 | |
| 64 | /** Width values to test - Precommit */ |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 65 | const auto width_values_precommit = framework::dataset::make("width", { 1U, 33U } ); |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 66 | |
| 67 | /** Width values to test - Nightly */ |
| 68 | const auto width_values_nightly = framework::dataset::make("width", { 53U, 47U } ); |
| 69 | |
| 70 | /** Height values to test - Precommit */ |
| 71 | const auto height_values_precommit = framework::dataset::make("height", { 19U } ); |
| 72 | |
| 73 | /** Height values to test - Nightly */ |
| 74 | const auto height_values_nightly = framework::dataset::make("height", { 39U, 43U } ); |
| 75 | |
| 76 | /** Channel values to test - Precommit */ |
| 77 | const auto channel_values_precommit = framework::dataset::make("channels", { 15U }); |
| 78 | |
| 79 | /** Channel values to test - Nightly */ |
| 80 | const auto channel_values_nightly = framework::dataset::make("channels", { 33U, 19U }); |
| 81 | |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 82 | /** Channel values to test with cl_image support - Precommit */ |
| 83 | const auto channel_values_export_to_cl_image_precommit = framework::dataset::make("channels", { 16U }); |
| 84 | |
| 85 | /** Channel values to test with cl_image support - Nightly */ |
| 86 | const auto channel_values_export_to_cl_image_nightly = framework::dataset::make("channels", { 32U }); |
| 87 | |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 88 | /** Batch values to test - Precommit */ |
| 89 | const auto batch_values_precommit = framework::dataset::make("batch", { 1U, 2U }); |
| 90 | |
| 91 | /** Batch values to test - Nightly */ |
| 92 | const auto batch_values_nightly = framework::dataset::make("batch", { 1U, 3U }); |
| 93 | |
| 94 | /** Kernel size values to test - Precommit */ |
| 95 | const auto kernel_sz_values_precommit = framework::dataset::make("kernel_size", { Size2D(1U, 1U), Size2D(1U, 3U), Size2D(5U, 5U) }); |
| 96 | |
| 97 | /** Kernel size values to test - Nightly */ |
| 98 | const auto kernel_sz_values_nightly = framework::dataset::make("kernel_size", { Size2D(3U, 5U), Size2D(5U, 1U), Size2D(1U, 7U), Size2D(9U, 7U) }); |
| 99 | |
| 100 | /** Depth multiplier values to test - All */ |
| 101 | const auto depth_multiplier_values = framework::dataset::make("depth_multiplier", {3U}); |
| 102 | |
| 103 | /** Dilation values to test - All */ |
| 104 | const auto dilation_values = framework::dataset::make("dilation", { Size2D(1U, 1U), Size2D(3U, 3U) }); |
| 105 | |
| 106 | /** Stride values to test - All */ |
| 107 | const auto stride_values = framework::dataset::make("stride", { Size2D(1U, 1U), Size2D(3U, 2U) }); |
| 108 | |
| 109 | /** Padding values to test - All */ |
| 110 | const auto padding_valid_values = framework::dataset::make("padding_valid", { true, false }); |
| 111 | |
| 112 | /** Data type values to test - All */ |
| 113 | const auto data_type_values = framework::dataset::make("data_type", { DataType::F32, DataType::F16 }); |
| 114 | |
| 115 | /** Data layout values to test - All */ |
| 116 | const auto data_layout_values = framework::dataset::make("data_layout", { DataLayout::NHWC }); |
| 117 | |
| 118 | /** N0 values to test - Precommit */ |
| 119 | const auto n0_values_precommit = framework::dataset::make("N0", {2, 4}); |
| 120 | |
| 121 | /** N0 values to test - Nightly */ |
| 122 | const auto n0_values_nightly = framework::dataset::make("N0", {3, 8}); |
| 123 | |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 124 | /** N0 values to test with cl_image support - Precommit */ |
| 125 | const auto n0_values_export_to_cl_image_precommit = framework::dataset::make("N0", {4}); |
| 126 | |
| 127 | /** N0 values to test with cl_image support - Nightly */ |
| 128 | const auto n0_values_export_to_cl_image_nightly = framework::dataset::make("N0", {8}); |
| 129 | |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 130 | /** Activation values to test */ |
| 131 | const auto act_values = framework::dataset::make("Activation", |
| 132 | { |
| 133 | ActivationLayerInfo(), |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 134 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.0f, 0.5f), |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 135 | }); |
| 136 | |
| 137 | } // namespace |
| 138 | |
| 139 | TEST_SUITE(CL) |
| 140 | TEST_SUITE(DepthwiseConvolutionLayerNative) |
| 141 | TEST_SUITE(Float) |
| 142 | TEST_SUITE(FP32) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 143 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<float>, framework::DatasetMode::ALL, |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 144 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 145 | width_values_precommit, |
| 146 | height_values_precommit), |
| 147 | channel_values_precommit), |
| 148 | batch_values_precommit), |
| 149 | kernel_sz_values_precommit), |
| 150 | framework::dataset::make("depth_multiplier", 1)), |
| 151 | dilation_values), |
| 152 | stride_values), |
| 153 | padding_valid_values), |
| 154 | framework::dataset::make("DataType", DataType::F32)), |
| 155 | data_layout_values), |
| 156 | act_values), |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 157 | n0_values_precommit), |
| 158 | framework::dataset::make("ExportToCLImage", false))) |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 159 | { |
| 160 | // Validate output |
| 161 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 162 | } |
| 163 | |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 164 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerNativeFixture<float>, framework::DatasetMode::NIGHTLY, |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 165 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 166 | width_values_nightly, |
| 167 | height_values_nightly), |
| 168 | channel_values_nightly), |
| 169 | batch_values_nightly), |
| 170 | kernel_sz_values_nightly), |
| 171 | framework::dataset::make("depth_multiplier", 1)), |
| 172 | dilation_values), |
| 173 | stride_values), |
| 174 | padding_valid_values), |
| 175 | framework::dataset::make("DataType", DataType::F32)), |
| 176 | data_layout_values), |
| 177 | act_values), |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 178 | n0_values_nightly), |
| 179 | framework::dataset::make("ExportToCLImage", false))) |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 180 | { |
| 181 | // Validate output |
| 182 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 183 | } |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 184 | |
| 185 | TEST_SUITE(ExportWeightsToCLImage) |
| 186 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<float>, framework::DatasetMode::ALL, |
| 187 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 188 | width_values_precommit, |
| 189 | height_values_precommit), |
| 190 | channel_values_export_to_cl_image_precommit), |
| 191 | batch_values_precommit), |
| 192 | kernel_sz_values_precommit), |
| 193 | framework::dataset::make("depth_multiplier", 1)), |
| 194 | dilation_values), |
| 195 | stride_values), |
| 196 | padding_valid_values), |
| 197 | framework::dataset::make("DataType", DataType::F32)), |
| 198 | data_layout_values), |
| 199 | act_values), |
| 200 | n0_values_export_to_cl_image_precommit), |
| 201 | framework::dataset::make("ExportToCLImage", true))) |
| 202 | { |
| 203 | // Validate output |
| 204 | if(_validate_output) |
| 205 | { |
| 206 | // Validate output |
| 207 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 208 | } |
| 209 | else |
| 210 | { |
| 211 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 212 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerNativeFixture<float>, framework::DatasetMode::NIGHTLY, |
| 217 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 218 | width_values_nightly, |
| 219 | height_values_nightly), |
| 220 | channel_values_export_to_cl_image_nightly), |
| 221 | batch_values_nightly), |
| 222 | kernel_sz_values_nightly), |
| 223 | framework::dataset::make("depth_multiplier", 1)), |
| 224 | dilation_values), |
| 225 | stride_values), |
| 226 | padding_valid_values), |
| 227 | framework::dataset::make("DataType", DataType::F32)), |
| 228 | data_layout_values), |
| 229 | act_values), |
| 230 | n0_values_export_to_cl_image_nightly), |
| 231 | framework::dataset::make("ExportToCLImage", true))) |
| 232 | { |
| 233 | // Validate output |
| 234 | if(_validate_output) |
| 235 | { |
| 236 | // Validate output |
| 237 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 238 | } |
| 239 | else |
| 240 | { |
| 241 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 242 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 243 | } |
| 244 | } |
Gian Marco Iodice | 211a55d | 2022-08-31 11:47:08 +0100 | [diff] [blame^] | 245 | |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 246 | TEST_SUITE_END() // ExportWeightsToCLImage |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 247 | TEST_SUITE_END() // FP32 |
| 248 | |
| 249 | TEST_SUITE(FP16) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 250 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<half>, framework::DatasetMode::ALL, |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 251 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 252 | width_values_precommit, |
| 253 | height_values_precommit), |
| 254 | channel_values_precommit), |
| 255 | batch_values_precommit), |
| 256 | kernel_sz_values_precommit), |
| 257 | framework::dataset::make("depth_multiplier", 1)), |
| 258 | dilation_values), |
| 259 | stride_values), |
| 260 | padding_valid_values), |
| 261 | framework::dataset::make("DataType", DataType::F16)), |
| 262 | data_layout_values), |
| 263 | act_values), |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 264 | n0_values_precommit), |
| 265 | framework::dataset::make("ExportToCLImage", false))) |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 266 | { |
| 267 | // Validate output |
Giorgio Arena | dac622a | 2019-12-23 15:01:17 +0000 | [diff] [blame] | 268 | validate(CLAccessor(_target), _reference, rel_tolerance_f16); |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 269 | } |
| 270 | |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 271 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerNativeFixture<half>, framework::DatasetMode::NIGHTLY, |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 272 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 273 | width_values_nightly, |
| 274 | height_values_nightly), |
| 275 | channel_values_nightly), |
| 276 | batch_values_nightly), |
| 277 | kernel_sz_values_nightly), |
| 278 | framework::dataset::make("depth_multiplier", 1)), |
| 279 | dilation_values), |
| 280 | stride_values), |
| 281 | padding_valid_values), |
| 282 | framework::dataset::make("DataType", DataType::F16)), |
| 283 | data_layout_values), |
| 284 | act_values), |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 285 | n0_values_nightly), |
| 286 | framework::dataset::make("ExportToCLImage", false))) |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 287 | { |
| 288 | // Validate output |
Giorgio Arena | dac622a | 2019-12-23 15:01:17 +0000 | [diff] [blame] | 289 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 290 | } |
Gian Marco Iodice | 211a55d | 2022-08-31 11:47:08 +0100 | [diff] [blame^] | 291 | |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 292 | TEST_SUITE(ExportWeightsToCLImage) |
| 293 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<half>, framework::DatasetMode::ALL, |
| 294 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 295 | width_values_precommit, |
| 296 | height_values_precommit), |
| 297 | channel_values_export_to_cl_image_precommit), |
| 298 | batch_values_precommit), |
| 299 | kernel_sz_values_precommit), |
| 300 | framework::dataset::make("depth_multiplier", 1)), |
| 301 | dilation_values), |
| 302 | stride_values), |
| 303 | padding_valid_values), |
| 304 | framework::dataset::make("DataType", DataType::F16)), |
| 305 | data_layout_values), |
| 306 | act_values), |
| 307 | n0_values_export_to_cl_image_precommit), |
| 308 | framework::dataset::make("ExportToCLImage", true))) |
| 309 | { |
| 310 | // Validate output |
| 311 | if(_validate_output) |
| 312 | { |
| 313 | // Validate output |
| 314 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
| 315 | } |
| 316 | else |
| 317 | { |
| 318 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 319 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerNativeFixture<half>, framework::DatasetMode::NIGHTLY, |
| 324 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 325 | width_values_nightly, |
| 326 | height_values_nightly), |
| 327 | channel_values_export_to_cl_image_nightly), |
| 328 | batch_values_nightly), |
| 329 | kernel_sz_values_nightly), |
| 330 | framework::dataset::make("depth_multiplier", 1)), |
| 331 | dilation_values), |
| 332 | stride_values), |
| 333 | padding_valid_values), |
| 334 | framework::dataset::make("DataType", DataType::F16)), |
| 335 | data_layout_values), |
| 336 | act_values), |
| 337 | n0_values_export_to_cl_image_nightly), |
| 338 | framework::dataset::make("ExportToCLImage", true))) |
| 339 | { |
| 340 | // Validate output |
| 341 | if(_validate_output) |
| 342 | { |
| 343 | // Validate output |
| 344 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
| 345 | } |
| 346 | else |
| 347 | { |
| 348 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 349 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 350 | } |
| 351 | } |
Gian Marco Iodice | 211a55d | 2022-08-31 11:47:08 +0100 | [diff] [blame^] | 352 | |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 353 | TEST_SUITE_END() // ExportWeightsToCLImage |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 354 | TEST_SUITE_END() // FP16 |
| 355 | TEST_SUITE_END() // Float |
| 356 | TEST_SUITE(DepthMultiplier) |
| 357 | TEST_SUITE(Float) |
| 358 | TEST_SUITE(FP32) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 359 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<float>, framework::DatasetMode::ALL, |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 360 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 211a55d | 2022-08-31 11:47:08 +0100 | [diff] [blame^] | 361 | framework::dataset::make("width", { 33U } ), |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 362 | height_values_precommit), |
| 363 | channel_values_precommit), |
| 364 | batch_values_precommit), |
| 365 | kernel_sz_values_precommit), |
| 366 | depth_multiplier_values), |
| 367 | dilation_values), |
| 368 | stride_values), |
| 369 | padding_valid_values), |
| 370 | framework::dataset::make("DataType", DataType::F32)), |
| 371 | data_layout_values), |
| 372 | act_values), |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 373 | framework::dataset::make("N0", 1)), |
| 374 | framework::dataset::make("ExportToCLImage", false))) |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 375 | { |
| 376 | // Validate output |
| 377 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 378 | } |
| 379 | |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 380 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerNativeFixture<float>, framework::DatasetMode::NIGHTLY, |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 381 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 211a55d | 2022-08-31 11:47:08 +0100 | [diff] [blame^] | 382 | framework::dataset::make("width", { 53U } ), |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 383 | height_values_nightly), |
| 384 | channel_values_nightly), |
| 385 | batch_values_nightly), |
| 386 | kernel_sz_values_nightly), |
| 387 | depth_multiplier_values), |
| 388 | dilation_values), |
| 389 | stride_values), |
| 390 | padding_valid_values), |
| 391 | framework::dataset::make("DataType", DataType::F32)), |
| 392 | data_layout_values), |
| 393 | act_values), |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 394 | framework::dataset::make("N0", 1)), |
| 395 | framework::dataset::make("ExportToCLImage", false))) |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 396 | { |
| 397 | // Validate output |
| 398 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 399 | } |
Gian Marco Iodice | 211a55d | 2022-08-31 11:47:08 +0100 | [diff] [blame^] | 400 | |
| 401 | TEST_SUITE(DepthMultiplierMultipleOfOutputChannels) |
| 402 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<float>, framework::DatasetMode::ALL, |
| 403 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 404 | framework::dataset::make("width", { 33U } ), |
| 405 | height_values_precommit), |
| 406 | channel_values_precommit), |
| 407 | batch_values_precommit), |
| 408 | kernel_sz_values_precommit), |
| 409 | framework::dataset::make("depth_multiplier", 2)), |
| 410 | dilation_values), |
| 411 | stride_values), |
| 412 | padding_valid_values), |
| 413 | framework::dataset::make("DataType", DataType::F32)), |
| 414 | data_layout_values), |
| 415 | act_values), |
| 416 | framework::dataset::make("N0", {2})), |
| 417 | framework::dataset::make("ExportToCLImage", false))) |
| 418 | { |
| 419 | // Validate output |
| 420 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 421 | } |
| 422 | |
| 423 | TEST_SUITE(ExportWeightsToCLImage) |
| 424 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<float>, framework::DatasetMode::ALL, |
| 425 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 426 | framework::dataset::make("width", { 33U } ), |
| 427 | height_values_precommit), |
| 428 | channel_values_precommit), |
| 429 | batch_values_precommit), |
| 430 | kernel_sz_values_precommit), |
| 431 | framework::dataset::make("depth_multiplier", 4)), |
| 432 | dilation_values), |
| 433 | stride_values), |
| 434 | padding_valid_values), |
| 435 | framework::dataset::make("DataType", DataType::F32)), |
| 436 | data_layout_values), |
| 437 | act_values), |
| 438 | framework::dataset::make("N0", {4})), |
| 439 | framework::dataset::make("ExportToCLImage", true))) |
| 440 | { |
| 441 | // Validate output |
| 442 | if(_validate_output) |
| 443 | { |
| 444 | // Validate output |
| 445 | validate(CLAccessor(_target), _reference, rel_tolerance_f32, 0.f, abs_tolerance_f32); |
| 446 | } |
| 447 | else |
| 448 | { |
| 449 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 450 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 451 | } |
| 452 | } |
| 453 | TEST_SUITE_END() // ExportWeightsToCLImage |
| 454 | TEST_SUITE_END() // DepthMultiplierMultipleOfOutputChannels |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 455 | TEST_SUITE_END() // FP32 |
| 456 | |
| 457 | TEST_SUITE(FP16) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 458 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<half>, framework::DatasetMode::ALL, |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 459 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 211a55d | 2022-08-31 11:47:08 +0100 | [diff] [blame^] | 460 | framework::dataset::make("width", { 33U } ), |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 461 | height_values_precommit), |
| 462 | channel_values_precommit), |
| 463 | batch_values_precommit), |
| 464 | kernel_sz_values_precommit), |
| 465 | depth_multiplier_values), |
| 466 | dilation_values), |
| 467 | stride_values), |
| 468 | padding_valid_values), |
| 469 | framework::dataset::make("DataType", DataType::F16)), |
| 470 | data_layout_values), |
| 471 | act_values), |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 472 | framework::dataset::make("N0", 1)), |
| 473 | framework::dataset::make("ExportToCLImage", false))) |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 474 | { |
| 475 | // Validate output |
Giorgio Arena | dac622a | 2019-12-23 15:01:17 +0000 | [diff] [blame] | 476 | validate(CLAccessor(_target), _reference, rel_tolerance_f16); |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 477 | } |
| 478 | |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 479 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerNativeFixture<half>, framework::DatasetMode::NIGHTLY, |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 480 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
Gian Marco Iodice | 211a55d | 2022-08-31 11:47:08 +0100 | [diff] [blame^] | 481 | framework::dataset::make("width", { 53U } ), |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 482 | height_values_nightly), |
| 483 | channel_values_nightly), |
| 484 | batch_values_nightly), |
| 485 | kernel_sz_values_nightly), |
| 486 | depth_multiplier_values), |
| 487 | dilation_values), |
| 488 | stride_values), |
| 489 | padding_valid_values), |
| 490 | framework::dataset::make("DataType", DataType::F16)), |
| 491 | data_layout_values), |
| 492 | act_values), |
Gian Marco Iodice | 8155c02 | 2021-04-16 15:08:59 +0100 | [diff] [blame] | 493 | framework::dataset::make("N0", 1)), |
| 494 | framework::dataset::make("ExportToCLImage", false))) |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 495 | { |
| 496 | // Validate output |
Giorgio Arena | dac622a | 2019-12-23 15:01:17 +0000 | [diff] [blame] | 497 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 498 | } |
Gian Marco Iodice | 211a55d | 2022-08-31 11:47:08 +0100 | [diff] [blame^] | 499 | |
| 500 | TEST_SUITE(DepthMultiplierMultipleOfOutputChannels) |
| 501 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<half>, framework::DatasetMode::ALL, |
| 502 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 503 | framework::dataset::make("width", { 33U } ), |
| 504 | height_values_precommit), |
| 505 | channel_values_precommit), |
| 506 | batch_values_precommit), |
| 507 | kernel_sz_values_precommit), |
| 508 | framework::dataset::make("depth_multiplier", 2)), |
| 509 | dilation_values), |
| 510 | stride_values), |
| 511 | padding_valid_values), |
| 512 | framework::dataset::make("DataType", DataType::F16)), |
| 513 | data_layout_values), |
| 514 | act_values), |
| 515 | framework::dataset::make("N0", {2})), |
| 516 | framework::dataset::make("ExportToCLImage", false))) |
| 517 | { |
| 518 | // Validate output |
| 519 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
| 520 | } |
| 521 | |
| 522 | TEST_SUITE(ExportWeightsToCLImage) |
| 523 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerNativeFixture<half>, framework::DatasetMode::ALL, |
| 524 | combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(combine( |
| 525 | framework::dataset::make("width", { 33U } ), |
| 526 | height_values_precommit), |
| 527 | channel_values_precommit), |
| 528 | batch_values_precommit), |
| 529 | kernel_sz_values_precommit), |
| 530 | framework::dataset::make("depth_multiplier", 4)), |
| 531 | dilation_values), |
| 532 | stride_values), |
| 533 | padding_valid_values), |
| 534 | framework::dataset::make("DataType", DataType::F16)), |
| 535 | data_layout_values), |
| 536 | act_values), |
| 537 | framework::dataset::make("N0", {4})), |
| 538 | framework::dataset::make("ExportToCLImage", true))) |
| 539 | { |
| 540 | // Validate output |
| 541 | if(_validate_output) |
| 542 | { |
| 543 | // Validate output |
| 544 | validate(CLAccessor(_target), _reference, rel_tolerance_f16, 0.f, abs_tolerance_f16); |
| 545 | } |
| 546 | else |
| 547 | { |
| 548 | ARM_COMPUTE_TEST_INFO("cl_khr_image2d_from_buffer not supported. TEST skipped"); |
| 549 | framework::ARM_COMPUTE_PRINT_INFO(); |
| 550 | } |
| 551 | } |
| 552 | TEST_SUITE_END() // ExportWeightsToCLImage |
| 553 | TEST_SUITE_END() // DepthMultiplierMultipleOfOutputChannels |
Gian Marco Iodice | 9285adb | 2019-09-05 16:10:27 +0100 | [diff] [blame] | 554 | TEST_SUITE_END() // FP16 |
| 555 | TEST_SUITE_END() // Float |
| 556 | TEST_SUITE_END() // DepthMultiplier |
| 557 | TEST_SUITE_END() // DepthwiseConvolutionLayerNative |
| 558 | TEST_SUITE_END() // CL |
| 559 | } // namespace validation |
| 560 | } // namespace test |
| 561 | } // namespace arm_compute |