Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 1 | /* |
Georgios Pinitas | f72f936 | 2018-01-12 16:29:45 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2018 ARM Limited. |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to |
| 8 | * deal in the Software without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in all |
| 14 | * copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONCLCTION 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/CLDepthwiseConvolutionLayer.h" |
| 28 | #include "tests/CL/CLAccessor.h" |
| 29 | #include "tests/PaddingCalculator.h" |
| 30 | #include "tests/datasets/DepthwiseConvolutionLayerDataset.h" |
| 31 | #include "tests/framework/Asserts.h" |
| 32 | #include "tests/framework/Macros.h" |
| 33 | #include "tests/framework/datasets/Datasets.h" |
| 34 | #include "tests/validation/Validation.h" |
| 35 | #include "tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h" |
| 36 | |
| 37 | namespace arm_compute |
| 38 | { |
| 39 | namespace test |
| 40 | { |
| 41 | namespace validation |
| 42 | { |
| 43 | namespace |
| 44 | { |
Georgios Pinitas | 009fede | 2018-10-26 12:54:21 +0100 | [diff] [blame] | 45 | RelativeTolerance<half_float::half> tolerance_f16(half_float::half(0.01)); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F16 */ |
| 46 | constexpr RelativeTolerance<float> tolerance_f32(0.01f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */ |
Georgios Pinitas | 83e3e75 | 2018-11-07 18:33:08 +0000 | [diff] [blame] | 47 | constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(0); /**< Tolerance value for comparing reference's output against implementation's output for DataType::QASYMM8 */ |
Georgios Pinitas | 009fede | 2018-10-26 12:54:21 +0100 | [diff] [blame] | 48 | constexpr float tolerance_num = 0.05f; /**< Tolerance number */ |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 49 | |
| 50 | const auto depth_multipliers = framework::dataset::make("DepthMultiplier", { 1, 2, 3 }); |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 51 | } // namespace |
| 52 | |
| 53 | TEST_SUITE(CL) |
| 54 | TEST_SUITE(DepthwiseConvolutionLayer) |
| 55 | |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 56 | // *INDENT-OFF* |
| 57 | // clang-format off |
| 58 | DATA_TEST_CASE(Validate3x3, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip( |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 59 | framework::dataset::make("InputInfo", { TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching data type input/weights |
| 60 | TensorInfo(TensorShape(32U, 18U, 3U), 1, DataType::F32), // Mismatching input feature maps |
| 61 | TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Unsupported weights dimensions |
| 62 | TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::QASYMM8), // Unsupported activation |
| 63 | TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching depth multiplier |
| 64 | TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid stride |
| 65 | TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases size |
| 66 | TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases dimensions |
| 67 | TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid output size |
| 68 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Window shrink |
| 69 | TensorInfo(TensorShape(32U, 18U, 8U), 1, DataType::F32), |
| 70 | TensorInfo(TensorShape(50U, 32U, 8U), 1, DataType::QASYMM8), |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 71 | }), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 72 | framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16), |
| 73 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 74 | TensorInfo(TensorShape(5U, 5U, 2U), 1, DataType::F32), |
| 75 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::QASYMM8), |
| 76 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 77 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 78 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 79 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 80 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 81 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 82 | TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32), |
| 83 | TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8), |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 84 | })), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 85 | framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 86 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 87 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 88 | TensorInfo(TensorShape(2U), 1, DataType::S32), |
| 89 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 90 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 91 | TensorInfo(TensorShape(4U), 1, DataType::F32), |
| 92 | TensorInfo(TensorShape(2U, 2U), 1, DataType::F32), |
| 93 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 94 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 95 | TensorInfo(TensorShape(16U), 1, DataType::F32), |
| 96 | TensorInfo(TensorShape(24U), 1, DataType::S32), |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 97 | })), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 98 | framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32), |
| 99 | TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32), |
| 100 | TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32), |
| 101 | TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::QASYMM8), |
| 102 | TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32), |
| 103 | TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32), |
| 104 | TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32), |
| 105 | TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32), |
| 106 | TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), |
| 107 | TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), |
| 108 | TensorInfo(TensorShape(30U, 16U, 16U), 1, DataType::F32), |
| 109 | TensorInfo(TensorShape(48U, 30U, 24U), 1, DataType::QASYMM8), |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 110 | })), |
| 111 | framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0), |
| 112 | PadStrideInfo(1, 1, 0, 0), |
| 113 | PadStrideInfo(1, 1, 0, 0), |
| 114 | PadStrideInfo(1, 1, 0, 0), |
| 115 | PadStrideInfo(1, 1, 0, 0), |
| 116 | PadStrideInfo(4, 1, 0, 0), |
| 117 | PadStrideInfo(1, 1, 0, 0), |
| 118 | PadStrideInfo(1, 1, 0, 0), |
| 119 | PadStrideInfo(1, 1, 0, 0), |
| 120 | PadStrideInfo(1, 1, 0, 0), |
| 121 | PadStrideInfo(1, 1, 0, 0), |
| 122 | PadStrideInfo(1, 1, 0, 0), |
| 123 | })), |
| 124 | framework::dataset::make("DepthMultiplier", { 1, |
| 125 | 1, |
| 126 | 1, |
| 127 | 1, |
| 128 | 3, |
| 129 | 1, |
| 130 | 1, |
| 131 | 1, |
| 132 | 1, |
| 133 | 1, |
| 134 | 2, |
| 135 | 3, |
| 136 | })), |
| 137 | framework::dataset::make("ActivationInfo", { ActivationLayerInfo(), |
| 138 | ActivationLayerInfo(), |
| 139 | ActivationLayerInfo(), |
| 140 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LINEAR), |
| 141 | ActivationLayerInfo(), |
| 142 | ActivationLayerInfo(), |
| 143 | ActivationLayerInfo(), |
| 144 | ActivationLayerInfo(), |
| 145 | ActivationLayerInfo(), |
| 146 | ActivationLayerInfo(), |
| 147 | ActivationLayerInfo(), |
| 148 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 149 | })), |
| 150 | framework::dataset::make("Expected", { false, false, false, false, false, false, false, false, false, false, true, true })), |
| 151 | input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier, act_info, expected) |
| 152 | { |
| 153 | bool is_valid = bool(CLDepthwiseConvolutionLayer3x3::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, depth_multiplier, act_info)); |
| 154 | ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS); |
| 155 | } |
| 156 | |
| 157 | DATA_TEST_CASE(ValidateGeneric, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip( |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 158 | framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/weights |
| 159 | TensorInfo(TensorShape(27U, 13U, 3U), 1, DataType::F32), // Mismatching input feature maps |
| 160 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching depth multiplier |
| 161 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases size |
| 162 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases dimensions |
| 163 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid output size |
| 164 | TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32), |
| 165 | TensorInfo(TensorShape(32U, 13U, 8U), 1, DataType::QASYMM8), |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 166 | }), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 167 | framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16), |
| 168 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 169 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 170 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 171 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 172 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 173 | TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32), |
| 174 | TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8), |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 175 | })), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 176 | framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 177 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 178 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 179 | TensorInfo(TensorShape(4U), 1, DataType::F32), |
| 180 | TensorInfo(TensorShape(2U, 2U), 1, DataType::F32), |
| 181 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 182 | TensorInfo(TensorShape(16U), 1, DataType::F32), |
| 183 | TensorInfo(TensorShape(24U), 1, DataType::S32), |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 184 | })), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 185 | framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), |
| 186 | TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), |
| 187 | TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), |
| 188 | TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), |
| 189 | TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), |
| 190 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), |
| 191 | TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32), |
| 192 | TensorInfo(TensorShape(32U, 11U, 24U), 1, DataType::QASYMM8), |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 193 | })), |
| 194 | framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0), |
| 195 | PadStrideInfo(1, 1, 0, 0), |
| 196 | PadStrideInfo(1, 1, 0, 0), |
| 197 | PadStrideInfo(1, 1, 0, 0), |
| 198 | PadStrideInfo(1, 1, 0, 0), |
| 199 | PadStrideInfo(1, 1, 0, 0), |
| 200 | PadStrideInfo(1, 1, 0, 0), |
| 201 | PadStrideInfo(1, 1, 1, 0), |
| 202 | })), |
| 203 | framework::dataset::make("DepthMultiplier", { 1, |
| 204 | 1, |
| 205 | 3, |
| 206 | 1, |
| 207 | 1, |
| 208 | 1, |
| 209 | 2, |
| 210 | 3, |
| 211 | })), |
| 212 | framework::dataset::make("Expected", { false, false, false, false, false, false, true, true })), |
| 213 | input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier, expected) |
| 214 | { |
| 215 | bool is_valid = bool(CLDepthwiseConvolutionLayer::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, depth_multiplier)); |
| 216 | ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS); |
| 217 | } |
| 218 | // clang-format on |
| 219 | // *INDENT-ON* |
| 220 | |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 221 | template <typename T> |
| 222 | using CLDepthwiseConvolutionLayerFixture = DepthwiseConvolutionLayerValidationFixture<CLTensor, CLAccessor, CLDepthwiseConvolutionLayer, T>; |
| 223 | |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 224 | template <typename T> |
| 225 | using CLDepthwiseConvolutionLayerFixture3x3 = DepthwiseConvolutionLayerValidationFixture<CLTensor, CLAccessor, CLDepthwiseConvolutionLayer3x3, T>; |
| 226 | |
| 227 | TEST_SUITE(Float) |
Michele Di Giorgio | d24af8a | 2018-05-08 17:23:52 +0100 | [diff] [blame] | 228 | TEST_SUITE(FP16) |
Michele Di Giorgio | 933fe86 | 2018-02-19 15:42:12 +0000 | [diff] [blame] | 229 | TEST_SUITE(W3x3) |
Giorgio Arena | e6bb3c6 | 2018-08-23 11:19:11 +0100 | [diff] [blame] | 230 | TEST_SUITE(NCHW) |
Giorgio Arena | dfca60b | 2018-01-31 10:30:59 +0000 | [diff] [blame] | 231 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::ALL, |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 232 | combine(combine(combine(framework::dataset::concat(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), |
| 233 | datasets::SmallDepthwiseConvolutionLayerDataset3x3NCHW()), |
| 234 | depth_multipliers), |
Giorgio Arena | dfca60b | 2018-01-31 10:30:59 +0000 | [diff] [blame] | 235 | framework::dataset::make("DataType", |
| 236 | DataType::F16)), |
| 237 | framework::dataset::make("DataLayout", DataLayout::NCHW))) |
Michele Di Giorgio | 933fe86 | 2018-02-19 15:42:12 +0000 | [diff] [blame] | 238 | { |
| 239 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 240 | } |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 241 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 242 | depth_multipliers), |
Michele Di Giorgio | 933fe86 | 2018-02-19 15:42:12 +0000 | [diff] [blame] | 243 | framework::dataset::make("DataType", |
Giorgio Arena | 1ed1fc6 | 2018-03-26 16:20:05 +0100 | [diff] [blame] | 244 | DataType::F16)), |
| 245 | framework::dataset::make("DataLayout", DataLayout::NCHW))) |
Michele Di Giorgio | 933fe86 | 2018-02-19 15:42:12 +0000 | [diff] [blame] | 246 | { |
| 247 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 248 | } |
| 249 | TEST_SUITE_END() |
Michele Di Giorgio | d24af8a | 2018-05-08 17:23:52 +0100 | [diff] [blame] | 250 | |
Giorgio Arena | e6bb3c6 | 2018-08-23 11:19:11 +0100 | [diff] [blame] | 251 | TEST_SUITE(NHWC) |
| 252 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::ALL, |
| 253 | combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), |
| 254 | framework::dataset::make("DepthMultiplier", 1)), // COMPMID-1071 Add depth multiplier support for NHWC |
| 255 | framework::dataset::make("DataType", |
| 256 | DataType::F16)), |
| 257 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 258 | { |
| 259 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 260 | } |
| 261 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 262 | framework::dataset::make("DepthMultiplier", 1)), // COMPMID-1071 Add depth multiplier support for NHWC |
| 263 | framework::dataset::make("DataType", |
| 264 | DataType::F16)), |
| 265 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 266 | { |
| 267 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 268 | } |
| 269 | TEST_SUITE_END() |
| 270 | TEST_SUITE_END() |
| 271 | |
Michele Di Giorgio | d24af8a | 2018-05-08 17:23:52 +0100 | [diff] [blame] | 272 | TEST_SUITE(Generic) |
| 273 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), depth_multipliers), |
| 274 | framework::dataset::make("DataType", |
| 275 | DataType::F16)), |
Giorgio Arena | d051e97 | 2018-06-20 11:46:42 +0100 | [diff] [blame] | 276 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Michele Di Giorgio | d24af8a | 2018-05-08 17:23:52 +0100 | [diff] [blame] | 277 | { |
| 278 | validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num); |
| 279 | } |
| 280 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(), |
| 281 | depth_multipliers), |
| 282 | framework::dataset::make("DataType", |
| 283 | DataType::F16)), |
Giorgio Arena | d051e97 | 2018-06-20 11:46:42 +0100 | [diff] [blame] | 284 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Michele Di Giorgio | d24af8a | 2018-05-08 17:23:52 +0100 | [diff] [blame] | 285 | { |
| 286 | validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num); |
| 287 | } |
| 288 | TEST_SUITE_END() |
Michele Di Giorgio | 933fe86 | 2018-02-19 15:42:12 +0000 | [diff] [blame] | 289 | TEST_SUITE_END() |
| 290 | |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 291 | TEST_SUITE(FP32) |
| 292 | TEST_SUITE(W3x3) |
Giorgio Arena | d051e97 | 2018-06-20 11:46:42 +0100 | [diff] [blame] | 293 | TEST_SUITE(NCHW) |
Giorgio Arena | dfca60b | 2018-01-31 10:30:59 +0000 | [diff] [blame] | 294 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::ALL, |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 295 | combine(combine(combine(framework::dataset::concat(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), |
| 296 | datasets::SmallDepthwiseConvolutionLayerDataset3x3NCHW()), |
| 297 | depth_multipliers), |
Giorgio Arena | dfca60b | 2018-01-31 10:30:59 +0000 | [diff] [blame] | 298 | framework::dataset::make("DataType", |
| 299 | DataType::F32)), |
| 300 | framework::dataset::make("DataLayout", DataLayout::NCHW))) |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 301 | { |
| 302 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 303 | } |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 304 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 305 | depth_multipliers), |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 306 | framework::dataset::make("DataType", |
Giorgio Arena | 1ed1fc6 | 2018-03-26 16:20:05 +0100 | [diff] [blame] | 307 | DataType::F32)), |
| 308 | framework::dataset::make("DataLayout", DataLayout::NCHW))) |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 309 | { |
| 310 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 311 | } |
| 312 | TEST_SUITE_END() |
Giorgio Arena | d051e97 | 2018-06-20 11:46:42 +0100 | [diff] [blame] | 313 | TEST_SUITE(NHWC) |
| 314 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::ALL, |
| 315 | combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), |
| 316 | framework::dataset::make("DepthMultiplier", 1)), // COMPMID-1071 Add depth multiplier support for NHWC |
| 317 | framework::dataset::make("DataType", |
| 318 | DataType::F32)), |
| 319 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 320 | { |
| 321 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 322 | } |
| 323 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 324 | framework::dataset::make("DepthMultiplier", 1)), // COMPMID-1071 Add depth multiplier support for NHWC |
| 325 | framework::dataset::make("DataType", |
| 326 | DataType::F32)), |
| 327 | framework::dataset::make("DataLayout", DataLayout::NHWC))) |
| 328 | { |
| 329 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 330 | } |
| 331 | TEST_SUITE_END() |
| 332 | TEST_SUITE_END() |
Michele Di Giorgio | d24af8a | 2018-05-08 17:23:52 +0100 | [diff] [blame] | 333 | |
| 334 | TEST_SUITE(Generic) |
| 335 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), depth_multipliers), |
| 336 | framework::dataset::make("DataType", |
| 337 | DataType::F32)), |
Giorgio Arena | d051e97 | 2018-06-20 11:46:42 +0100 | [diff] [blame] | 338 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Michele Di Giorgio | d24af8a | 2018-05-08 17:23:52 +0100 | [diff] [blame] | 339 | { |
| 340 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 341 | } |
| 342 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(), |
| 343 | depth_multipliers), |
| 344 | framework::dataset::make("DataType", |
| 345 | DataType::F32)), |
Giorgio Arena | d051e97 | 2018-06-20 11:46:42 +0100 | [diff] [blame] | 346 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Michele Di Giorgio | d24af8a | 2018-05-08 17:23:52 +0100 | [diff] [blame] | 347 | { |
| 348 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 349 | } |
| 350 | TEST_SUITE_END() |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 351 | TEST_SUITE_END() |
| 352 | TEST_SUITE_END() |
| 353 | |
| 354 | template <typename T> |
Georgios Pinitas | de5a1cc | 2018-02-02 12:52:07 +0000 | [diff] [blame] | 355 | using CLDepthwiseConvolutionLayerQuantizedFixture = DepthwiseConvolutionLayerValidationQuantizedFixture<CLTensor, CLAccessor, CLDepthwiseConvolutionLayer, T>; |
| 356 | template <typename T> |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 357 | using CLDepthwiseConvolutionLayerQuantizedFixture3x3 = DepthwiseConvolutionLayerValidationQuantizedFixture<CLTensor, CLAccessor, CLDepthwiseConvolutionLayer3x3, T>; |
| 358 | |
| 359 | TEST_SUITE(Quantized) |
| 360 | TEST_SUITE(QASYMM8) |
Georgios Pinitas | de5a1cc | 2018-02-02 12:52:07 +0000 | [diff] [blame] | 361 | TEST_SUITE(Generic) |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 362 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 363 | combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), |
| 364 | depth_multipliers), |
| 365 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 366 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
Giorgio Arena | d051e97 | 2018-06-20 11:46:42 +0100 | [diff] [blame] | 367 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Georgios Pinitas | de5a1cc | 2018-02-02 12:52:07 +0000 | [diff] [blame] | 368 | { |
| 369 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 370 | } |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 371 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 372 | combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(), |
| 373 | depth_multipliers), |
| 374 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 375 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
Giorgio Arena | d051e97 | 2018-06-20 11:46:42 +0100 | [diff] [blame] | 376 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Georgios Pinitas | de5a1cc | 2018-02-02 12:52:07 +0000 | [diff] [blame] | 377 | { |
| 378 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 379 | } |
| 380 | TEST_SUITE_END() |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 381 | TEST_SUITE(W3x3) |
Giorgio Arena | dfca60b | 2018-01-31 10:30:59 +0000 | [diff] [blame] | 382 | FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::PRECOMMIT, |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 383 | combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), |
| 384 | framework::dataset::make("DepthMultiplier", 1)), // COMPMID-1071 Add depth multiplier support for NHWC |
Giorgio Arena | dfca60b | 2018-01-31 10:30:59 +0000 | [diff] [blame] | 385 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 386 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 387 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 388 | { |
| 389 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 390 | } |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 391 | FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 392 | combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 393 | framework::dataset::make("DepthMultiplier", 1)), // COMPMID-1071 Add depth multiplier support for NHWC |
| 394 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 395 | framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 396 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC }))) |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 397 | { |
| 398 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 399 | } |
| 400 | TEST_SUITE_END() |
| 401 | TEST_SUITE_END() |
| 402 | TEST_SUITE_END() |
| 403 | |
| 404 | TEST_SUITE_END() |
| 405 | TEST_SUITE_END() |
| 406 | } // namespace validation |
| 407 | } // namespace test |
| 408 | } // namespace arm_compute |