blob: 8eefec37d596c2089a92d991bf7e63e439191cd6 [file] [log] [blame]
Anthony Barbier8140e1e2017-12-14 23:48:46 +00001/*
Jenkins514be652019-02-28 12:25:18 +00002 * 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,
Jenkins514be652019-02-28 12:25:18 +000021 * 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"
Jenkinsb3a371b2018-05-23 11:36:53 +010025#include "arm_compute/core/utils/misc/ShapeCalculator.h"
Anthony Barbier8140e1e2017-12-14 23:48:46 +000026#include "arm_compute/runtime/NEON/functions/NEDepthwiseConvolutionLayer.h"
27#include "arm_compute/runtime/Tensor.h"
28#include "arm_compute/runtime/TensorAllocator.h"
29#include "tests/NEON/Accessor.h"
30#include "tests/PaddingCalculator.h"
31#include "tests/datasets/DepthwiseConvolutionLayerDataset.h"
Jenkins4ba87db2019-05-23 17:11:51 +010032#include "tests/datasets/DilatedDepthwiseConvolutionLayerDataset.h"
Anthony Barbier8140e1e2017-12-14 23:48:46 +000033#include "tests/framework/Asserts.h"
34#include "tests/framework/Macros.h"
35#include "tests/framework/datasets/Datasets.h"
36#include "tests/validation/Validation.h"
37#include "tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h"
38
39namespace arm_compute
40{
41namespace test
42{
43namespace validation
44{
Jenkinsb3a371b2018-05-23 11:36:53 +010045using namespace arm_compute::misc::shape_calculator;
46
Anthony Barbier8140e1e2017-12-14 23:48:46 +000047namespace
48{
Jenkins514be652019-02-28 12:25:18 +000049constexpr RelativeTolerance<float> tolerance_f32(0.01f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */
50constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1); /**< Tolerance value for comparing reference's output against implementation's output for DataType::QASYMM8 */
51#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
52RelativeTolerance<half_float::half> tolerance_f16(half_float::half(0.01)); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F16 */
53constexpr float tolerance_num = 0.05f; /**< Tolerance number */
54#endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
Jenkinsb3a371b2018-05-23 11:36:53 +010055
56const auto depth_multipliers = framework::dataset::make("DepthMultiplier", { 1, 2, 3 });
Jenkins4ba87db2019-05-23 17:11:51 +010057
58//Activation Functions
59const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
60{
61 ActivationLayerInfo(),
62 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)
63});
Anthony Barbier8140e1e2017-12-14 23:48:46 +000064} // namespace
65
66TEST_SUITE(NEON)
Jenkins4ba87db2019-05-23 17:11:51 +010067TEST_SUITE(DepthwiseConvolutionLayer)
Anthony Barbier8140e1e2017-12-14 23:48:46 +000068
Jenkins52ba29e2018-08-29 15:32:11 +000069// *INDENT-OFF*
70// clang-format off
Jenkins4ba87db2019-05-23 17:11:51 +010071DATA_TEST_CASE(Validate3x3, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
Jenkins52ba29e2018-08-29 15:32:11 +000072 framework::dataset::make("InputInfo", { TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching data type input/weights
73 TensorInfo(TensorShape(32U, 18U, 3U), 1, DataType::F32), // Mismatching input feature maps
74 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Unsupported weights dimensions
75 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching depth multiplier
76 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::QASYMM8), // Invalid stride
77 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases size
78 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases dimensions
79 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid output size
Jenkins4ba87db2019-05-23 17:11:51 +010080 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // patch size bigger than input width
81 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // dilation < 1
Jenkins52ba29e2018-08-29 15:32:11 +000082 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
83 }),
84 framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F16),
85 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
86 TensorInfo(TensorShape(5U, 5U, 2U, 2U), 1, DataType::F32),
87 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
88 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::QASYMM8),
89 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
90 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
91 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
92 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
Jenkins4ba87db2019-05-23 17:11:51 +010093 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
94 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
Jenkins52ba29e2018-08-29 15:32:11 +000095 })),
96 framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
97 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(4U), 1, DataType::F32),
102 TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
103 TensorInfo(TensorShape(2U), 1, DataType::F32),
104 TensorInfo(TensorShape(2U), 1, DataType::F32),
Jenkins4ba87db2019-05-23 17:11:51 +0100105 TensorInfo(TensorShape(2U), 1, DataType::F32),
106 TensorInfo(TensorShape(2U), 1, DataType::F32),
Jenkins52ba29e2018-08-29 15:32:11 +0000107 })),
108 framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
109 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
110 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
111 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
112 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::QASYMM8),
113 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
114 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
115 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32),
116 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
Jenkins4ba87db2019-05-23 17:11:51 +0100117 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
118 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
Jenkins52ba29e2018-08-29 15:32:11 +0000119 })),
120 framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
121 PadStrideInfo(1, 1, 0, 0),
122 PadStrideInfo(1, 1, 0, 0),
123 PadStrideInfo(1, 1, 0, 0),
124 PadStrideInfo(4, 1, 0, 0),
125 PadStrideInfo(1, 1, 0, 0),
126 PadStrideInfo(1, 1, 0, 0),
127 PadStrideInfo(1, 1, 0, 0),
128 PadStrideInfo(1, 1, 0, 0),
Jenkins4ba87db2019-05-23 17:11:51 +0100129 PadStrideInfo(1, 1, 0, 0),
130 PadStrideInfo(1, 1, 0, 0),
Jenkins52ba29e2018-08-29 15:32:11 +0000131 })),
132 framework::dataset::make("DepthMultiplier", { 1,
133 1,
134 1,
135 3,
136 1,
137 1,
138 1,
139 1,
140 1,
Jenkins4ba87db2019-05-23 17:11:51 +0100141 1,
142 1,
Jenkins52ba29e2018-08-29 15:32:11 +0000143 })),
Jenkins4ba87db2019-05-23 17:11:51 +0100144 framework::dataset::make("Dilation", { Size2D(1U, 1U),
145 Size2D(1U, 1U),
146 Size2D(1U, 1U),
147 Size2D(1U, 1U),
148 Size2D(1U, 1U),
149 Size2D(1U, 1U),
150 Size2D(1U, 1U),
151 Size2D(1U, 1U),
152 Size2D(25U, 1U),
153 Size2D(0U, 1U),
154 Size2D(1U, 1U),
155 })),
156 framework::dataset::make("Expected", { false, false, false, false, false, false, false, false, false, false, true })),
157 input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier,dilation, expected)
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000158{
Jenkins4ba87db2019-05-23 17:11:51 +0100159 bool is_valid = bool(NEDepthwiseConvolutionLayer3x3::validate(&input_info.clone()->set_is_resizable(false),
160 &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));
Jenkins52ba29e2018-08-29 15:32:11 +0000161 ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000162}
163
Jenkins4ba87db2019-05-23 17:11:51 +0100164DATA_TEST_CASE(ValidateGeneric, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
Jenkins52ba29e2018-08-29 15:32:11 +0000165 framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/weights
166 TensorInfo(TensorShape(27U, 13U, 3U), 1, DataType::F32), // Mismatching input feature maps
167 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching depth multiplier
168 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases size
169 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases dimensions
170 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid output size
Jenkins4ba87db2019-05-23 17:11:51 +0100171 TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32), // patch size bigger than input width
172 TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32), // dilation < 1
Jenkins52ba29e2018-08-29 15:32:11 +0000173 TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32),
174 TensorInfo(TensorShape(32U, 13U, 8U), 1, DataType::QASYMM8),
175 }),
176 framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16),
177 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
178 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
179 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
180 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
181 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
182 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
Jenkins4ba87db2019-05-23 17:11:51 +0100183 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
184 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
Jenkins52ba29e2018-08-29 15:32:11 +0000185 TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8),
186 })),
187 framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
188 TensorInfo(TensorShape(2U), 1, DataType::F32),
189 TensorInfo(TensorShape(2U), 1, DataType::F32),
190 TensorInfo(TensorShape(4U), 1, DataType::F32),
191 TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
192 TensorInfo(TensorShape(2U), 1, DataType::F32),
193 TensorInfo(TensorShape(16U), 1, DataType::F32),
Jenkins4ba87db2019-05-23 17:11:51 +0100194 TensorInfo(TensorShape(16U), 1, DataType::F32),
195 TensorInfo(TensorShape(16U), 1, DataType::F32),
Jenkins52ba29e2018-08-29 15:32:11 +0000196 TensorInfo(TensorShape(24U), 1, DataType::S32),
197 })),
198 framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
199 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
200 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
201 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
202 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
203 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
204 TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
Jenkins4ba87db2019-05-23 17:11:51 +0100205 TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
206 TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
Jenkins52ba29e2018-08-29 15:32:11 +0000207 TensorInfo(TensorShape(32U, 11U, 24U), 1, DataType::QASYMM8),
208 })),
209 framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
210 PadStrideInfo(1, 1, 0, 0),
211 PadStrideInfo(1, 1, 0, 0),
212 PadStrideInfo(1, 1, 0, 0),
213 PadStrideInfo(1, 1, 0, 0),
214 PadStrideInfo(1, 1, 0, 0),
215 PadStrideInfo(1, 1, 0, 0),
Jenkins4ba87db2019-05-23 17:11:51 +0100216 PadStrideInfo(1, 1, 0, 0),
217 PadStrideInfo(1, 1, 0, 0),
Jenkins52ba29e2018-08-29 15:32:11 +0000218 PadStrideInfo(1, 1, 1, 0),
219 })),
220 framework::dataset::make("DepthMultiplier", { 1,
221 1,
222 3,
223 1,
224 1,
225 1,
226 2,
Jenkins4ba87db2019-05-23 17:11:51 +0100227 2,
228 2,
Jenkins52ba29e2018-08-29 15:32:11 +0000229 3,
230 })),
Jenkins4ba87db2019-05-23 17:11:51 +0100231 framework::dataset::make("Dilation", { Size2D(1U, 1U),
232 Size2D(1U, 1U),
233 Size2D(1U, 1U),
234 Size2D(1U, 1U),
235 Size2D(1U, 1U),
236 Size2D(1U, 1U),
237 Size2D(25U, 1U),
238 Size2D(0U, 1U),
239 Size2D(1U, 1U),
240 Size2D(1U, 1U),
241 })),
242 framework::dataset::make("Expected", { false, false, false, false, false, false,false, false, true, true })),
243 input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier,dilation, expected)
Jenkins52ba29e2018-08-29 15:32:11 +0000244{
Jenkins4ba87db2019-05-23 17:11:51 +0100245 bool is_valid = bool(NEDepthwiseConvolutionLayer::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));
Jenkins52ba29e2018-08-29 15:32:11 +0000246 ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
247}
248// clang-format on
249// *INDENT-ON*
250
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000251TEST_SUITE(Float)
252TEST_SUITE(F32)
253TEST_SUITE(Generic)
254template <typename T>
255using NEDepthwiseConvolutionLayerFixture = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T>;
Jenkins4ba87db2019-05-23 17:11:51 +0100256FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
Jenkinsb3a371b2018-05-23 11:36:53 +0100257 depth_multipliers),
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000258 framework::dataset::make("DataType",
Jenkinsb3a371b2018-05-23 11:36:53 +0100259 DataType::F32)),
Jenkins4ba87db2019-05-23 17:11:51 +0100260 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
261 ActivationFunctionsDataset))
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000262{
263 validate(Accessor(_target), _reference, tolerance_f32);
264}
Jenkins4ba87db2019-05-23 17:11:51 +0100265FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
Jenkinsb3a371b2018-05-23 11:36:53 +0100266 depth_multipliers),
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000267 framework::dataset::make("DataType",
Jenkinsb3a371b2018-05-23 11:36:53 +0100268 DataType::F32)),
Jenkins4ba87db2019-05-23 17:11:51 +0100269 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
270 ActivationFunctionsDataset))
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000271{
272 validate(Accessor(_target), _reference, tolerance_f32);
273}
Jenkins4ba87db2019-05-23 17:11:51 +0100274
275TEST_SUITE(Dilation)
276FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
277 depth_multipliers),
278 framework::dataset::make("DataType",
279 DataType::F32)),
280 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
281 ActivationFunctionsDataset))
282{
283 validate(Accessor(_target), _reference, tolerance_f32);
284}
285FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(),
286 depth_multipliers),
287 framework::dataset::make("DataType",
288 DataType::F32)),
289 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
290 ActivationFunctionsDataset))
291{
292 validate(Accessor(_target), _reference, tolerance_f32);
293}
294TEST_SUITE_END() // Dilation
Jenkinsb9abeae2018-11-22 11:58:08 +0000295TEST_SUITE_END() // Generic
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000296
297TEST_SUITE(W3x3)
298template <typename T>
299using NEDepthwiseConvolutionLayerFixture3x3 = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer3x3, T>;
Jenkins4ba87db2019-05-23 17:11:51 +0100300FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
Jenkinsb3a371b2018-05-23 11:36:53 +0100301 depth_multipliers),
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000302 framework::dataset::make("DataType",
Jenkinsb3a371b2018-05-23 11:36:53 +0100303 DataType::F32)),
Jenkins4ba87db2019-05-23 17:11:51 +0100304 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
305 ActivationFunctionsDataset))
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000306{
307 validate(Accessor(_target), _reference, tolerance_f32);
308}
Jenkins4ba87db2019-05-23 17:11:51 +0100309FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
Jenkinsb3a371b2018-05-23 11:36:53 +0100310 depth_multipliers),
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000311 framework::dataset::make("DataType",
Jenkinsb3a371b2018-05-23 11:36:53 +0100312 DataType::F32)),
Jenkins4ba87db2019-05-23 17:11:51 +0100313 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
314 ActivationFunctionsDataset))
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000315{
316 validate(Accessor(_target), _reference, tolerance_f32);
317}
Jenkins4ba87db2019-05-23 17:11:51 +0100318TEST_SUITE(Dilation)
319FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(),
320 depth_multipliers),
321 framework::dataset::make("DataType",
322 DataType::F32)),
323 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
324 ActivationFunctionsDataset))
325{
326 validate(Accessor(_target), _reference, tolerance_f32);
327}
328FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::NIGHTLY,
329 combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
330 depth_multipliers),
331 framework::dataset::make("DataType",
332 DataType::F32)),
333 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
334 ActivationFunctionsDataset))
335{
336 validate(Accessor(_target), _reference, tolerance_f32);
337}
338
339TEST_SUITE_END() // Dilation
340
Jenkins514be652019-02-28 12:25:18 +0000341FIXTURE_DATA_TEST_CASE(RunOptimizedSmall, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::PRECOMMIT,
Jenkins4ba87db2019-05-23 17:11:51 +0100342 combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(),
343 framework::dataset::make("DepthMultiplier", 1)),
344 framework::dataset::make("DataType",
345 DataType::F32)),
346 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
347 ActivationFunctionsDataset))
Jenkins514be652019-02-28 12:25:18 +0000348{
349 validate(Accessor(_target), _reference, tolerance_f32);
350}
351FIXTURE_DATA_TEST_CASE(RunOptimizedLarge, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::NIGHTLY,
Jenkins4ba87db2019-05-23 17:11:51 +0100352 combine(combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(),
353 framework::dataset::make("DepthMultiplier", 1)),
354 framework::dataset::make("DataType",
355 DataType::F32)),
356 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
357 ActivationFunctionsDataset))
Anthony Barbier06ea0482018-02-22 15:45:35 +0000358{
359 validate(Accessor(_target), _reference, tolerance_f32);
360}
Jenkinsb9abeae2018-11-22 11:58:08 +0000361TEST_SUITE_END() // W3x3
362TEST_SUITE_END() // F32
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000363
Jenkinsb9abeae2018-11-22 11:58:08 +0000364#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
365TEST_SUITE(F16)
Jenkins514be652019-02-28 12:25:18 +0000366TEST_SUITE(Generic)
367template <typename T>
368using NEDepthwiseConvolutionLayerFixture = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T>;
Jenkins4ba87db2019-05-23 17:11:51 +0100369FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
Jenkins514be652019-02-28 12:25:18 +0000370 depth_multipliers),
371 framework::dataset::make("DataType",
372 DataType::F16)),
Jenkins4ba87db2019-05-23 17:11:51 +0100373 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
374 ActivationFunctionsDataset))
Jenkins514be652019-02-28 12:25:18 +0000375{
376 validate(Accessor(_target), _reference, tolerance_f16, tolerance_num);
377}
Jenkins4ba87db2019-05-23 17:11:51 +0100378FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
Jenkins514be652019-02-28 12:25:18 +0000379 depth_multipliers),
380 framework::dataset::make("DataType",
381 DataType::F16)),
Jenkins4ba87db2019-05-23 17:11:51 +0100382 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
383 ActivationFunctionsDataset))
Jenkins514be652019-02-28 12:25:18 +0000384{
385 validate(Accessor(_target), _reference, tolerance_f16, tolerance_num);
386}
Jenkins4ba87db2019-05-23 17:11:51 +0100387
388TEST_SUITE(Dilation)
389FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
390 depth_multipliers),
391 framework::dataset::make("DataType",
392 DataType::F16)),
393 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
394 ActivationFunctionsDataset))
395{
396 validate(Accessor(_target), _reference, tolerance_f16, tolerance_num);
397}
398FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(),
399 depth_multipliers),
400 framework::dataset::make("DataType",
401 DataType::F16)),
402 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
403 ActivationFunctionsDataset))
404{
405 validate(Accessor(_target), _reference, tolerance_f16, tolerance_num);
406}
407TEST_SUITE_END() // Dilation
408
Jenkins514be652019-02-28 12:25:18 +0000409TEST_SUITE_END() // Generic
Jenkinsb9abeae2018-11-22 11:58:08 +0000410TEST_SUITE(W3x3)
411template <typename T>
412using NEDepthwiseConvolutionLayerFixture3x3 = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer3x3, T>;
Jenkins4ba87db2019-05-23 17:11:51 +0100413FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
Jenkinsb9abeae2018-11-22 11:58:08 +0000414 depth_multipliers),
415 framework::dataset::make("DataType",
416 DataType::F16)),
Jenkins4ba87db2019-05-23 17:11:51 +0100417 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
418 ActivationFunctionsDataset))
Jenkinsb9abeae2018-11-22 11:58:08 +0000419{
420 validate(Accessor(_target), _reference, tolerance_f16);
421}
Jenkins4ba87db2019-05-23 17:11:51 +0100422FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
Jenkinsb9abeae2018-11-22 11:58:08 +0000423 depth_multipliers),
424 framework::dataset::make("DataType",
425 DataType::F16)),
Jenkins4ba87db2019-05-23 17:11:51 +0100426 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
427 ActivationFunctionsDataset))
Jenkinsb9abeae2018-11-22 11:58:08 +0000428{
429 validate(Accessor(_target), _reference, tolerance_f16);
430}
Jenkins4ba87db2019-05-23 17:11:51 +0100431
432TEST_SUITE(Dilation)
433
434FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(),
435 depth_multipliers),
436 framework::dataset::make("DataType",
437 DataType::F16)),
438 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
439 ActivationFunctionsDataset))
440{
441 validate(Accessor(_target), _reference, tolerance_f16);
442}
443FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::NIGHTLY,
444 combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
445 depth_multipliers),
446 framework::dataset::make("DataType",
447 DataType::F16)),
448 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
449 ActivationFunctionsDataset))
450{
451 validate(Accessor(_target), _reference, tolerance_f16);
452}
453
454TEST_SUITE_END() // Dilation
455
Jenkins514be652019-02-28 12:25:18 +0000456FIXTURE_DATA_TEST_CASE(RunOptimizedSmall, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::PRECOMMIT,
Jenkins4ba87db2019-05-23 17:11:51 +0100457 combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(),
458 framework::dataset::make("DepthMultiplier", 1)),
459 framework::dataset::make("DataType",
460 DataType::F16)),
461 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
462 ActivationFunctionsDataset))
Jenkins514be652019-02-28 12:25:18 +0000463{
464 validate(Accessor(_target), _reference, tolerance_f16);
465}
466FIXTURE_DATA_TEST_CASE(RunOptimizedLarge, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::NIGHTLY,
Jenkins4ba87db2019-05-23 17:11:51 +0100467 combine(combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(),
468 framework::dataset::make("DepthMultiplier", 1)),
469 framework::dataset::make("DataType",
470 DataType::F16)),
471 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
472 ActivationFunctionsDataset))
Jenkinsb9abeae2018-11-22 11:58:08 +0000473{
474 validate(Accessor(_target), _reference, tolerance_f16);
475}
476TEST_SUITE_END() // W3x3
477TEST_SUITE_END() // FP16
478#endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
479
480TEST_SUITE_END() // Float
Anthony Barbierf45d5a92018-01-24 16:23:15 +0000481
482template <typename T>
483using NEDepthwiseConvolutionLayerQuantizedFixture3x3 = DepthwiseConvolutionLayerValidationQuantizedFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer3x3, T>;
Anthony Barbier06ea0482018-02-22 15:45:35 +0000484template <typename T>
485using NEDepthwiseConvolutionLayerQuantizedFixture = DepthwiseConvolutionLayerValidationQuantizedFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T>;
Anthony Barbierf45d5a92018-01-24 16:23:15 +0000486
487TEST_SUITE(Quantized)
488TEST_SUITE(QASYMM8)
Anthony Barbier06ea0482018-02-22 15:45:35 +0000489TEST_SUITE(Generic)
Jenkinsb3a371b2018-05-23 11:36:53 +0100490FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
Jenkins4ba87db2019-05-23 17:11:51 +0100491 combine(combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
492 depth_multipliers),
493 framework::dataset::make("DataType", DataType::QASYMM8)),
494 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
495 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
496 ActivationFunctionsDataset))
Anthony Barbier06ea0482018-02-22 15:45:35 +0000497{
498 validate(Accessor(_target), _reference, tolerance_qasymm8);
499}
Jenkins4ba87db2019-05-23 17:11:51 +0100500
501TEST_SUITE(Dilation)
502FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
503 combine(combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
504 depth_multipliers),
505 framework::dataset::make("DataType", DataType::QASYMM8)),
506 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
507 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
508 ActivationFunctionsDataset))
509{
510 validate(Accessor(_target), _reference, tolerance_qasymm8);
511}
512FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
513 combine(combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(),
514 depth_multipliers),
515 framework::dataset::make("DataType", DataType::QASYMM8)),
516 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
517 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
518 ActivationFunctionsDataset))
519{
520 validate(Accessor(_target), _reference, tolerance_qasymm8);
521}
522TEST_SUITE_END() //Dilation
Jenkins514be652019-02-28 12:25:18 +0000523TEST_SUITE_END() // Generic
Anthony Barbierf45d5a92018-01-24 16:23:15 +0000524TEST_SUITE(W3x3)
Jenkinsb3a371b2018-05-23 11:36:53 +0100525FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::PRECOMMIT,
Jenkins4ba87db2019-05-23 17:11:51 +0100526 combine(combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), depth_multipliers),
527 framework::dataset::make("DataType", DataType::QASYMM8)),
528 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
529 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
530 ActivationFunctionsDataset))
Anthony Barbierf45d5a92018-01-24 16:23:15 +0000531{
532 validate(Accessor(_target), _reference, tolerance_qasymm8);
533}
Jenkins514be652019-02-28 12:25:18 +0000534FIXTURE_DATA_TEST_CASE(RunOptimizedSmall, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::PRECOMMIT,
Jenkins4ba87db2019-05-23 17:11:51 +0100535 combine(combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(),
536 framework::dataset::make("DepthMultiplier", 1)),
537 framework::dataset::make("DataType",
538 DataType::QASYMM8)),
539 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
540 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
541 ActivationFunctionsDataset))
Jenkins514be652019-02-28 12:25:18 +0000542{
543 validate(Accessor(_target), _reference, tolerance_qasymm8);
544}
545FIXTURE_DATA_TEST_CASE(RunOptimizedLarge, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::NIGHTLY,
Jenkins4ba87db2019-05-23 17:11:51 +0100546 combine(combine(combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(),
547 framework::dataset::make("DepthMultiplier", 1)),
548 framework::dataset::make("DataType",
549 DataType::QASYMM8)),
550 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
551 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
552 ActivationFunctionsDataset))
Jenkinsb9abeae2018-11-22 11:58:08 +0000553{
554 validate(Accessor(_target), _reference, tolerance_qasymm8);
555}
Jenkinsb3a371b2018-05-23 11:36:53 +0100556FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::NIGHTLY,
Jenkins4ba87db2019-05-23 17:11:51 +0100557 combine(combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
558 depth_multipliers),
559 framework::dataset::make("DataType", DataType::QASYMM8)),
560 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
561 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
562 ActivationFunctionsDataset))
Anthony Barbierf45d5a92018-01-24 16:23:15 +0000563{
564 validate(Accessor(_target), _reference, tolerance_qasymm8);
565}
Jenkins4ba87db2019-05-23 17:11:51 +0100566
567TEST_SUITE(Dilation)
568
569FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::PRECOMMIT,
570 combine(combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(), depth_multipliers),
571 framework::dataset::make("DataType", DataType::QASYMM8)),
572 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
573 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
574 ActivationFunctionsDataset))
575{
576 validate(Accessor(_target), _reference, tolerance_qasymm8);
577}
578FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::NIGHTLY,
579 combine(combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
580 depth_multipliers),
581 framework::dataset::make("DataType", DataType::QASYMM8)),
582 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
583 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
584 ActivationFunctionsDataset))
585{
586 validate(Accessor(_target), _reference, tolerance_qasymm8);
587}
588TEST_SUITE_END() // Dilation
Jenkins514be652019-02-28 12:25:18 +0000589TEST_SUITE_END() // W3x3
590TEST_SUITE_END() // QASYMM8
591TEST_SUITE_END() // Quantized
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000592
Jenkins514be652019-02-28 12:25:18 +0000593TEST_SUITE_END() // DepthwiseConvLayer
594TEST_SUITE_END() // NEON
Anthony Barbier8140e1e2017-12-14 23:48:46 +0000595} // namespace validation
596} // namespace test
597} // namespace arm_compute