blob: 274a0f523a4b19e7292384701a3931224b5ac428 [file] [log] [blame]
Anthony Barbier8140e1e2017-12-14 23:48:46 +00001/*
Jenkins4ba87db2019-05-23 17:11:51 +01002 * Copyright (c) 2017-2019 ARM Limited.
Anthony Barbier8140e1e2017-12-14 23:48:46 +00003 *
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,
Jenkins4ba87db2019-05-23 17:11:51 +010021 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Anthony Barbier8140e1e2017-12-14 23:48:46 +000022 * 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"
Jenkins4ba87db2019-05-23 17:11:51 +010031#include "tests/datasets/DilatedDepthwiseConvolutionLayerDataset.h"
Anthony Barbier8140e1e2017-12-14 23:48:46 +000032#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
38namespace arm_compute
39{
40namespace test
41{
42namespace validation
43{
44namespace
45{
Jenkinsb9abeae2018-11-22 11:58:08 +000046RelativeTolerance<half_float::half> tolerance_f16(half_float::half(0.01)); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F16 */
47constexpr RelativeTolerance<float> tolerance_f32(0.01f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */
48constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(0); /**< Tolerance value for comparing reference's output against implementation's output for DataType::QASYMM8 */
49constexpr float tolerance_num = 0.05f; /**< Tolerance number */
Jenkinsb3a371b2018-05-23 11:36:53 +010050
51const auto depth_multipliers = framework::dataset::make("DepthMultiplier", { 1, 2, 3 });
Jenkins4ba87db2019-05-23 17:11:51 +010052
53//Activation Functions
54const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
55{
56 ActivationLayerInfo(),
57 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)
58});
Anthony Barbier8140e1e2017-12-14 23:48:46 +000059} // namespace
60
61TEST_SUITE(CL)
62TEST_SUITE(DepthwiseConvolutionLayer)
63
Jenkinsb3a371b2018-05-23 11:36:53 +010064// *INDENT-OFF*
65// clang-format off
Jenkins4ba87db2019-05-23 17:11:51 +010066DATA_TEST_CASE(Validate3x3, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(zip(
Jenkins52ba29e2018-08-29 15:32:11 +000067 framework::dataset::make("InputInfo", { TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching data type input/weights
68 TensorInfo(TensorShape(32U, 18U, 3U), 1, DataType::F32), // Mismatching input feature maps
69 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Unsupported weights dimensions
70 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::QASYMM8), // Unsupported activation
71 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching depth multiplier
72 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid stride
73 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases size
74 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases dimensions
75 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid output size
76 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Window shrink
Jenkins4ba87db2019-05-23 17:11:51 +010077 TensorInfo(TensorShape(32U, 18U, 8U), 1, DataType::F32), // patch size bigger than input width
78 TensorInfo(TensorShape(32U, 18U, 8U), 1, DataType::F32), // dilation < 1
Jenkins52ba29e2018-08-29 15:32:11 +000079 TensorInfo(TensorShape(32U, 18U, 8U), 1, DataType::F32),
80 TensorInfo(TensorShape(50U, 32U, 8U), 1, DataType::QASYMM8),
Jenkinsb3a371b2018-05-23 11:36:53 +010081 }),
Jenkins52ba29e2018-08-29 15:32:11 +000082 framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16),
83 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
84 TensorInfo(TensorShape(5U, 5U, 2U), 1, DataType::F32),
85 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::QASYMM8),
86 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
87 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
88 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
89 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
90 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
91 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
92 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
Jenkins4ba87db2019-05-23 17:11:51 +010093 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
94 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
Jenkins52ba29e2018-08-29 15:32:11 +000095 TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8),
Jenkinsb3a371b2018-05-23 11:36:53 +010096 })),
Jenkins52ba29e2018-08-29 15:32:11 +000097 framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
98 TensorInfo(TensorShape(2U), 1, DataType::F32),
99 TensorInfo(TensorShape(2U), 1, DataType::F32),
100 TensorInfo(TensorShape(2U), 1, DataType::S32),
101 TensorInfo(TensorShape(2U), 1, DataType::F32),
102 TensorInfo(TensorShape(2U), 1, DataType::F32),
103 TensorInfo(TensorShape(4U), 1, DataType::F32),
104 TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
105 TensorInfo(TensorShape(2U), 1, DataType::F32),
106 TensorInfo(TensorShape(2U), 1, DataType::F32),
107 TensorInfo(TensorShape(16U), 1, DataType::F32),
Jenkins4ba87db2019-05-23 17:11:51 +0100108 TensorInfo(TensorShape(16U), 1, DataType::F32),
109 TensorInfo(TensorShape(16U), 1, DataType::F32),
Jenkins52ba29e2018-08-29 15:32:11 +0000110 TensorInfo(TensorShape(24U), 1, DataType::S32),
Jenkinsb3a371b2018-05-23 11:36:53 +0100111 })),
Jenkins52ba29e2018-08-29 15:32:11 +0000112 framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
113 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
114 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
115 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::QASYMM8),
116 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
117 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
118 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
119 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
120 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32),
121 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
122 TensorInfo(TensorShape(30U, 16U, 16U), 1, DataType::F32),
Jenkins4ba87db2019-05-23 17:11:51 +0100123 TensorInfo(TensorShape(30U, 16U, 16U), 1, DataType::F32),
124 TensorInfo(TensorShape(30U, 16U, 16U), 1, DataType::F32),
Jenkins52ba29e2018-08-29 15:32:11 +0000125 TensorInfo(TensorShape(48U, 30U, 24U), 1, DataType::QASYMM8),
Jenkinsb3a371b2018-05-23 11:36:53 +0100126 })),
127 framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
128 PadStrideInfo(1, 1, 0, 0),
129 PadStrideInfo(1, 1, 0, 0),
130 PadStrideInfo(1, 1, 0, 0),
131 PadStrideInfo(1, 1, 0, 0),
132 PadStrideInfo(4, 1, 0, 0),
133 PadStrideInfo(1, 1, 0, 0),
134 PadStrideInfo(1, 1, 0, 0),
135 PadStrideInfo(1, 1, 0, 0),
136 PadStrideInfo(1, 1, 0, 0),
137 PadStrideInfo(1, 1, 0, 0),
138 PadStrideInfo(1, 1, 0, 0),
Jenkins4ba87db2019-05-23 17:11:51 +0100139 PadStrideInfo(1, 1, 0, 0),
140 PadStrideInfo(1, 1, 0, 0),
Jenkinsb3a371b2018-05-23 11:36:53 +0100141 })),
142 framework::dataset::make("DepthMultiplier", { 1,
143 1,
144 1,
145 1,
146 3,
147 1,
148 1,
149 1,
150 1,
151 1,
152 2,
Jenkins4ba87db2019-05-23 17:11:51 +0100153 2,
154 2,
Jenkinsb3a371b2018-05-23 11:36:53 +0100155 3,
156 })),
157 framework::dataset::make("ActivationInfo", { ActivationLayerInfo(),
158 ActivationLayerInfo(),
159 ActivationLayerInfo(),
160 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LINEAR),
161 ActivationLayerInfo(),
162 ActivationLayerInfo(),
163 ActivationLayerInfo(),
164 ActivationLayerInfo(),
165 ActivationLayerInfo(),
166 ActivationLayerInfo(),
167 ActivationLayerInfo(),
Jenkins4ba87db2019-05-23 17:11:51 +0100168 ActivationLayerInfo(),
169 ActivationLayerInfo(),
Jenkinsb3a371b2018-05-23 11:36:53 +0100170 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
171 })),
Jenkins4ba87db2019-05-23 17:11:51 +0100172 framework::dataset::make("Dilation", { Size2D(1U, 1U),
173 Size2D(1U, 1U),
174 Size2D(1U, 1U),
175 Size2D(1U, 1U),
176 Size2D(1U, 1U),
177 Size2D(1U, 1U),
178 Size2D(1U, 1U),
179 Size2D(1U, 1U),
180 Size2D(1U, 1U),
181 Size2D(1U, 1U),
182 Size2D(20U, 1U),
183 Size2D(0U, 1U),
184 Size2D(1U, 1U),
185 Size2D(1U, 1U),
186 })),
187 framework::dataset::make("Expected", { false, false, false, false, false, false, false, false, false, false, false, false, true, true })),
188 input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier, act_info, dilation, expected)
Jenkinsb3a371b2018-05-23 11:36:53 +0100189{
Jenkins4ba87db2019-05-23 17:11:51 +0100190 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,GPUTarget::MIDGARD, dilation));
Jenkinsb3a371b2018-05-23 11:36:53 +0100191 ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
192}
193
Jenkins4ba87db2019-05-23 17:11:51 +0100194DATA_TEST_CASE(ValidateGeneric, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
Jenkins52ba29e2018-08-29 15:32:11 +0000195 framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/weights
196 TensorInfo(TensorShape(27U, 13U, 3U), 1, DataType::F32), // Mismatching input feature maps
197 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching depth multiplier
198 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases size
199 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases dimensions
200 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid output size
Jenkins4ba87db2019-05-23 17:11:51 +0100201 TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32), // patch size bigger than input width
202 TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32), // dilation < 1
Jenkins52ba29e2018-08-29 15:32:11 +0000203 TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32),
204 TensorInfo(TensorShape(32U, 13U, 8U), 1, DataType::QASYMM8),
Jenkinsb3a371b2018-05-23 11:36:53 +0100205 }),
Jenkins52ba29e2018-08-29 15:32:11 +0000206 framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16),
207 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
208 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
209 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
210 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
211 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
212 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
Jenkins4ba87db2019-05-23 17:11:51 +0100213 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
214 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
Jenkins52ba29e2018-08-29 15:32:11 +0000215 TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8),
Jenkinsb3a371b2018-05-23 11:36:53 +0100216 })),
Jenkins52ba29e2018-08-29 15:32:11 +0000217 framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
218 TensorInfo(TensorShape(2U), 1, DataType::F32),
219 TensorInfo(TensorShape(2U), 1, DataType::F32),
220 TensorInfo(TensorShape(4U), 1, DataType::F32),
221 TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
222 TensorInfo(TensorShape(2U), 1, DataType::F32),
223 TensorInfo(TensorShape(16U), 1, DataType::F32),
Jenkins4ba87db2019-05-23 17:11:51 +0100224 TensorInfo(TensorShape(16U), 1, DataType::F32),
225 TensorInfo(TensorShape(16U), 1, DataType::F32),
Jenkins52ba29e2018-08-29 15:32:11 +0000226 TensorInfo(TensorShape(24U), 1, DataType::S32),
Jenkinsb3a371b2018-05-23 11:36:53 +0100227 })),
Jenkins52ba29e2018-08-29 15:32:11 +0000228 framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
229 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
230 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
231 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
232 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
233 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
234 TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
Jenkins4ba87db2019-05-23 17:11:51 +0100235 TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
236 TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
Jenkins52ba29e2018-08-29 15:32:11 +0000237 TensorInfo(TensorShape(32U, 11U, 24U), 1, DataType::QASYMM8),
Jenkinsb3a371b2018-05-23 11:36:53 +0100238 })),
239 framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
240 PadStrideInfo(1, 1, 0, 0),
241 PadStrideInfo(1, 1, 0, 0),
242 PadStrideInfo(1, 1, 0, 0),
243 PadStrideInfo(1, 1, 0, 0),
244 PadStrideInfo(1, 1, 0, 0),
245 PadStrideInfo(1, 1, 0, 0),
Jenkins4ba87db2019-05-23 17:11:51 +0100246 PadStrideInfo(1, 1, 0, 0),
247 PadStrideInfo(1, 1, 0, 0),
Jenkinsb3a371b2018-05-23 11:36:53 +0100248 PadStrideInfo(1, 1, 1, 0),
249 })),
250 framework::dataset::make("DepthMultiplier", { 1,
251 1,
252 3,
253 1,
254 1,
255 1,
256 2,
Jenkins4ba87db2019-05-23 17:11:51 +0100257 2,
258 2,
Jenkinsb3a371b2018-05-23 11:36:53 +0100259 3,
260 })),
Jenkins4ba87db2019-05-23 17:11:51 +0100261 framework::dataset::make("Dilation", { Size2D(1U, 1U),
262 Size2D(1U, 1U),
263 Size2D(1U, 1U),
264 Size2D(1U, 1U),
265 Size2D(1U, 1U),
266 Size2D(1U, 1U),
267 Size2D(20U, 1U),
268 Size2D(0U, 1U),
269 Size2D(1U, 1U),
270 Size2D(1U, 1U),
271 })),
272 framework::dataset::make("Expected", { false, false, false, false, false, false, false, false, true, true })),
273 input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier, dilation, expected)
Jenkinsb3a371b2018-05-23 11:36:53 +0100274{
Jenkins4ba87db2019-05-23 17:11:51 +0100275 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,ActivationLayerInfo(), dilation));
Jenkinsb3a371b2018-05-23 11:36:53 +0100276 ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
277}
278// clang-format on
279// *INDENT-ON*
280
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000281template <typename T>
282using CLDepthwiseConvolutionLayerFixture = DepthwiseConvolutionLayerValidationFixture<CLTensor, CLAccessor, CLDepthwiseConvolutionLayer, T>;
283
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000284TEST_SUITE(Float)
Jenkinsb3a371b2018-05-23 11:36:53 +0100285TEST_SUITE(FP16)
Anthony Barbier06ea0482018-02-22 15:45:35 +0000286TEST_SUITE(W3x3)
Jenkinsb9abeae2018-11-22 11:58:08 +0000287TEST_SUITE(NCHW)
Jenkins514be652019-02-28 12:25:18 +0000288FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL,
Jenkins4ba87db2019-05-23 17:11:51 +0100289 combine(combine(combine(combine(framework::dataset::concat(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
290 datasets::SmallDepthwiseConvolutionLayerDataset3x3NCHW()),
291 depth_multipliers),
292 framework::dataset::make("DataType",
293 DataType::F16)),
294 framework::dataset::make("DataLayout", DataLayout::NCHW)),
295 ActivationFunctionsDataset))
Anthony Barbier06ea0482018-02-22 15:45:35 +0000296{
297 validate(CLAccessor(_target), _reference, tolerance_f16);
298}
Jenkins4ba87db2019-05-23 17:11:51 +0100299FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
Jenkins514be652019-02-28 12:25:18 +0000300 depth_multipliers),
301 framework::dataset::make("DataType",
302 DataType::F16)),
Jenkins4ba87db2019-05-23 17:11:51 +0100303 framework::dataset::make("DataLayout", DataLayout::NCHW)),
304 ActivationFunctionsDataset))
Anthony Barbier06ea0482018-02-22 15:45:35 +0000305{
306 validate(CLAccessor(_target), _reference, tolerance_f16);
307}
Jenkins4ba87db2019-05-23 17:11:51 +0100308TEST_SUITE(Dilation)
309FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(),
310 depth_multipliers),
311 framework::dataset::make("DataType",
312 DataType::F16)),
313 framework::dataset::make("DataLayout", { DataLayout::NCHW })),
314 ActivationFunctionsDataset))
315{
316 validate(CLAccessor(_target), _reference, tolerance_f16);
317}
318FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
319 depth_multipliers),
320 framework::dataset::make("DataType",
321 DataType::F16)),
322 framework::dataset::make("DataLayout", { DataLayout::NCHW })),
323 ActivationFunctionsDataset))
324{
325 validate(CLAccessor(_target), _reference, tolerance_f16);
326}
327TEST_SUITE_END() // Dilation
328TEST_SUITE_END() // NCHW
Jenkinsb3a371b2018-05-23 11:36:53 +0100329
Jenkinsb9abeae2018-11-22 11:58:08 +0000330TEST_SUITE(NHWC)
Jenkins514be652019-02-28 12:25:18 +0000331FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL,
Jenkins4ba87db2019-05-23 17:11:51 +0100332 combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
333 depth_multipliers),
334 framework::dataset::make("DataType",
335 DataType::F16)),
336 framework::dataset::make("DataLayout", DataLayout::NHWC)),
337 ActivationFunctionsDataset))
Jenkinsb9abeae2018-11-22 11:58:08 +0000338{
339 validate(CLAccessor(_target), _reference, tolerance_f16);
340}
Jenkins4ba87db2019-05-23 17:11:51 +0100341FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
Jenkins514be652019-02-28 12:25:18 +0000342 depth_multipliers),
343 framework::dataset::make("DataType",
344 DataType::F16)),
Jenkins4ba87db2019-05-23 17:11:51 +0100345 framework::dataset::make("DataLayout", DataLayout::NHWC)),
346 ActivationFunctionsDataset))
Jenkinsb9abeae2018-11-22 11:58:08 +0000347{
348 validate(CLAccessor(_target), _reference, tolerance_f16);
349}
Jenkins4ba87db2019-05-23 17:11:51 +0100350TEST_SUITE(Dilation)
351FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(),
352 depth_multipliers),
Jenkinsb3a371b2018-05-23 11:36:53 +0100353 framework::dataset::make("DataType",
354 DataType::F16)),
Jenkins4ba87db2019-05-23 17:11:51 +0100355 framework::dataset::make("DataLayout", { DataLayout::NHWC })),
356 ActivationFunctionsDataset))
Jenkinsb3a371b2018-05-23 11:36:53 +0100357{
Jenkins4ba87db2019-05-23 17:11:51 +0100358 validate(CLAccessor(_target), _reference, tolerance_f16);
Jenkinsb3a371b2018-05-23 11:36:53 +0100359}
Jenkins4ba87db2019-05-23 17:11:51 +0100360FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
Jenkinsb3a371b2018-05-23 11:36:53 +0100361 depth_multipliers),
362 framework::dataset::make("DataType",
363 DataType::F16)),
Jenkins4ba87db2019-05-23 17:11:51 +0100364 framework::dataset::make("DataLayout", { DataLayout::NHWC })),
365 ActivationFunctionsDataset))
366{
367 validate(CLAccessor(_target), _reference, tolerance_f16);
368}
369TEST_SUITE_END() // Dilation
370TEST_SUITE_END() // NHWC
371TEST_SUITE_END() // W3x3
372
373TEST_SUITE(Generic)
374FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
375 depth_multipliers),
376 framework::dataset::make("DataType",
377 DataType::F16)),
378 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
379 ActivationFunctionsDataset))
Jenkinsb3a371b2018-05-23 11:36:53 +0100380{
381 validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
382}
Jenkins4ba87db2019-05-23 17:11:51 +0100383FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
384 depth_multipliers),
385 framework::dataset::make("DataType",
386 DataType::F16)),
387 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
388 ActivationFunctionsDataset))
389{
390 validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
391}
392
393TEST_SUITE(Dilation)
394FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
395 depth_multipliers),
396 framework::dataset::make("DataType",
397 DataType::F16)),
398 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
399 ActivationFunctionsDataset))
400{
401 validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
402}
403FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(),
404 depth_multipliers),
405 framework::dataset::make("DataType",
406 DataType::F16)),
407 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
408 ActivationFunctionsDataset))
409{
410 validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
411}
412TEST_SUITE_END() // Dilation
413TEST_SUITE_END() // Generic
414TEST_SUITE_END() // FP16
Anthony Barbier06ea0482018-02-22 15:45:35 +0000415
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000416TEST_SUITE(FP32)
417TEST_SUITE(W3x3)
Jenkins52ba29e2018-08-29 15:32:11 +0000418TEST_SUITE(NCHW)
Jenkins514be652019-02-28 12:25:18 +0000419FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL,
Jenkins4ba87db2019-05-23 17:11:51 +0100420 combine(combine(combine(combine(framework::dataset::concat(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
421 datasets::SmallDepthwiseConvolutionLayerDataset3x3NCHW()),
422 depth_multipliers),
423 framework::dataset::make("DataType",
424 DataType::F32)),
425 framework::dataset::make("DataLayout", DataLayout::NCHW)),
426 ActivationFunctionsDataset))
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000427{
428 validate(CLAccessor(_target), _reference, tolerance_f32);
429}
Jenkins4ba87db2019-05-23 17:11:51 +0100430FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
Jenkins514be652019-02-28 12:25:18 +0000431 depth_multipliers),
432 framework::dataset::make("DataType",
433 DataType::F32)),
Jenkins4ba87db2019-05-23 17:11:51 +0100434 framework::dataset::make("DataLayout", DataLayout::NCHW)),
435 ActivationFunctionsDataset))
Jenkinsb3a371b2018-05-23 11:36:53 +0100436{
437 validate(CLAccessor(_target), _reference, tolerance_f32);
438}
Jenkins4ba87db2019-05-23 17:11:51 +0100439TEST_SUITE(Dilation)
440FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL,
441 combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(), depth_multipliers),
442 framework::dataset::make("DataType",
443 DataType::F32)),
444 framework::dataset::make("DataLayout", DataLayout::NCHW)),
445 ActivationFunctionsDataset))
446{
447 validate(CLAccessor(_target), _reference, tolerance_f32);
448}
449FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY,
450 combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
451 depth_multipliers),
452 framework::dataset::make("DataType",
453 DataType::F32)),
454 framework::dataset::make("DataLayout", DataLayout::NCHW)),
455 ActivationFunctionsDataset))
456{
457 validate(CLAccessor(_target), _reference, tolerance_f32);
458}
459
460TEST_SUITE_END() // Dilation
461TEST_SUITE_END() // NCHW
Jenkins52ba29e2018-08-29 15:32:11 +0000462TEST_SUITE(NHWC)
Jenkins514be652019-02-28 12:25:18 +0000463FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL,
Jenkins4ba87db2019-05-23 17:11:51 +0100464 combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
465 depth_multipliers),
466 framework::dataset::make("DataType",
467 DataType::F32)),
468 framework::dataset::make("DataLayout", DataLayout::NHWC)),
469 ActivationFunctionsDataset))
Jenkins52ba29e2018-08-29 15:32:11 +0000470{
471 validate(CLAccessor(_target), _reference, tolerance_f32);
472}
Jenkins4ba87db2019-05-23 17:11:51 +0100473FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
Jenkins514be652019-02-28 12:25:18 +0000474 depth_multipliers),
475 framework::dataset::make("DataType",
476 DataType::F32)),
Jenkins4ba87db2019-05-23 17:11:51 +0100477 framework::dataset::make("DataLayout", DataLayout::NHWC)),
478 ActivationFunctionsDataset))
Jenkins52ba29e2018-08-29 15:32:11 +0000479{
480 validate(CLAccessor(_target), _reference, tolerance_f32);
481}
Jenkins4ba87db2019-05-23 17:11:51 +0100482TEST_SUITE(Dilation)
483
484FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL,
485 combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(),
486 depth_multipliers),
487 framework::dataset::make("DataType",
488 DataType::F32)),
489 framework::dataset::make("DataLayout", DataLayout::NHWC)),
490 ActivationFunctionsDataset))
491{
492 validate(CLAccessor(_target), _reference, tolerance_f32);
493}
494FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY,
495 combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
496 depth_multipliers),
497 framework::dataset::make("DataType",
498 DataType::F32)),
499 framework::dataset::make("DataLayout", DataLayout::NHWC)),
500 ActivationFunctionsDataset))
501{
502 validate(CLAccessor(_target), _reference, tolerance_f32);
503}
504TEST_SUITE_END() // Dilation
505TEST_SUITE_END() // NHWC
506TEST_SUITE_END() // W3x3
Jenkinsb3a371b2018-05-23 11:36:53 +0100507
508TEST_SUITE(Generic)
Jenkins4ba87db2019-05-23 17:11:51 +0100509FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
510 depth_multipliers),
Jenkinsb3a371b2018-05-23 11:36:53 +0100511 framework::dataset::make("DataType",
512 DataType::F32)),
Jenkins4ba87db2019-05-23 17:11:51 +0100513 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
514 ActivationFunctionsDataset))
Jenkinsb3a371b2018-05-23 11:36:53 +0100515{
516 validate(CLAccessor(_target), _reference, tolerance_f32);
517}
Jenkins4ba87db2019-05-23 17:11:51 +0100518FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
Jenkinsb3a371b2018-05-23 11:36:53 +0100519 depth_multipliers),
520 framework::dataset::make("DataType",
521 DataType::F32)),
Jenkins4ba87db2019-05-23 17:11:51 +0100522 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
523 ActivationFunctionsDataset))
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000524{
525 validate(CLAccessor(_target), _reference, tolerance_f32);
526}
Jenkins4ba87db2019-05-23 17:11:51 +0100527
528TEST_SUITE(Dilation)
529FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
530 depth_multipliers),
531 framework::dataset::make("DataType",
532 DataType::F32)),
533 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
534 ActivationFunctionsDataset))
535{
536 validate(CLAccessor(_target), _reference, tolerance_f32);
537}
538FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY,
539 combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
540 depth_multipliers),
541 framework::dataset::make("DataType",
542 DataType::F32)),
543 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
544 ActivationFunctionsDataset))
545{
546 validate(CLAccessor(_target), _reference, tolerance_f32);
547}
548TEST_SUITE_END() // Dilation
549TEST_SUITE_END() // Generic
550TEST_SUITE_END() // FP32
551TEST_SUITE_END() // Float
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000552
553template <typename T>
Anthony Barbier06ea0482018-02-22 15:45:35 +0000554using CLDepthwiseConvolutionLayerQuantizedFixture = DepthwiseConvolutionLayerValidationQuantizedFixture<CLTensor, CLAccessor, CLDepthwiseConvolutionLayer, T>;
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000555
556TEST_SUITE(Quantized)
557TEST_SUITE(QASYMM8)
Anthony Barbier06ea0482018-02-22 15:45:35 +0000558TEST_SUITE(Generic)
Jenkinsb3a371b2018-05-23 11:36:53 +0100559FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
Jenkins4ba87db2019-05-23 17:11:51 +0100560 combine(combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
561 depth_multipliers),
562 framework::dataset::make("DataType", DataType::QASYMM8)),
563 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
564 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
565 ActivationFunctionsDataset))
Anthony Barbier06ea0482018-02-22 15:45:35 +0000566{
567 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
568}
Jenkinsb3a371b2018-05-23 11:36:53 +0100569FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
Jenkins4ba87db2019-05-23 17:11:51 +0100570 combine(combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
571 depth_multipliers),
572 framework::dataset::make("DataType", DataType::QASYMM8)),
573 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
574 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
575 ActivationFunctionsDataset))
Anthony Barbier06ea0482018-02-22 15:45:35 +0000576{
577 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
578}
Jenkins4ba87db2019-05-23 17:11:51 +0100579TEST_SUITE(Dilation)
580FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
581 combine(combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
582 depth_multipliers),
583 framework::dataset::make("DataType", DataType::QASYMM8)),
584 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
585 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
586 ActivationFunctionsDataset))
587{
588 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
589}
590FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
591 combine(combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(),
592 depth_multipliers),
593 framework::dataset::make("DataType", DataType::QASYMM8)),
594 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
595 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
596 ActivationFunctionsDataset))
597{
598 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
599}
600TEST_SUITE_END() // Dilation
601TEST_SUITE_END() // Generic
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000602TEST_SUITE(W3x3)
Jenkins514be652019-02-28 12:25:18 +0000603FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
Jenkins4ba87db2019-05-23 17:11:51 +0100604 combine(combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
605 depth_multipliers),
606 framework::dataset::make("DataType", DataType::QASYMM8)),
607 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
608 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
609 ActivationFunctionsDataset))
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000610{
611 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
612}
Jenkins514be652019-02-28 12:25:18 +0000613FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
Jenkins4ba87db2019-05-23 17:11:51 +0100614 combine(combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
615 depth_multipliers),
616 framework::dataset::make("DataType", DataType::QASYMM8)),
617 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
618 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
619 ActivationFunctionsDataset))
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000620{
621 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
622}
Jenkins4ba87db2019-05-23 17:11:51 +0100623TEST_SUITE(Dilation)
624FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
625 combine(combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(),
626 depth_multipliers),
627 framework::dataset::make("DataType", DataType::QASYMM8)),
628 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
629 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
630 ActivationFunctionsDataset))
631{
632 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
633}
634FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
635 combine(combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
636 depth_multipliers),
637 framework::dataset::make("DataType", DataType::QASYMM8)),
638 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
639 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
640 ActivationFunctionsDataset))
641{
642 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
643}
644TEST_SUITE_END() // Dilation
645TEST_SUITE_END() // W3x3
646TEST_SUITE_END() // QASYMM8
647TEST_SUITE_END() // Quantized
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000648
Jenkins4ba87db2019-05-23 17:11:51 +0100649TEST_SUITE_END() // DepthwiseConvolutionLayer
650TEST_SUITE_END() // CL
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000651} // namespace validation
652} // namespace test
653} // namespace arm_compute