Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 1 | /* |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2021 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, |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 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" |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 31 | #include "tests/datasets/DilatedDepthwiseConvolutionLayerDataset.h" |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 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/DepthwiseConvolutionLayerFixture.h" |
| 37 | |
| 38 | namespace arm_compute |
| 39 | { |
| 40 | namespace test |
| 41 | { |
| 42 | namespace validation |
| 43 | { |
| 44 | namespace |
| 45 | { |
Georgios Pinitas | 009fede | 2018-10-26 12:54:21 +0100 | [diff] [blame] | 46 | 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 */ |
| 47 | 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] | 48 | 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] | 49 | constexpr float tolerance_num = 0.05f; /**< Tolerance number */ |
Giorgio Arena | 7657224 | 2018-04-04 17:44:26 +0100 | [diff] [blame] | 50 | |
Michele Di Giorgio | 601ba3f | 2019-08-22 16:20:04 +0100 | [diff] [blame] | 51 | const auto depth_multipliers = framework::dataset::make("DepthMultiplier", { 1, 2, 5 }); |
Matthew Jackson | 6c2eac1 | 2019-07-23 10:43:10 +0100 | [diff] [blame] | 52 | const auto large_depth_multipliers = framework::dataset::make("DepthMultiplier", { 1, 2, 5, 8 }); |
Manuel Bottini | a788c2f | 2019-04-08 13:18:00 +0100 | [diff] [blame] | 53 | |
| 54 | //Activation Functions |
| 55 | const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo", |
| 56 | { |
| 57 | ActivationLayerInfo(), |
Michele Di Giorgio | 17b7102 | 2020-11-16 13:10:07 +0000 | [diff] [blame] | 58 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), |
| 59 | ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 6.f, 0.f) |
Manuel Bottini | a788c2f | 2019-04-08 13:18:00 +0100 | [diff] [blame] | 60 | }); |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 61 | } // namespace |
| 62 | |
| 63 | TEST_SUITE(CL) |
| 64 | TEST_SUITE(DepthwiseConvolutionLayer) |
| 65 | |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 66 | // *INDENT-OFF* |
| 67 | // clang-format off |
Manuel Bottini | 387259a | 2020-05-21 17:14:36 +0100 | [diff] [blame] | 68 | DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip( |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 69 | framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/weights |
| 70 | TensorInfo(TensorShape(27U, 13U, 3U), 1, DataType::F32), // Mismatching input feature maps |
| 71 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching depth multiplier |
| 72 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases size |
| 73 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases dimensions |
| 74 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid output size |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 75 | TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32), // patch size bigger than input width |
| 76 | TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32), // dilation < 1 |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 77 | TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32), |
| 78 | TensorInfo(TensorShape(32U, 13U, 8U), 1, DataType::QASYMM8), |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 79 | }), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 80 | framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16), |
| 81 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 82 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 83 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 84 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 85 | TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32), |
| 86 | TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32), |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 87 | TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32), |
| 88 | TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 89 | TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8), |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 90 | })), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 91 | framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 92 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 93 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 94 | TensorInfo(TensorShape(4U), 1, DataType::F32), |
| 95 | TensorInfo(TensorShape(2U, 2U), 1, DataType::F32), |
| 96 | TensorInfo(TensorShape(2U), 1, DataType::F32), |
| 97 | TensorInfo(TensorShape(16U), 1, DataType::F32), |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 98 | TensorInfo(TensorShape(16U), 1, DataType::F32), |
| 99 | TensorInfo(TensorShape(16U), 1, DataType::F32), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 100 | TensorInfo(TensorShape(24U), 1, DataType::S32), |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 101 | })), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 102 | framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), |
| 103 | TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), |
| 104 | TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), |
| 105 | TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), |
| 106 | TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32), |
| 107 | TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), |
| 108 | TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32), |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 109 | TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32), |
| 110 | TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32), |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 111 | TensorInfo(TensorShape(32U, 11U, 24U), 1, DataType::QASYMM8), |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 112 | })), |
| 113 | framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0), |
| 114 | PadStrideInfo(1, 1, 0, 0), |
| 115 | PadStrideInfo(1, 1, 0, 0), |
| 116 | PadStrideInfo(1, 1, 0, 0), |
| 117 | PadStrideInfo(1, 1, 0, 0), |
| 118 | PadStrideInfo(1, 1, 0, 0), |
| 119 | PadStrideInfo(1, 1, 0, 0), |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 120 | PadStrideInfo(1, 1, 0, 0), |
| 121 | PadStrideInfo(1, 1, 0, 0), |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 122 | PadStrideInfo(1, 1, 1, 0), |
| 123 | })), |
| 124 | framework::dataset::make("DepthMultiplier", { 1, |
| 125 | 1, |
| 126 | 3, |
| 127 | 1, |
| 128 | 1, |
| 129 | 1, |
| 130 | 2, |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 131 | 2, |
| 132 | 2, |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 133 | 3, |
| 134 | })), |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 135 | framework::dataset::make("Dilation", { Size2D(1U, 1U), |
| 136 | Size2D(1U, 1U), |
| 137 | Size2D(1U, 1U), |
| 138 | Size2D(1U, 1U), |
| 139 | Size2D(1U, 1U), |
| 140 | Size2D(1U, 1U), |
| 141 | Size2D(20U, 1U), |
| 142 | Size2D(0U, 1U), |
| 143 | Size2D(1U, 1U), |
| 144 | Size2D(1U, 1U), |
| 145 | })), |
| 146 | framework::dataset::make("Expected", { false, false, false, false, false, false, false, false, true, true })), |
| 147 | input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier, dilation, expected) |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 148 | { |
Michele Di Giorgio | 601ba3f | 2019-08-22 16:20:04 +0100 | [diff] [blame] | 149 | bool is_valid = bool(CLDepthwiseConvolutionLayer::validate(&input_info.clone()->set_is_resizable(true), &weights_info.clone()->set_is_resizable(true), &biases_info.clone()->set_is_resizable(true), &output_info.clone()->set_is_resizable(true), conv_info, depth_multiplier,ActivationLayerInfo(), dilation)); |
Giorgio Arena | ad0c738 | 2018-04-23 16:16:21 +0100 | [diff] [blame] | 150 | ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS); |
| 151 | } |
| 152 | // clang-format on |
| 153 | // *INDENT-ON* |
| 154 | |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 155 | template <typename T> |
| 156 | using CLDepthwiseConvolutionLayerFixture = DepthwiseConvolutionLayerValidationFixture<CLTensor, CLAccessor, CLDepthwiseConvolutionLayer, T>; |
| 157 | |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 158 | TEST_SUITE(Float) |
Michele Di Giorgio | d24af8a | 2018-05-08 17:23:52 +0100 | [diff] [blame] | 159 | TEST_SUITE(FP16) |
Michele Di Giorgio | 933fe86 | 2018-02-19 15:42:12 +0000 | [diff] [blame] | 160 | TEST_SUITE(W3x3) |
Giorgio Arena | e6bb3c6 | 2018-08-23 11:19:11 +0100 | [diff] [blame] | 161 | TEST_SUITE(NCHW) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 162 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, |
| 163 | combine(combine(combine(combine(framework::dataset::concat(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), |
| 164 | datasets::SmallDepthwiseConvolutionLayerDataset3x3NCHW()), |
| 165 | depth_multipliers), |
| 166 | framework::dataset::make("DataType", |
| 167 | DataType::F16)), |
| 168 | framework::dataset::make("DataLayout", DataLayout::NCHW)), |
| 169 | ActivationFunctionsDataset)) |
Michele Di Giorgio | 933fe86 | 2018-02-19 15:42:12 +0000 | [diff] [blame] | 170 | { |
| 171 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 172 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 173 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 174 | large_depth_multipliers), |
| 175 | framework::dataset::make("DataType", |
| 176 | DataType::F16)), |
| 177 | framework::dataset::make("DataLayout", DataLayout::NCHW)), |
| 178 | ActivationFunctionsDataset)) |
Michele Di Giorgio | 933fe86 | 2018-02-19 15:42:12 +0000 | [diff] [blame] | 179 | { |
| 180 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 181 | } |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 182 | TEST_SUITE(Dilation) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 183 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(), |
| 184 | depth_multipliers), |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 185 | framework::dataset::make("DataType", |
| 186 | DataType::F16)), |
Manuel Bottini | a788c2f | 2019-04-08 13:18:00 +0100 | [diff] [blame] | 187 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
| 188 | ActivationFunctionsDataset)) |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 189 | { |
| 190 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 191 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 192 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, |
| 193 | combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(), |
| 194 | large_depth_multipliers), |
| 195 | framework::dataset::make("DataType", |
| 196 | DataType::F16)), |
| 197 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
| 198 | ActivationFunctionsDataset)) |
| 199 | { |
| 200 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 201 | } |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 202 | TEST_SUITE_END() // Dilation |
| 203 | TEST_SUITE_END() // NCHW |
Michele Di Giorgio | d24af8a | 2018-05-08 17:23:52 +0100 | [diff] [blame] | 204 | |
Giorgio Arena | e6bb3c6 | 2018-08-23 11:19:11 +0100 | [diff] [blame] | 205 | TEST_SUITE(NHWC) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 206 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, |
| 207 | combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), |
| 208 | depth_multipliers), |
| 209 | framework::dataset::make("DataType", |
| 210 | DataType::F16)), |
| 211 | framework::dataset::make("DataLayout", DataLayout::NHWC)), |
| 212 | ActivationFunctionsDataset)) |
Giorgio Arena | e6bb3c6 | 2018-08-23 11:19:11 +0100 | [diff] [blame] | 213 | { |
| 214 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 215 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 216 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 217 | large_depth_multipliers), |
| 218 | framework::dataset::make("DataType", |
| 219 | DataType::F16)), |
| 220 | framework::dataset::make("DataLayout", DataLayout::NHWC)), |
| 221 | ActivationFunctionsDataset)) |
Giorgio Arena | e6bb3c6 | 2018-08-23 11:19:11 +0100 | [diff] [blame] | 222 | { |
| 223 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 224 | } |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 225 | TEST_SUITE(Dilation) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 226 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(), |
| 227 | depth_multipliers), |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 228 | framework::dataset::make("DataType", |
| 229 | DataType::F16)), |
Manuel Bottini | a788c2f | 2019-04-08 13:18:00 +0100 | [diff] [blame] | 230 | framework::dataset::make("DataLayout", { DataLayout::NHWC })), |
| 231 | ActivationFunctionsDataset)) |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 232 | { |
| 233 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 234 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 235 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, |
| 236 | combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(), |
| 237 | large_depth_multipliers), |
| 238 | framework::dataset::make("DataType", |
| 239 | DataType::F16)), |
| 240 | framework::dataset::make("DataLayout", { DataLayout::NHWC })), |
| 241 | ActivationFunctionsDataset)) |
| 242 | { |
| 243 | validate(CLAccessor(_target), _reference, tolerance_f16); |
| 244 | } |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 245 | TEST_SUITE_END() // Dilation |
| 246 | TEST_SUITE_END() // NHWC |
| 247 | TEST_SUITE_END() // W3x3 |
Giorgio Arena | e6bb3c6 | 2018-08-23 11:19:11 +0100 | [diff] [blame] | 248 | |
Michele Di Giorgio | d24af8a | 2018-05-08 17:23:52 +0100 | [diff] [blame] | 249 | TEST_SUITE(Generic) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 250 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), |
| 251 | depth_multipliers), |
Michele Di Giorgio | d24af8a | 2018-05-08 17:23:52 +0100 | [diff] [blame] | 252 | framework::dataset::make("DataType", |
| 253 | DataType::F16)), |
Manuel Bottini | a788c2f | 2019-04-08 13:18:00 +0100 | [diff] [blame] | 254 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 255 | ActivationFunctionsDataset)) |
Michele Di Giorgio | d24af8a | 2018-05-08 17:23:52 +0100 | [diff] [blame] | 256 | { |
| 257 | validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num); |
| 258 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 259 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(), |
| 260 | large_depth_multipliers), |
| 261 | framework::dataset::make("DataType", |
| 262 | DataType::F16)), |
| 263 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 264 | ActivationFunctionsDataset)) |
| 265 | { |
| 266 | validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num); |
| 267 | } |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 268 | |
| 269 | TEST_SUITE(Dilation) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 270 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(), |
| 271 | depth_multipliers), |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 272 | framework::dataset::make("DataType", |
| 273 | DataType::F16)), |
Manuel Bottini | a788c2f | 2019-04-08 13:18:00 +0100 | [diff] [blame] | 274 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 275 | ActivationFunctionsDataset)) |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 276 | { |
| 277 | validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num); |
| 278 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 279 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, |
| 280 | combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(), |
| 281 | large_depth_multipliers), |
| 282 | framework::dataset::make("DataType", |
| 283 | DataType::F16)), |
| 284 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 285 | ActivationFunctionsDataset)) |
| 286 | { |
| 287 | validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num); |
| 288 | } |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 289 | TEST_SUITE_END() // Dilation |
| 290 | TEST_SUITE_END() // Generic |
| 291 | TEST_SUITE_END() // FP16 |
Michele Di Giorgio | 933fe86 | 2018-02-19 15:42:12 +0000 | [diff] [blame] | 292 | |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 293 | TEST_SUITE(FP32) |
| 294 | TEST_SUITE(W3x3) |
Giorgio Arena | d051e97 | 2018-06-20 11:46:42 +0100 | [diff] [blame] | 295 | TEST_SUITE(NCHW) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 296 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL, |
| 297 | combine(combine(combine(combine(framework::dataset::concat(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), |
| 298 | datasets::SmallDepthwiseConvolutionLayerDataset3x3NCHW()), |
| 299 | depth_multipliers), |
| 300 | framework::dataset::make("DataType", |
| 301 | DataType::F32)), |
| 302 | framework::dataset::make("DataLayout", DataLayout::NCHW)), |
| 303 | ActivationFunctionsDataset)) |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 304 | { |
| 305 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 306 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 307 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 308 | large_depth_multipliers), |
| 309 | framework::dataset::make("DataType", |
| 310 | DataType::F32)), |
| 311 | framework::dataset::make("DataLayout", DataLayout::NCHW)), |
| 312 | ActivationFunctionsDataset)) |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 313 | { |
| 314 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 315 | } |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 316 | TEST_SUITE(Dilation) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 317 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL, |
| 318 | combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(), depth_multipliers), |
| 319 | framework::dataset::make("DataType", |
| 320 | DataType::F32)), |
| 321 | framework::dataset::make("DataLayout", DataLayout::NCHW)), |
| 322 | ActivationFunctionsDataset)) |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 323 | { |
| 324 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 325 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 326 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, |
| 327 | combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(), |
| 328 | large_depth_multipliers), |
| 329 | framework::dataset::make("DataType", |
| 330 | DataType::F32)), |
| 331 | framework::dataset::make("DataLayout", DataLayout::NCHW)), |
| 332 | ActivationFunctionsDataset)) |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 333 | { |
| 334 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 335 | } |
| 336 | |
| 337 | TEST_SUITE_END() // Dilation |
| 338 | TEST_SUITE_END() // NCHW |
Giorgio Arena | d051e97 | 2018-06-20 11:46:42 +0100 | [diff] [blame] | 339 | TEST_SUITE(NHWC) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 340 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL, |
| 341 | combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), |
| 342 | depth_multipliers), |
| 343 | framework::dataset::make("DataType", |
| 344 | DataType::F32)), |
| 345 | framework::dataset::make("DataLayout", DataLayout::NHWC)), |
| 346 | ActivationFunctionsDataset)) |
Giorgio Arena | d051e97 | 2018-06-20 11:46:42 +0100 | [diff] [blame] | 347 | { |
| 348 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 349 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 350 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 351 | large_depth_multipliers), |
| 352 | framework::dataset::make("DataType", |
| 353 | DataType::F32)), |
| 354 | framework::dataset::make("DataLayout", DataLayout::NHWC)), |
| 355 | ActivationFunctionsDataset)) |
Giorgio Arena | d051e97 | 2018-06-20 11:46:42 +0100 | [diff] [blame] | 356 | { |
| 357 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 358 | } |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 359 | TEST_SUITE(Dilation) |
| 360 | |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 361 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL, |
| 362 | combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(), |
| 363 | depth_multipliers), |
| 364 | framework::dataset::make("DataType", |
| 365 | DataType::F32)), |
| 366 | framework::dataset::make("DataLayout", DataLayout::NHWC)), |
| 367 | ActivationFunctionsDataset)) |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 368 | { |
| 369 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 370 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 371 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, |
| 372 | combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(), |
| 373 | large_depth_multipliers), |
| 374 | framework::dataset::make("DataType", |
| 375 | DataType::F32)), |
| 376 | framework::dataset::make("DataLayout", DataLayout::NHWC)), |
| 377 | ActivationFunctionsDataset)) |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 378 | { |
| 379 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 380 | } |
| 381 | TEST_SUITE_END() // Dilation |
| 382 | TEST_SUITE_END() // NHWC |
| 383 | TEST_SUITE_END() // W3x3 |
Michele Di Giorgio | d24af8a | 2018-05-08 17:23:52 +0100 | [diff] [blame] | 384 | |
| 385 | TEST_SUITE(Generic) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 386 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), |
| 387 | depth_multipliers), |
Michele Di Giorgio | d24af8a | 2018-05-08 17:23:52 +0100 | [diff] [blame] | 388 | framework::dataset::make("DataType", |
| 389 | DataType::F32)), |
Manuel Bottini | a788c2f | 2019-04-08 13:18:00 +0100 | [diff] [blame] | 390 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 391 | ActivationFunctionsDataset)) |
Michele Di Giorgio | d24af8a | 2018-05-08 17:23:52 +0100 | [diff] [blame] | 392 | { |
| 393 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 394 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 395 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(), |
| 396 | large_depth_multipliers), |
| 397 | framework::dataset::make("DataType", |
| 398 | DataType::F32)), |
| 399 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 400 | ActivationFunctionsDataset)) |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 401 | { |
| 402 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 403 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 404 | |
| 405 | TEST_SUITE(Dilation) |
| 406 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(), |
| 407 | depth_multipliers), |
| 408 | framework::dataset::make("DataType", |
| 409 | DataType::F32)), |
| 410 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 411 | ActivationFunctionsDataset)) |
| 412 | { |
| 413 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 414 | } |
| 415 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, |
| 416 | combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(), |
| 417 | large_depth_multipliers), |
| 418 | framework::dataset::make("DataType", |
| 419 | DataType::F32)), |
| 420 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 421 | ActivationFunctionsDataset)) |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 422 | { |
| 423 | validate(CLAccessor(_target), _reference, tolerance_f32); |
| 424 | } |
| 425 | TEST_SUITE_END() // Dilation |
| 426 | TEST_SUITE_END() // Generic |
| 427 | TEST_SUITE_END() // FP32 |
| 428 | TEST_SUITE_END() // Float |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 429 | |
| 430 | template <typename T> |
Georgios Pinitas | de5a1cc | 2018-02-02 12:52:07 +0000 | [diff] [blame] | 431 | using CLDepthwiseConvolutionLayerQuantizedFixture = DepthwiseConvolutionLayerValidationQuantizedFixture<CLTensor, CLAccessor, CLDepthwiseConvolutionLayer, T>; |
Michele Di Giorgio | df4cf57 | 2019-10-09 15:32:39 +0100 | [diff] [blame] | 432 | template <typename T> |
| 433 | using CLDepthwiseConvolutionLayerQuantizedPerChannelFixture = DepthwiseConvolutionLayerValidationQuantizedPerChannelFixture<CLTensor, CLAccessor, CLDepthwiseConvolutionLayer, T, int8_t>; |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 434 | |
| 435 | TEST_SUITE(Quantized) |
| 436 | TEST_SUITE(QASYMM8) |
Georgios Pinitas | de5a1cc | 2018-02-02 12:52:07 +0000 | [diff] [blame] | 437 | TEST_SUITE(Generic) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 438 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 439 | combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), |
| 440 | depth_multipliers), |
| 441 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 442 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.3f, 10), QuantizationInfo(2.2f, 10) })), |
| 443 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.5f, 4) })), |
| 444 | framework::dataset::make("DataLayout", { DataLayout::NHWC })), // NCHW is tested with int8 |
| 445 | ActivationFunctionsDataset)) |
Georgios Pinitas | de5a1cc | 2018-02-02 12:52:07 +0000 | [diff] [blame] | 446 | { |
| 447 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 448 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 449 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 450 | combine(combine(combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(), |
| 451 | large_depth_multipliers), |
| 452 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 453 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.5f, 10), QuantizationInfo(2.2f, 10) })), |
| 454 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.7f, 2) })), |
| 455 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 456 | ActivationFunctionsDataset)) |
Georgios Pinitas | de5a1cc | 2018-02-02 12:52:07 +0000 | [diff] [blame] | 457 | { |
| 458 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 459 | } |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 460 | TEST_SUITE(Dilation) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 461 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 462 | combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(), |
| 463 | depth_multipliers), |
| 464 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 465 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.5f, 10), QuantizationInfo(2.2f, 10) })), |
| 466 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.8, 1) })), |
| 467 | framework::dataset::make("DataLayout", { DataLayout::NHWC })), // NCHW is tested with int8 |
| 468 | ActivationFunctionsDataset)) |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 469 | { |
| 470 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 471 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 472 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 473 | combine(combine(combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(), |
| 474 | large_depth_multipliers), |
| 475 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 476 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.5f, 10), QuantizationInfo(1.3f, 10) })), |
| 477 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.9f, 11) })), |
| 478 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 479 | ActivationFunctionsDataset)) |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 480 | { |
| 481 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 482 | } |
| 483 | TEST_SUITE_END() // Dilation |
| 484 | TEST_SUITE_END() // Generic |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 485 | TEST_SUITE(W3x3) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 486 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 487 | combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), |
| 488 | depth_multipliers), |
| 489 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 490 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.3f, 10), QuantizationInfo(2.2f, 10) })), |
| 491 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 492 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 493 | ActivationFunctionsDataset)) |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 494 | { |
| 495 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 496 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 497 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 498 | combine(combine(combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 499 | large_depth_multipliers), |
| 500 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 501 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.5f, 10), QuantizationInfo(2.2f, 10) })), |
| 502 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 503 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 504 | ActivationFunctionsDataset)) |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 505 | { |
| 506 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 507 | } |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 508 | TEST_SUITE(Dilation) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 509 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 510 | combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(), |
| 511 | depth_multipliers), |
| 512 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 513 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.5f, 10), QuantizationInfo(2.2f, 10) })), |
| 514 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 515 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 516 | ActivationFunctionsDataset)) |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 517 | { |
| 518 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 519 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 520 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 521 | combine(combine(combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(), |
| 522 | large_depth_multipliers), |
| 523 | framework::dataset::make("DataType", DataType::QASYMM8)), |
| 524 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.5f, 10), QuantizationInfo(2.2f, 10) })), |
| 525 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 526 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 527 | ActivationFunctionsDataset)) |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 528 | { |
| 529 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 530 | } |
| 531 | TEST_SUITE_END() // Dilation |
| 532 | TEST_SUITE_END() // W3x3 |
| 533 | TEST_SUITE_END() // QASYMM8 |
Michele Di Giorgio | df4cf57 | 2019-10-09 15:32:39 +0100 | [diff] [blame] | 534 | |
Michele Di Giorgio | 4cd4cde | 2020-01-06 14:07:44 +0000 | [diff] [blame] | 535 | TEST_SUITE(QASYMM8_SIGNED) |
| 536 | TEST_SUITE(Generic) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 537 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::PRECOMMIT, |
| 538 | combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), |
| 539 | depth_multipliers), |
| 540 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), |
| 541 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.3f, 10), QuantizationInfo(2.2f, 10) })), |
| 542 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.5f, 4) })), |
| 543 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
| 544 | ActivationFunctionsDataset)) |
Michele Di Giorgio | 4cd4cde | 2020-01-06 14:07:44 +0000 | [diff] [blame] | 545 | { |
| 546 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 547 | } |
| 548 | TEST_SUITE(Dilation) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 549 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::PRECOMMIT, |
| 550 | combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(), |
| 551 | depth_multipliers), |
| 552 | framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), |
| 553 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.5f, 10), QuantizationInfo(2.2f, 10) })), |
| 554 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.8, 1) })), |
| 555 | framework::dataset::make("DataLayout", { DataLayout::NCHW })), |
| 556 | ActivationFunctionsDataset)) |
Michele Di Giorgio | 4cd4cde | 2020-01-06 14:07:44 +0000 | [diff] [blame] | 557 | { |
| 558 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 559 | } |
| 560 | TEST_SUITE_END() // Dilation |
| 561 | TEST_SUITE_END() // Generic |
| 562 | TEST_SUITE_END() // QASYMM8_SIGNED |
| 563 | |
Michele Di Giorgio | df4cf57 | 2019-10-09 15:32:39 +0100 | [diff] [blame] | 564 | TEST_SUITE(QSYMM8_PER_CHANNEL) |
| 565 | TEST_SUITE(Generic) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 566 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerQuantizedPerChannelFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 567 | combine(combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), |
| 568 | depth_multipliers), |
| 569 | framework::dataset::make("SrcDataType", DataType::QASYMM8)), |
| 570 | framework::dataset::make("WeightsDataType", DataType::QSYMM8_PER_CHANNEL)), |
| 571 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.3f, 10) })), |
| 572 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.5f, 4) })), |
| 573 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 574 | ActivationFunctionsDataset)) |
Michele Di Giorgio | df4cf57 | 2019-10-09 15:32:39 +0100 | [diff] [blame] | 575 | { |
| 576 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 577 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 578 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerQuantizedPerChannelFixture<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 579 | combine(combine(combine(combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(), |
| 580 | large_depth_multipliers), |
| 581 | framework::dataset::make("SrcDataType", DataType::QASYMM8)), |
| 582 | framework::dataset::make("WeightsDataType", DataType::QSYMM8_PER_CHANNEL)), |
| 583 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 584 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.7f, 2) })), |
| 585 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 586 | ActivationFunctionsDataset)) |
Michele Di Giorgio | df4cf57 | 2019-10-09 15:32:39 +0100 | [diff] [blame] | 587 | { |
| 588 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 589 | } |
| 590 | TEST_SUITE(Dilation) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 591 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerQuantizedPerChannelFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 592 | combine(combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(), |
| 593 | depth_multipliers), |
| 594 | framework::dataset::make("SrcDataType", DataType::QASYMM8)), |
| 595 | framework::dataset::make("WeightsDataType", DataType::QSYMM8_PER_CHANNEL)), |
| 596 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 597 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.8, 1) })), |
| 598 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 599 | ActivationFunctionsDataset)) |
Michele Di Giorgio | df4cf57 | 2019-10-09 15:32:39 +0100 | [diff] [blame] | 600 | { |
| 601 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 602 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 603 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerQuantizedPerChannelFixture<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 604 | combine(combine(combine(combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(), |
| 605 | large_depth_multipliers), |
| 606 | framework::dataset::make("SrcDataType", DataType::QASYMM8)), |
| 607 | framework::dataset::make("WeightsDataType", DataType::QSYMM8_PER_CHANNEL)), |
| 608 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 609 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.9f, 11) })), |
| 610 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 611 | ActivationFunctionsDataset)) |
Michele Di Giorgio | df4cf57 | 2019-10-09 15:32:39 +0100 | [diff] [blame] | 612 | { |
| 613 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 614 | } |
| 615 | TEST_SUITE_END() // Dilation |
| 616 | TEST_SUITE_END() // Generic |
| 617 | TEST_SUITE(W3x3) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 618 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerQuantizedPerChannelFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 619 | combine(combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), |
| 620 | depth_multipliers), |
| 621 | framework::dataset::make("SrcDataType", DataType::QASYMM8)), |
| 622 | framework::dataset::make("WeightsDataType", DataType::QSYMM8_PER_CHANNEL)), |
| 623 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.3f, 10) })), |
| 624 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.5f, 4) })), |
| 625 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 626 | ActivationFunctionsDataset)) |
Michele Di Giorgio | df4cf57 | 2019-10-09 15:32:39 +0100 | [diff] [blame] | 627 | { |
| 628 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 629 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 630 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerQuantizedPerChannelFixture<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 631 | combine(combine(combine(combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(), |
| 632 | large_depth_multipliers), |
| 633 | framework::dataset::make("SrcDataType", DataType::QASYMM8)), |
| 634 | framework::dataset::make("WeightsDataType", DataType::QSYMM8_PER_CHANNEL)), |
| 635 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 636 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 637 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 638 | ActivationFunctionsDataset)) |
Michele Di Giorgio | df4cf57 | 2019-10-09 15:32:39 +0100 | [diff] [blame] | 639 | { |
| 640 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 641 | } |
| 642 | TEST_SUITE(Dilation) |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 643 | FIXTURE_DATA_TEST_CASE_NEW(RunSmall, CLDepthwiseConvolutionLayerQuantizedPerChannelFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, |
| 644 | combine(combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(), |
| 645 | depth_multipliers), |
| 646 | framework::dataset::make("SrcDataType", DataType::QASYMM8)), |
| 647 | framework::dataset::make("WeightsDataType", DataType::QSYMM8_PER_CHANNEL)), |
| 648 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 649 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 650 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 651 | ActivationFunctionsDataset)) |
Michele Di Giorgio | df4cf57 | 2019-10-09 15:32:39 +0100 | [diff] [blame] | 652 | { |
| 653 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 654 | } |
Giorgio Arena | 68e29da | 2021-02-08 16:31:10 +0000 | [diff] [blame] | 655 | FIXTURE_DATA_TEST_CASE_NEW(RunLarge, CLDepthwiseConvolutionLayerQuantizedPerChannelFixture<uint8_t>, framework::DatasetMode::NIGHTLY, |
| 656 | combine(combine(combine(combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(), |
| 657 | large_depth_multipliers), |
| 658 | framework::dataset::make("SrcDataType", DataType::QASYMM8)), |
| 659 | framework::dataset::make("WeightsDataType", DataType::QSYMM8_PER_CHANNEL)), |
| 660 | framework::dataset::make("SrcQuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 661 | framework::dataset::make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })), |
| 662 | framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), |
| 663 | ActivationFunctionsDataset)) |
Michele Di Giorgio | df4cf57 | 2019-10-09 15:32:39 +0100 | [diff] [blame] | 664 | { |
| 665 | validate(CLAccessor(_target), _reference, tolerance_qasymm8); |
| 666 | } |
| 667 | TEST_SUITE_END() // Dilation |
| 668 | TEST_SUITE_END() // W3x3 |
| 669 | TEST_SUITE_END() // QSYMM8_PER_CHANNEL |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 670 | TEST_SUITE_END() // Quantized |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 671 | |
Usama Arif | e73686a | 2019-04-08 17:30:48 +0100 | [diff] [blame] | 672 | TEST_SUITE_END() // DepthwiseConvolutionLayer |
| 673 | TEST_SUITE_END() // CL |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 674 | } // namespace validation |
| 675 | } // namespace test |
| 676 | } // namespace arm_compute |