blob: dd2d9f344ad65cb5f2ca54207a9b86adb7b5a35a [file] [log] [blame]
Giorgio Arena04a8f8c2017-11-23 11:45:24 +00001/*
Georgios Pinitasf72f9362018-01-12 16:29:45 +00002 * Copyright (c) 2017-2018 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,
21 * OUT OF OR IN CONCLCTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#include "arm_compute/core/Types.h"
25#include "arm_compute/runtime/CL/CLTensor.h"
26#include "arm_compute/runtime/CL/CLTensorAllocator.h"
27#include "arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h"
28#include "tests/CL/CLAccessor.h"
29#include "tests/PaddingCalculator.h"
30#include "tests/datasets/DepthwiseConvolutionLayerDataset.h"
31#include "tests/framework/Asserts.h"
32#include "tests/framework/Macros.h"
33#include "tests/framework/datasets/Datasets.h"
34#include "tests/validation/Validation.h"
35#include "tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h"
36
37namespace arm_compute
38{
39namespace test
40{
41namespace validation
42{
43namespace
44{
Georgios Pinitas009fede2018-10-26 12:54:21 +010045RelativeTolerance<half_float::half> tolerance_f16(half_float::half(0.01)); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F16 */
46constexpr 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 +000047constexpr 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 +010048constexpr float tolerance_num = 0.05f; /**< Tolerance number */
Giorgio Arena76572242018-04-04 17:44:26 +010049
50const auto depth_multipliers = framework::dataset::make("DepthMultiplier", { 1, 2, 3 });
Giorgio Arena04a8f8c2017-11-23 11:45:24 +000051} // namespace
52
53TEST_SUITE(CL)
54TEST_SUITE(DepthwiseConvolutionLayer)
55
Giorgio Arenaad0c7382018-04-23 16:16:21 +010056// *INDENT-OFF*
57// clang-format off
58DATA_TEST_CASE(Validate3x3, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +010059 framework::dataset::make("InputInfo", { TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching data type input/weights
60 TensorInfo(TensorShape(32U, 18U, 3U), 1, DataType::F32), // Mismatching input feature maps
61 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Unsupported weights dimensions
62 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::QASYMM8), // Unsupported activation
63 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching depth multiplier
64 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid stride
65 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases size
66 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases dimensions
67 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid output size
68 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Window shrink
69 TensorInfo(TensorShape(32U, 18U, 8U), 1, DataType::F32),
70 TensorInfo(TensorShape(50U, 32U, 8U), 1, DataType::QASYMM8),
Giorgio Arenaad0c7382018-04-23 16:16:21 +010071 }),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +010072 framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16),
73 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
74 TensorInfo(TensorShape(5U, 5U, 2U), 1, DataType::F32),
75 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::QASYMM8),
76 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
77 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
78 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
79 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
80 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
81 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
82 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
83 TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8),
Giorgio Arenaad0c7382018-04-23 16:16:21 +010084 })),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +010085 framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
86 TensorInfo(TensorShape(2U), 1, DataType::F32),
87 TensorInfo(TensorShape(2U), 1, DataType::F32),
88 TensorInfo(TensorShape(2U), 1, DataType::S32),
89 TensorInfo(TensorShape(2U), 1, DataType::F32),
90 TensorInfo(TensorShape(2U), 1, DataType::F32),
91 TensorInfo(TensorShape(4U), 1, DataType::F32),
92 TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
93 TensorInfo(TensorShape(2U), 1, DataType::F32),
94 TensorInfo(TensorShape(2U), 1, DataType::F32),
95 TensorInfo(TensorShape(16U), 1, DataType::F32),
96 TensorInfo(TensorShape(24U), 1, DataType::S32),
Giorgio Arenaad0c7382018-04-23 16:16:21 +010097 })),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +010098 framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
99 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
100 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
101 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::QASYMM8),
102 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
103 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
104 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
105 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
106 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32),
107 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
108 TensorInfo(TensorShape(30U, 16U, 16U), 1, DataType::F32),
109 TensorInfo(TensorShape(48U, 30U, 24U), 1, DataType::QASYMM8),
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100110 })),
111 framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
112 PadStrideInfo(1, 1, 0, 0),
113 PadStrideInfo(1, 1, 0, 0),
114 PadStrideInfo(1, 1, 0, 0),
115 PadStrideInfo(1, 1, 0, 0),
116 PadStrideInfo(4, 1, 0, 0),
117 PadStrideInfo(1, 1, 0, 0),
118 PadStrideInfo(1, 1, 0, 0),
119 PadStrideInfo(1, 1, 0, 0),
120 PadStrideInfo(1, 1, 0, 0),
121 PadStrideInfo(1, 1, 0, 0),
122 PadStrideInfo(1, 1, 0, 0),
123 })),
124 framework::dataset::make("DepthMultiplier", { 1,
125 1,
126 1,
127 1,
128 3,
129 1,
130 1,
131 1,
132 1,
133 1,
134 2,
135 3,
136 })),
137 framework::dataset::make("ActivationInfo", { ActivationLayerInfo(),
138 ActivationLayerInfo(),
139 ActivationLayerInfo(),
140 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LINEAR),
141 ActivationLayerInfo(),
142 ActivationLayerInfo(),
143 ActivationLayerInfo(),
144 ActivationLayerInfo(),
145 ActivationLayerInfo(),
146 ActivationLayerInfo(),
147 ActivationLayerInfo(),
148 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
149 })),
150 framework::dataset::make("Expected", { false, false, false, false, false, false, false, false, false, false, true, true })),
151 input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier, act_info, expected)
152{
153 bool is_valid = bool(CLDepthwiseConvolutionLayer3x3::validate(&input_info.clone()->set_is_resizable(false), &weights_info.clone()->set_is_resizable(false), &biases_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), conv_info, depth_multiplier, act_info));
154 ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
155}
156
157DATA_TEST_CASE(ValidateGeneric, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100158 framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/weights
159 TensorInfo(TensorShape(27U, 13U, 3U), 1, DataType::F32), // Mismatching input feature maps
160 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching depth multiplier
161 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases size
162 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases dimensions
163 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid output size
164 TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32),
165 TensorInfo(TensorShape(32U, 13U, 8U), 1, DataType::QASYMM8),
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100166 }),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100167 framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16),
168 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
169 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
170 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
171 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
172 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
173 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
174 TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8),
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100175 })),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100176 framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
177 TensorInfo(TensorShape(2U), 1, DataType::F32),
178 TensorInfo(TensorShape(2U), 1, DataType::F32),
179 TensorInfo(TensorShape(4U), 1, DataType::F32),
180 TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
181 TensorInfo(TensorShape(2U), 1, DataType::F32),
182 TensorInfo(TensorShape(16U), 1, DataType::F32),
183 TensorInfo(TensorShape(24U), 1, DataType::S32),
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100184 })),
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +0100185 framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
186 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
187 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
188 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
189 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
190 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
191 TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
192 TensorInfo(TensorShape(32U, 11U, 24U), 1, DataType::QASYMM8),
Giorgio Arenaad0c7382018-04-23 16:16:21 +0100193 })),
194 framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
195 PadStrideInfo(1, 1, 0, 0),
196 PadStrideInfo(1, 1, 0, 0),
197 PadStrideInfo(1, 1, 0, 0),
198 PadStrideInfo(1, 1, 0, 0),
199 PadStrideInfo(1, 1, 0, 0),
200 PadStrideInfo(1, 1, 0, 0),
201 PadStrideInfo(1, 1, 1, 0),
202 })),
203 framework::dataset::make("DepthMultiplier", { 1,
204 1,
205 3,
206 1,
207 1,
208 1,
209 2,
210 3,
211 })),
212 framework::dataset::make("Expected", { false, false, false, false, false, false, true, true })),
213 input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier, expected)
214{
215 bool is_valid = bool(CLDepthwiseConvolutionLayer::validate(&input_info.clone()->set_is_resizable(false), &weights_info.clone()->set_is_resizable(false), &biases_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), conv_info, depth_multiplier));
216 ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
217}
218// clang-format on
219// *INDENT-ON*
220
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000221template <typename T>
222using CLDepthwiseConvolutionLayerFixture = DepthwiseConvolutionLayerValidationFixture<CLTensor, CLAccessor, CLDepthwiseConvolutionLayer, T>;
223
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000224TEST_SUITE(Float)
Michele Di Giorgiod24af8a2018-05-08 17:23:52 +0100225TEST_SUITE(FP16)
Michele Di Giorgio933fe862018-02-19 15:42:12 +0000226TEST_SUITE(W3x3)
Giorgio Arenae6bb3c62018-08-23 11:19:11 +0100227TEST_SUITE(NCHW)
Pablo Tello8bf622a2018-12-03 15:54:49 +0000228FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL,
Giorgio Arena76572242018-04-04 17:44:26 +0100229 combine(combine(combine(framework::dataset::concat(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
230 datasets::SmallDepthwiseConvolutionLayerDataset3x3NCHW()),
231 depth_multipliers),
Giorgio Arenadfca60b2018-01-31 10:30:59 +0000232 framework::dataset::make("DataType",
233 DataType::F16)),
234 framework::dataset::make("DataLayout", DataLayout::NCHW)))
Michele Di Giorgio933fe862018-02-19 15:42:12 +0000235{
236 validate(CLAccessor(_target), _reference, tolerance_f16);
237}
Pablo Tello8bf622a2018-12-03 15:54:49 +0000238FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
239 depth_multipliers),
240 framework::dataset::make("DataType",
241 DataType::F16)),
242 framework::dataset::make("DataLayout", DataLayout::NCHW)))
Michele Di Giorgio933fe862018-02-19 15:42:12 +0000243{
244 validate(CLAccessor(_target), _reference, tolerance_f16);
245}
246TEST_SUITE_END()
Michele Di Giorgiod24af8a2018-05-08 17:23:52 +0100247
Giorgio Arenae6bb3c62018-08-23 11:19:11 +0100248TEST_SUITE(NHWC)
Pablo Tello8bf622a2018-12-03 15:54:49 +0000249FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL,
Giorgio Arenae6bb3c62018-08-23 11:19:11 +0100250 combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
Georgios Pinitas05045c12018-12-07 18:31:47 +0000251 depth_multipliers),
Giorgio Arenae6bb3c62018-08-23 11:19:11 +0100252 framework::dataset::make("DataType",
253 DataType::F16)),
254 framework::dataset::make("DataLayout", DataLayout::NHWC)))
255{
256 validate(CLAccessor(_target), _reference, tolerance_f16);
257}
Pablo Tello8bf622a2018-12-03 15:54:49 +0000258FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
Georgios Pinitas05045c12018-12-07 18:31:47 +0000259 depth_multipliers),
Pablo Tello8bf622a2018-12-03 15:54:49 +0000260 framework::dataset::make("DataType",
261 DataType::F16)),
262 framework::dataset::make("DataLayout", DataLayout::NHWC)))
Giorgio Arenae6bb3c62018-08-23 11:19:11 +0100263{
264 validate(CLAccessor(_target), _reference, tolerance_f16);
265}
266TEST_SUITE_END()
267TEST_SUITE_END()
268
Michele Di Giorgiod24af8a2018-05-08 17:23:52 +0100269TEST_SUITE(Generic)
270FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), depth_multipliers),
271 framework::dataset::make("DataType",
272 DataType::F16)),
Giorgio Arenad051e972018-06-20 11:46:42 +0100273 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Michele Di Giorgiod24af8a2018-05-08 17:23:52 +0100274{
275 validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
276}
277FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
278 depth_multipliers),
279 framework::dataset::make("DataType",
280 DataType::F16)),
Giorgio Arenad051e972018-06-20 11:46:42 +0100281 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Michele Di Giorgiod24af8a2018-05-08 17:23:52 +0100282{
283 validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num);
284}
285TEST_SUITE_END()
Michele Di Giorgio933fe862018-02-19 15:42:12 +0000286TEST_SUITE_END()
287
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000288TEST_SUITE(FP32)
289TEST_SUITE(W3x3)
Giorgio Arenad051e972018-06-20 11:46:42 +0100290TEST_SUITE(NCHW)
Pablo Tello8bf622a2018-12-03 15:54:49 +0000291FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL,
Giorgio Arena76572242018-04-04 17:44:26 +0100292 combine(combine(combine(framework::dataset::concat(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
293 datasets::SmallDepthwiseConvolutionLayerDataset3x3NCHW()),
294 depth_multipliers),
Giorgio Arenadfca60b2018-01-31 10:30:59 +0000295 framework::dataset::make("DataType",
296 DataType::F32)),
297 framework::dataset::make("DataLayout", DataLayout::NCHW)))
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000298{
299 validate(CLAccessor(_target), _reference, tolerance_f32);
300}
Pablo Tello8bf622a2018-12-03 15:54:49 +0000301FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
302 depth_multipliers),
303 framework::dataset::make("DataType",
304 DataType::F32)),
305 framework::dataset::make("DataLayout", DataLayout::NCHW)))
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000306{
307 validate(CLAccessor(_target), _reference, tolerance_f32);
308}
309TEST_SUITE_END()
Giorgio Arenad051e972018-06-20 11:46:42 +0100310TEST_SUITE(NHWC)
Pablo Tello8bf622a2018-12-03 15:54:49 +0000311FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL,
Giorgio Arenad051e972018-06-20 11:46:42 +0100312 combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
Georgios Pinitas05045c12018-12-07 18:31:47 +0000313 depth_multipliers),
Giorgio Arenad051e972018-06-20 11:46:42 +0100314 framework::dataset::make("DataType",
315 DataType::F32)),
316 framework::dataset::make("DataLayout", DataLayout::NHWC)))
317{
318 validate(CLAccessor(_target), _reference, tolerance_f32);
319}
Pablo Tello8bf622a2018-12-03 15:54:49 +0000320FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
Georgios Pinitas05045c12018-12-07 18:31:47 +0000321 depth_multipliers),
Pablo Tello8bf622a2018-12-03 15:54:49 +0000322 framework::dataset::make("DataType",
323 DataType::F32)),
324 framework::dataset::make("DataLayout", DataLayout::NHWC)))
Giorgio Arenad051e972018-06-20 11:46:42 +0100325{
326 validate(CLAccessor(_target), _reference, tolerance_f32);
327}
328TEST_SUITE_END()
329TEST_SUITE_END()
Michele Di Giorgiod24af8a2018-05-08 17:23:52 +0100330
331TEST_SUITE(Generic)
332FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(), depth_multipliers),
333 framework::dataset::make("DataType",
334 DataType::F32)),
Giorgio Arenad051e972018-06-20 11:46:42 +0100335 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Michele Di Giorgiod24af8a2018-05-08 17:23:52 +0100336{
337 validate(CLAccessor(_target), _reference, tolerance_f32);
338}
339FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
340 depth_multipliers),
341 framework::dataset::make("DataType",
342 DataType::F32)),
Giorgio Arenad051e972018-06-20 11:46:42 +0100343 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Michele Di Giorgiod24af8a2018-05-08 17:23:52 +0100344{
345 validate(CLAccessor(_target), _reference, tolerance_f32);
346}
347TEST_SUITE_END()
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000348TEST_SUITE_END()
349TEST_SUITE_END()
350
351template <typename T>
Georgios Pinitasde5a1cc2018-02-02 12:52:07 +0000352using CLDepthwiseConvolutionLayerQuantizedFixture = DepthwiseConvolutionLayerValidationQuantizedFixture<CLTensor, CLAccessor, CLDepthwiseConvolutionLayer, T>;
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000353
354TEST_SUITE(Quantized)
355TEST_SUITE(QASYMM8)
Georgios Pinitasde5a1cc2018-02-02 12:52:07 +0000356TEST_SUITE(Generic)
Giorgio Arena76572242018-04-04 17:44:26 +0100357FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
358 combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
359 depth_multipliers),
360 framework::dataset::make("DataType", DataType::QASYMM8)),
361 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
Giorgio Arenad051e972018-06-20 11:46:42 +0100362 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Georgios Pinitasde5a1cc2018-02-02 12:52:07 +0000363{
364 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
365}
Giorgio Arena76572242018-04-04 17:44:26 +0100366FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
367 combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
368 depth_multipliers),
369 framework::dataset::make("DataType", DataType::QASYMM8)),
370 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
Giorgio Arenad051e972018-06-20 11:46:42 +0100371 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Georgios Pinitasde5a1cc2018-02-02 12:52:07 +0000372{
373 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
374}
375TEST_SUITE_END()
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000376TEST_SUITE(W3x3)
Pablo Tello8bf622a2018-12-03 15:54:49 +0000377FIXTURE_DATA_TEST_CASE(RunSmall, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
Giorgio Arena76572242018-04-04 17:44:26 +0100378 combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
Georgios Pinitas05045c12018-12-07 18:31:47 +0000379 depth_multipliers),
Giorgio Arenadfca60b2018-01-31 10:30:59 +0000380 framework::dataset::make("DataType", DataType::QASYMM8)),
381 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
382 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000383{
384 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
385}
Pablo Tello8bf622a2018-12-03 15:54:49 +0000386FIXTURE_DATA_TEST_CASE(RunLarge, CLDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
Giorgio Arena76572242018-04-04 17:44:26 +0100387 combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
Georgios Pinitas05045c12018-12-07 18:31:47 +0000388 depth_multipliers),
Giorgio Arena76572242018-04-04 17:44:26 +0100389 framework::dataset::make("DataType", DataType::QASYMM8)),
390 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
391 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000392{
393 validate(CLAccessor(_target), _reference, tolerance_qasymm8);
394}
395TEST_SUITE_END()
396TEST_SUITE_END()
397TEST_SUITE_END()
398
399TEST_SUITE_END()
400TEST_SUITE_END()
401} // namespace validation
402} // namespace test
403} // namespace arm_compute