blob: 94f64e19b4020ff75163122ca58d378d32afdbf8 [file] [log] [blame]
Giorgio Arena04a8f8c2017-11-23 11:45:24 +00001/*
Usama Arife73686a2019-04-08 17:30:48 +01002 * Copyright (c) 2017-2019 ARM Limited.
Giorgio Arena04a8f8c2017-11-23 11:45:24 +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,
Usama Arife73686a2019-04-08 17:30:48 +010021 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Giorgio Arena04a8f8c2017-11-23 11:45:24 +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"
Usama Arife73686a2019-04-08 17:30:48 +010031#include "tests/datasets/DilatedDepthwiseConvolutionLayerDataset.h"
Giorgio Arena04a8f8c2017-11-23 11:45:24 +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{
Georgios Pinitas009fede2018-10-26 12:54:21 +010046RelativeTolerance<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 */
Georgios Pinitas83e3e752018-11-07 18:33:08 +000048constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(0); /**< Tolerance value for comparing reference's output against implementation's output for DataType::QASYMM8 */
Georgios Pinitas009fede2018-10-26 12:54:21 +010049constexpr float tolerance_num = 0.05f; /**< Tolerance number */
Giorgio Arena76572242018-04-04 17:44:26 +010050
51const auto depth_multipliers = framework::dataset::make("DepthMultiplier", { 1, 2, 3 });
Giorgio Arena04a8f8c2017-11-23 11:45:24 +000052} // namespace
53
54TEST_SUITE(CL)
55TEST_SUITE(DepthwiseConvolutionLayer)
56
Giorgio Arenaad0c7382018-04-23 16:16:21 +010057// *INDENT-OFF*
58// clang-format off
Usama Arife73686a2019-04-08 17:30:48 +010059DATA_TEST_CASE(Validate3x3, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(zip(
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +010060 framework::dataset::make("InputInfo", { TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching data type input/weights
61 TensorInfo(TensorShape(32U, 18U, 3U), 1, DataType::F32), // Mismatching input feature maps
62 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Unsupported weights dimensions
63 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::QASYMM8), // Unsupported activation
64 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching depth multiplier
65 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid stride
66 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases size
67 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases dimensions
68 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid output size
69 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Window shrink
Usama Arife73686a2019-04-08 17:30:48 +010070 TensorInfo(TensorShape(32U, 18U, 8U), 1, DataType::F32), // patch size bigger than input width
71 TensorInfo(TensorShape(32U, 18U, 8U), 1, DataType::F32), // dilation < 1
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +010072 TensorInfo(TensorShape(32U, 18U, 8U), 1, DataType::F32),
73 TensorInfo(TensorShape(50U, 32U, 8U), 1, DataType::QASYMM8),
Giorgio Arenaad0c7382018-04-23 16:16:21 +010074 }),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +010075 framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16),
76 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
77 TensorInfo(TensorShape(5U, 5U, 2U), 1, DataType::F32),
78 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::QASYMM8),
79 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
80 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
81 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
82 TensorInfo(TensorShape(3U, 3U, 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, 16U), 1, DataType::F32),
Usama Arife73686a2019-04-08 17:30:48 +010086 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
87 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +010088 TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8),
Giorgio Arenaad0c7382018-04-23 16:16:21 +010089 })),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +010090 framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
91 TensorInfo(TensorShape(2U), 1, DataType::F32),
92 TensorInfo(TensorShape(2U), 1, DataType::F32),
93 TensorInfo(TensorShape(2U), 1, DataType::S32),
94 TensorInfo(TensorShape(2U), 1, DataType::F32),
95 TensorInfo(TensorShape(2U), 1, DataType::F32),
96 TensorInfo(TensorShape(4U), 1, DataType::F32),
97 TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
98 TensorInfo(TensorShape(2U), 1, DataType::F32),
99 TensorInfo(TensorShape(2U), 1, DataType::F32),
100 TensorInfo(TensorShape(16U), 1, DataType::F32),
Usama Arife73686a2019-04-08 17:30:48 +0100101 TensorInfo(TensorShape(16U), 1, DataType::F32),
102 TensorInfo(TensorShape(16U), 1, DataType::F32),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100103 TensorInfo(TensorShape(24U), 1, DataType::S32),
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100104 })),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100105 framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
106 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
107 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
108 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::QASYMM8),
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::F32),
113 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32),
114 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
115 TensorInfo(TensorShape(30U, 16U, 16U), 1, DataType::F32),
Usama Arife73686a2019-04-08 17:30:48 +0100116 TensorInfo(TensorShape(30U, 16U, 16U), 1, DataType::F32),
117 TensorInfo(TensorShape(30U, 16U, 16U), 1, DataType::F32),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100118 TensorInfo(TensorShape(48U, 30U, 24U), 1, DataType::QASYMM8),
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100119 })),
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(1, 1, 0, 0),
125 PadStrideInfo(4, 1, 0, 0),
126 PadStrideInfo(1, 1, 0, 0),
127 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),
Usama Arife73686a2019-04-08 17:30:48 +0100132 PadStrideInfo(1, 1, 0, 0),
133 PadStrideInfo(1, 1, 0, 0),
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100134 })),
135 framework::dataset::make("DepthMultiplier", { 1,
136 1,
137 1,
138 1,
139 3,
140 1,
141 1,
142 1,
143 1,
144 1,
145 2,
Usama Arife73686a2019-04-08 17:30:48 +0100146 2,
147 2,
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100148 3,
149 })),
150 framework::dataset::make("ActivationInfo", { ActivationLayerInfo(),
151 ActivationLayerInfo(),
152 ActivationLayerInfo(),
153 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LINEAR),
154 ActivationLayerInfo(),
155 ActivationLayerInfo(),
156 ActivationLayerInfo(),
157 ActivationLayerInfo(),
158 ActivationLayerInfo(),
159 ActivationLayerInfo(),
160 ActivationLayerInfo(),
Usama Arife73686a2019-04-08 17:30:48 +0100161 ActivationLayerInfo(),
162 ActivationLayerInfo(),
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100163 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
164 })),
Usama Arife73686a2019-04-08 17:30:48 +0100165 framework::dataset::make("Dilation", { Size2D(1U, 1U),
166 Size2D(1U, 1U),
167 Size2D(1U, 1U),
168 Size2D(1U, 1U),
169 Size2D(1U, 1U),
170 Size2D(1U, 1U),
171 Size2D(1U, 1U),
172 Size2D(1U, 1U),
173 Size2D(1U, 1U),
174 Size2D(1U, 1U),
175 Size2D(20U, 1U),
176 Size2D(0U, 1U),
177 Size2D(1U, 1U),
178 Size2D(1U, 1U),
179 })),
180 framework::dataset::make("Expected", { false, false, false, false, false, false, false, false, false, false, false, false, true, true })),
181 input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier, act_info, dilation, expected)
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100182{
Usama Arife73686a2019-04-08 17:30:48 +0100183 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));
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100184 ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
185}
186
Usama Arife73686a2019-04-08 17:30:48 +0100187DATA_TEST_CASE(ValidateGeneric, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100188 framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/weights
189 TensorInfo(TensorShape(27U, 13U, 3U), 1, DataType::F32), // Mismatching input feature maps
190 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching depth multiplier
191 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases size
192 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases dimensions
193 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid output size
Usama Arife73686a2019-04-08 17:30:48 +0100194 TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32), // patch size bigger than input width
195 TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32), // dilation < 1
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100196 TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32),
197 TensorInfo(TensorShape(32U, 13U, 8U), 1, DataType::QASYMM8),
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100198 }),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100199 framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16),
200 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
201 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
202 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
203 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
204 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
205 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
Usama Arife73686a2019-04-08 17:30:48 +0100206 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
207 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100208 TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8),
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100209 })),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100210 framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
211 TensorInfo(TensorShape(2U), 1, DataType::F32),
212 TensorInfo(TensorShape(2U), 1, DataType::F32),
213 TensorInfo(TensorShape(4U), 1, DataType::F32),
214 TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
215 TensorInfo(TensorShape(2U), 1, DataType::F32),
216 TensorInfo(TensorShape(16U), 1, DataType::F32),
Usama Arife73686a2019-04-08 17:30:48 +0100217 TensorInfo(TensorShape(16U), 1, DataType::F32),
218 TensorInfo(TensorShape(16U), 1, DataType::F32),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100219 TensorInfo(TensorShape(24U), 1, DataType::S32),
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100220 })),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100221 framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
222 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
223 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
224 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
225 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
226 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
227 TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
Usama Arife73686a2019-04-08 17:30:48 +0100228 TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
229 TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100230 TensorInfo(TensorShape(32U, 11U, 24U), 1, DataType::QASYMM8),
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100231 })),
232 framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
233 PadStrideInfo(1, 1, 0, 0),
234 PadStrideInfo(1, 1, 0, 0),
235 PadStrideInfo(1, 1, 0, 0),
236 PadStrideInfo(1, 1, 0, 0),
237 PadStrideInfo(1, 1, 0, 0),
238 PadStrideInfo(1, 1, 0, 0),
Usama Arife73686a2019-04-08 17:30:48 +0100239 PadStrideInfo(1, 1, 0, 0),
240 PadStrideInfo(1, 1, 0, 0),
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100241 PadStrideInfo(1, 1, 1, 0),
242 })),
243 framework::dataset::make("DepthMultiplier", { 1,
244 1,
245 3,
246 1,
247 1,
248 1,
249 2,
Usama Arife73686a2019-04-08 17:30:48 +0100250 2,
251 2,
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100252 3,
253 })),
Usama Arife73686a2019-04-08 17:30:48 +0100254 framework::dataset::make("Dilation", { Size2D(1U, 1U),
255 Size2D(1U, 1U),
256 Size2D(1U, 1U),
257 Size2D(1U, 1U),
258 Size2D(1U, 1U),
259 Size2D(1U, 1U),
260 Size2D(20U, 1U),
261 Size2D(0U, 1U),
262 Size2D(1U, 1U),
263 Size2D(1U, 1U),
264 })),
265 framework::dataset::make("Expected", { false, false, false, false, false, false, false, false, true, true })),
266 input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier, dilation, expected)
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100267{
Usama Arife73686a2019-04-08 17:30:48 +0100268 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));
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100269 ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
270}
271// clang-format on
272// *INDENT-ON*
273
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000274template <typename T>
275using CLDepthwiseConvolutionLayerFixture = DepthwiseConvolutionLayerValidationFixture<CLTensor, CLAccessor, CLDepthwiseConvolutionLayer, T>;
276
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000277TEST_SUITE(Float)
Michele Di Giorgiod24af8a2018-05-08 17:23:52 +0100278TEST_SUITE(FP16)
Michele Di Giorgio933fe862018-02-19 15:42:12 +0000279TEST_SUITE(W3x3)
Giorgio Arenae6bb3c62018-08-23 11:19:11 +0100280TEST_SUITE(NCHW)
Pablo Tello8bf622a2018-12-03 15:54:49 +0000281FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL,
Giorgio Arena76572242018-04-04 17:44:26 +0100282 combine(combine(combine(framework::dataset::concat(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
283 datasets::SmallDepthwiseConvolutionLayerDataset3x3NCHW()),
284 depth_multipliers),
Giorgio Arenadfca60b2018-01-31 10:30:59 +0000285 framework::dataset::make("DataType",
286 DataType::F16)),
287 framework::dataset::make("DataLayout", DataLayout::NCHW)))
Michele Di Giorgio933fe862018-02-19 15:42:12 +0000288{
289 validate(CLAccessor(_target), _reference, tolerance_f16);
290}
Pablo Tello8bf622a2018-12-03 15:54:49 +0000291FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
292 depth_multipliers),
293 framework::dataset::make("DataType",
294 DataType::F16)),
295 framework::dataset::make("DataLayout", DataLayout::NCHW)))
Michele Di Giorgio933fe862018-02-19 15:42:12 +0000296{
297 validate(CLAccessor(_target), _reference, tolerance_f16);
298}
Usama Arife73686a2019-04-08 17:30:48 +0100299TEST_SUITE(Dilation)
300FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(),
301 depth_multipliers),
302 framework::dataset::make("DataType",
303 DataType::F16)),
304 framework::dataset::make("DataLayout", { DataLayout::NCHW })))
305{
306 validate(CLAccessor(_target), _reference, tolerance_f16);
307}
308FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
309 depth_multipliers),
310 framework::dataset::make("DataType",
311 DataType::F16)),
312 framework::dataset::make("DataLayout", { DataLayout::NCHW })))
313{
314 validate(CLAccessor(_target), _reference, tolerance_f16);
315}
316TEST_SUITE_END() // Dilation
317TEST_SUITE_END() // NCHW
Michele Di Giorgiod24af8a2018-05-08 17:23:52 +0100318
Giorgio Arenae6bb3c62018-08-23 11:19:11 +0100319TEST_SUITE(NHWC)
Pablo Tello8bf622a2018-12-03 15:54:49 +0000320FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL,
Giorgio Arenae6bb3c62018-08-23 11:19:11 +0100321 combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
Georgios Pinitas05045c12018-12-07 18:31:47 +0000322 depth_multipliers),
Giorgio Arenae6bb3c62018-08-23 11:19:11 +0100323 framework::dataset::make("DataType",
324 DataType::F16)),
325 framework::dataset::make("DataLayout", DataLayout::NHWC)))
326{
327 validate(CLAccessor(_target), _reference, tolerance_f16);
328}
Pablo Tello8bf622a2018-12-03 15:54:49 +0000329FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
Georgios Pinitas05045c12018-12-07 18:31:47 +0000330 depth_multipliers),
Pablo Tello8bf622a2018-12-03 15:54:49 +0000331 framework::dataset::make("DataType",
332 DataType::F16)),
333 framework::dataset::make("DataLayout", DataLayout::NHWC)))
Giorgio Arenae6bb3c62018-08-23 11:19:11 +0100334{
335 validate(CLAccessor(_target), _reference, tolerance_f16);
336}
Usama Arife73686a2019-04-08 17:30:48 +0100337TEST_SUITE(Dilation)
338FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(),
339 depth_multipliers),
340 framework::dataset::make("DataType",
341 DataType::F16)),
342 framework::dataset::make("DataLayout", { DataLayout::NHWC })))
343{
344 validate(CLAccessor(_target), _reference, tolerance_f16);
345}
346FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
347 depth_multipliers),
348 framework::dataset::make("DataType",
349 DataType::F16)),
350 framework::dataset::make("DataLayout", { DataLayout::NHWC })))
351{
352 validate(CLAccessor(_target), _reference, tolerance_f16);
353}
354TEST_SUITE_END() // Dilation
355TEST_SUITE_END() // NHWC
356TEST_SUITE_END() // W3x3
Giorgio Arenae6bb3c62018-08-23 11:19:11 +0100357
Michele Di Giorgiod24af8a2018-05-08 17:23:52 +0100358TEST_SUITE(Generic)
359FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), depth_multipliers),
360 framework::dataset::make("DataType",
361 DataType::F16)),
Giorgio Arenad051e972018-06-20 11:46:42 +0100362 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Michele Di Giorgiod24af8a2018-05-08 17:23:52 +0100363{
364 validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
365}
366FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
367 depth_multipliers),
368 framework::dataset::make("DataType",
369 DataType::F16)),
Giorgio Arenad051e972018-06-20 11:46:42 +0100370 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Michele Di Giorgiod24af8a2018-05-08 17:23:52 +0100371{
372 validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
373}
Usama Arife73686a2019-04-08 17:30:48 +0100374
375TEST_SUITE(Dilation)
376FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
377 depth_multipliers),
378 framework::dataset::make("DataType",
379 DataType::F16)),
380 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
381{
382 validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
383}
384FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(),
385 depth_multipliers),
386 framework::dataset::make("DataType",
387 DataType::F16)),
388 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
389{
390 validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
391}
392TEST_SUITE_END() // Dilation
393TEST_SUITE_END() // Generic
394TEST_SUITE_END() // FP16
Michele Di Giorgio933fe862018-02-19 15:42:12 +0000395
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000396TEST_SUITE(FP32)
397TEST_SUITE(W3x3)
Giorgio Arenad051e972018-06-20 11:46:42 +0100398TEST_SUITE(NCHW)
Pablo Tello8bf622a2018-12-03 15:54:49 +0000399FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL,
Giorgio Arena76572242018-04-04 17:44:26 +0100400 combine(combine(combine(framework::dataset::concat(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
401 datasets::SmallDepthwiseConvolutionLayerDataset3x3NCHW()),
402 depth_multipliers),
Giorgio Arenadfca60b2018-01-31 10:30:59 +0000403 framework::dataset::make("DataType",
404 DataType::F32)),
405 framework::dataset::make("DataLayout", DataLayout::NCHW)))
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000406{
407 validate(CLAccessor(_target), _reference, tolerance_f32);
408}
Pablo Tello8bf622a2018-12-03 15:54:49 +0000409FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
410 depth_multipliers),
411 framework::dataset::make("DataType",
412 DataType::F32)),
413 framework::dataset::make("DataLayout", DataLayout::NCHW)))
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000414{
415 validate(CLAccessor(_target), _reference, tolerance_f32);
416}
Usama Arife73686a2019-04-08 17:30:48 +0100417TEST_SUITE(Dilation)
418FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL,
419 combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(), depth_multipliers),
420 framework::dataset::make("DataType",
421 DataType::F32)),
422 framework::dataset::make("DataLayout", DataLayout::NCHW)))
423{
424 validate(CLAccessor(_target), _reference, tolerance_f32);
425}
426FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
427 depth_multipliers),
428 framework::dataset::make("DataType",
429 DataType::F32)),
430 framework::dataset::make("DataLayout", DataLayout::NCHW)))
431{
432 validate(CLAccessor(_target), _reference, tolerance_f32);
433}
434
435TEST_SUITE_END() // Dilation
436TEST_SUITE_END() // NCHW
Giorgio Arenad051e972018-06-20 11:46:42 +0100437TEST_SUITE(NHWC)
Pablo Tello8bf622a2018-12-03 15:54:49 +0000438FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL,
Giorgio Arenad051e972018-06-20 11:46:42 +0100439 combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
Georgios Pinitas05045c12018-12-07 18:31:47 +0000440 depth_multipliers),
Giorgio Arenad051e972018-06-20 11:46:42 +0100441 framework::dataset::make("DataType",
442 DataType::F32)),
443 framework::dataset::make("DataLayout", DataLayout::NHWC)))
444{
445 validate(CLAccessor(_target), _reference, tolerance_f32);
446}
Pablo Tello8bf622a2018-12-03 15:54:49 +0000447FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
Georgios Pinitas05045c12018-12-07 18:31:47 +0000448 depth_multipliers),
Pablo Tello8bf622a2018-12-03 15:54:49 +0000449 framework::dataset::make("DataType",
450 DataType::F32)),
451 framework::dataset::make("DataLayout", DataLayout::NHWC)))
Giorgio Arenad051e972018-06-20 11:46:42 +0100452{
453 validate(CLAccessor(_target), _reference, tolerance_f32);
454}
Usama Arife73686a2019-04-08 17:30:48 +0100455TEST_SUITE(Dilation)
456
457FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL,
458 combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(),
459 depth_multipliers),
460 framework::dataset::make("DataType",
461 DataType::F32)),
462 framework::dataset::make("DataLayout", DataLayout::NHWC)))
463{
464 validate(CLAccessor(_target), _reference, tolerance_f32);
465}
466FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
467 depth_multipliers),
468 framework::dataset::make("DataType",
469 DataType::F32)),
470 framework::dataset::make("DataLayout", DataLayout::NHWC)))
471{
472 validate(CLAccessor(_target), _reference, tolerance_f32);
473}
474TEST_SUITE_END() // Dilation
475TEST_SUITE_END() // NHWC
476TEST_SUITE_END() // W3x3
Michele Di Giorgiod24af8a2018-05-08 17:23:52 +0100477
478TEST_SUITE(Generic)
479FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), depth_multipliers),
480 framework::dataset::make("DataType",
481 DataType::F32)),
Giorgio Arenad051e972018-06-20 11:46:42 +0100482 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Michele Di Giorgiod24af8a2018-05-08 17:23:52 +0100483{
484 validate(CLAccessor(_target), _reference, tolerance_f32);
485}
486FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
487 depth_multipliers),
488 framework::dataset::make("DataType",
489 DataType::F32)),
Giorgio Arenad051e972018-06-20 11:46:42 +0100490 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Michele Di Giorgiod24af8a2018-05-08 17:23:52 +0100491{
492 validate(CLAccessor(_target), _reference, tolerance_f32);
493}
Usama Arife73686a2019-04-08 17:30:48 +0100494
495TEST_SUITE(Dilation)
496FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
497 depth_multipliers),
498 framework::dataset::make("DataType",
499 DataType::F32)),
500 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
501{
502 validate(CLAccessor(_target), _reference, tolerance_f32);
503}
504FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
505 depth_multipliers),
506 framework::dataset::make("DataType",
507 DataType::F32)),
508 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
509{
510 validate(CLAccessor(_target), _reference, tolerance_f32);
511}
512TEST_SUITE_END() // Dilation
513TEST_SUITE_END() // Generic
514TEST_SUITE_END() // FP32
515TEST_SUITE_END() // Float
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000516
517template <typename T>
Georgios Pinitasde5a1cc2018-02-02 12:52:07 +0000518using CLDepthwiseConvolutionLayerQuantizedFixture = DepthwiseConvolutionLayerValidationQuantizedFixture<CLTensor, CLAccessor, CLDepthwiseConvolutionLayer, T>;
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000519
520TEST_SUITE(Quantized)
521TEST_SUITE(QASYMM8)
Georgios Pinitasde5a1cc2018-02-02 12:52:07 +0000522TEST_SUITE(Generic)
Giorgio Arena76572242018-04-04 17:44:26 +0100523FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
524 combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
525 depth_multipliers),
526 framework::dataset::make("DataType", DataType::QASYMM8)),
527 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
Giorgio Arenad051e972018-06-20 11:46:42 +0100528 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Georgios Pinitasde5a1cc2018-02-02 12:52:07 +0000529{
530 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
531}
Giorgio Arena76572242018-04-04 17:44:26 +0100532FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
533 combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
534 depth_multipliers),
535 framework::dataset::make("DataType", DataType::QASYMM8)),
536 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
Giorgio Arenad051e972018-06-20 11:46:42 +0100537 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Georgios Pinitasde5a1cc2018-02-02 12:52:07 +0000538{
539 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
540}
Usama Arife73686a2019-04-08 17:30:48 +0100541TEST_SUITE(Dilation)
542FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
543 combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
544 depth_multipliers),
545 framework::dataset::make("DataType", DataType::QASYMM8)),
546 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
547 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
548{
549 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
550}
551FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
552 combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(),
553 depth_multipliers),
554 framework::dataset::make("DataType", DataType::QASYMM8)),
555 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
556 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
557{
558 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
559}
560TEST_SUITE_END() // Dilation
561TEST_SUITE_END() // Generic
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000562TEST_SUITE(W3x3)
Pablo Tello8bf622a2018-12-03 15:54:49 +0000563FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
Giorgio Arena76572242018-04-04 17:44:26 +0100564 combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
Georgios Pinitas05045c12018-12-07 18:31:47 +0000565 depth_multipliers),
Giorgio Arenadfca60b2018-01-31 10:30:59 +0000566 framework::dataset::make("DataType", DataType::QASYMM8)),
567 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
568 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000569{
570 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
571}
Pablo Tello8bf622a2018-12-03 15:54:49 +0000572FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
Giorgio Arena76572242018-04-04 17:44:26 +0100573 combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
Georgios Pinitas05045c12018-12-07 18:31:47 +0000574 depth_multipliers),
Giorgio Arena76572242018-04-04 17:44:26 +0100575 framework::dataset::make("DataType", DataType::QASYMM8)),
576 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
577 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000578{
579 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
580}
Usama Arife73686a2019-04-08 17:30:48 +0100581TEST_SUITE(Dilation)
582FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
583 combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(),
584 depth_multipliers),
585 framework::dataset::make("DataType", DataType::QASYMM8)),
586 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
587 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
588{
589 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
590}
591FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
592 combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
593 depth_multipliers),
594 framework::dataset::make("DataType", DataType::QASYMM8)),
595 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
596 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
597{
598 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
599}
600TEST_SUITE_END() // Dilation
601TEST_SUITE_END() // W3x3
602TEST_SUITE_END() // QASYMM8
603TEST_SUITE_END() // Quantized
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000604
Usama Arife73686a2019-04-08 17:30:48 +0100605TEST_SUITE_END() // DepthwiseConvolutionLayer
606TEST_SUITE_END() // CL
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000607} // namespace validation
608} // namespace test
609} // namespace arm_compute