blob: 6c0f590241e00b6115f1f2533ded4ba1de5f7464 [file] [log] [blame]
Michalis Spyrou7362f0d2017-10-18 17:58:22 +01001/*
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +00002 * Copyright (c) 2017-2019 ARM Limited.
Michalis Spyrou7362f0d2017-10-18 17:58:22 +01003 *
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,
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +000021 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010022 * SOFTWARE.
23 */
24#include "arm_compute/core/Types.h"
Giorgio Arena76572242018-04-04 17:44:26 +010025#include "arm_compute/core/utils/misc/ShapeCalculator.h"
Giorgio Arena04a8f8c2017-11-23 11:45:24 +000026#include "arm_compute/runtime/NEON/functions/NEDepthwiseConvolutionLayer.h"
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010027#include "arm_compute/runtime/Tensor.h"
28#include "arm_compute/runtime/TensorAllocator.h"
29#include "tests/NEON/Accessor.h"
30#include "tests/PaddingCalculator.h"
Giorgio Arena04a8f8c2017-11-23 11:45:24 +000031#include "tests/datasets/DepthwiseConvolutionLayerDataset.h"
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010032#include "tests/framework/Asserts.h"
33#include "tests/framework/Macros.h"
34#include "tests/framework/datasets/Datasets.h"
35#include "tests/validation/Validation.h"
Giorgio Arena04a8f8c2017-11-23 11:45:24 +000036#include "tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h"
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010037
38namespace arm_compute
39{
40namespace test
41{
42namespace validation
43{
Giorgio Arena76572242018-04-04 17:44:26 +010044using namespace arm_compute::misc::shape_calculator;
45
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010046namespace
47{
Georgios Pinitas8cffcd62018-11-16 17:11:50 +000048constexpr RelativeTolerance<float> tolerance_f32(0.01f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */
49constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1); /**< Tolerance value for comparing reference's output against implementation's output for DataType::QASYMM8 */
50#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
51RelativeTolerance<half_float::half> tolerance_f16(half_float::half(0.01)); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F16 */
52constexpr float tolerance_num = 0.05f; /**< Tolerance number */
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +000053#endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
Giorgio Arena76572242018-04-04 17:44:26 +010054
55const auto depth_multipliers = framework::dataset::make("DepthMultiplier", { 1, 2, 3 });
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010056} // namespace
57
58TEST_SUITE(NEON)
Pablo Tello941cd702017-12-12 14:35:00 +000059TEST_SUITE(DepthwiseConvLayer)
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010060
Abe Mbise7784c832018-05-31 16:48:41 +010061// *INDENT-OFF*
62// clang-format off
63DATA_TEST_CASE(Validate3x3, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(
64 framework::dataset::make("InputInfo", { TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching data type input/weights
65 TensorInfo(TensorShape(32U, 18U, 3U), 1, DataType::F32), // Mismatching input feature maps
66 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Unsupported weights dimensions
67 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching depth multiplier
Giorgio Arena66cbafb2018-08-23 14:51:00 +010068 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::QASYMM8), // Invalid stride
Abe Mbise7784c832018-05-31 16:48:41 +010069 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases size
70 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases dimensions
71 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid output size
Giorgio Arena66cbafb2018-08-23 14:51:00 +010072 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +010073 }),
Giorgio Arena66cbafb2018-08-23 14:51:00 +010074 framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F16),
75 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
76 TensorInfo(TensorShape(5U, 5U, 2U, 2U), 1, DataType::F32),
77 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
78 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::QASYMM8),
79 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
80 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
81 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
82 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +010083 })),
84 framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
85 TensorInfo(TensorShape(2U), 1, DataType::F32),
86 TensorInfo(TensorShape(2U), 1, DataType::F32),
87 TensorInfo(TensorShape(2U), 1, DataType::F32),
Giorgio Arena66cbafb2018-08-23 14:51:00 +010088 TensorInfo(TensorShape(2U), 1, DataType::S32),
Abe Mbise7784c832018-05-31 16:48:41 +010089 TensorInfo(TensorShape(4U), 1, DataType::F32),
90 TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
91 TensorInfo(TensorShape(2U), 1, DataType::F32),
92 TensorInfo(TensorShape(2U), 1, DataType::F32),
93 })),
94 framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
95 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
96 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
97 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
Giorgio Arena66cbafb2018-08-23 14:51:00 +010098 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::QASYMM8),
Abe Mbise7784c832018-05-31 16:48:41 +010099 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
100 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
101 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32),
102 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
103 })),
104 framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
105 PadStrideInfo(1, 1, 0, 0),
106 PadStrideInfo(1, 1, 0, 0),
107 PadStrideInfo(1, 1, 0, 0),
108 PadStrideInfo(4, 1, 0, 0),
109 PadStrideInfo(1, 1, 0, 0),
110 PadStrideInfo(1, 1, 0, 0),
111 PadStrideInfo(1, 1, 0, 0),
112 PadStrideInfo(1, 1, 0, 0),
113 })),
114 framework::dataset::make("DepthMultiplier", { 1,
115 1,
116 1,
117 3,
118 1,
119 1,
120 1,
121 1,
122 1,
123 })),
Giorgio Arena66cbafb2018-08-23 14:51:00 +0100124 framework::dataset::make("Expected", { false, false, false, false, false, false, false, false, true })),
Abe Mbise7784c832018-05-31 16:48:41 +0100125 input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier, expected)
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100126{
Abe Mbise7784c832018-05-31 16:48:41 +0100127 bool is_valid = bool(NEDepthwiseConvolutionLayer3x3::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));
128 ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100129}
130
Abe Mbise7784c832018-05-31 16:48:41 +0100131DATA_TEST_CASE(ValidateGeneric, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(
132 framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/weights
133 TensorInfo(TensorShape(27U, 13U, 3U), 1, DataType::F32), // Mismatching input feature maps
134 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching depth multiplier
135 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases size
136 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases dimensions
137 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid output size
138 TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32),
139 TensorInfo(TensorShape(32U, 13U, 8U), 1, DataType::QASYMM8),
140 }),
141 framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16),
142 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
143 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
144 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
145 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
146 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
147 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
148 TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8),
149 })),
150 framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
151 TensorInfo(TensorShape(2U), 1, DataType::F32),
152 TensorInfo(TensorShape(2U), 1, DataType::F32),
153 TensorInfo(TensorShape(4U), 1, DataType::F32),
154 TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
155 TensorInfo(TensorShape(2U), 1, DataType::F32),
156 TensorInfo(TensorShape(16U), 1, DataType::F32),
157 TensorInfo(TensorShape(24U), 1, DataType::S32),
158 })),
159 framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
160 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
161 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
162 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
163 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
164 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
165 TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
166 TensorInfo(TensorShape(32U, 11U, 24U), 1, DataType::QASYMM8),
167 })),
168 framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
169 PadStrideInfo(1, 1, 0, 0),
170 PadStrideInfo(1, 1, 0, 0),
171 PadStrideInfo(1, 1, 0, 0),
172 PadStrideInfo(1, 1, 0, 0),
173 PadStrideInfo(1, 1, 0, 0),
174 PadStrideInfo(1, 1, 0, 0),
175 PadStrideInfo(1, 1, 1, 0),
176 })),
177 framework::dataset::make("DepthMultiplier", { 1,
178 1,
179 3,
180 1,
181 1,
182 1,
183 2,
184 3,
185 })),
186 framework::dataset::make("Expected", { false, false, false, false, false, false, true, true })),
187 input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier, expected)
188{
189 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));
190 ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
191}
192// clang-format on
193// *INDENT-ON*
194
Dmitry Savenkod7295b72017-11-20 22:00:08 +0700195TEST_SUITE(Float)
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100196TEST_SUITE(F32)
Michalis Spyroub7b31532017-11-23 12:10:21 +0000197TEST_SUITE(Generic)
198template <typename T>
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000199using NEDepthwiseConvolutionLayerFixture = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T>;
Giorgio Arena76572242018-04-04 17:44:26 +0100200FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
201 depth_multipliers),
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000202 framework::dataset::make("DataType",
Giorgio Arena1ed1fc62018-03-26 16:20:05 +0100203 DataType::F32)),
Giorgio Arena26b22162018-08-13 15:49:49 +0100204 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Michalis Spyroub7b31532017-11-23 12:10:21 +0000205{
206 validate(Accessor(_target), _reference, tolerance_f32);
207}
Giorgio Arena76572242018-04-04 17:44:26 +0100208FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
209 depth_multipliers),
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000210 framework::dataset::make("DataType",
Giorgio Arena1ed1fc62018-03-26 16:20:05 +0100211 DataType::F32)),
Giorgio Arena26b22162018-08-13 15:49:49 +0100212 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Michalis Spyroub7b31532017-11-23 12:10:21 +0000213{
214 validate(Accessor(_target), _reference, tolerance_f32);
215}
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100216TEST_SUITE_END() // Generic
Michalis Spyroub7b31532017-11-23 12:10:21 +0000217
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100218TEST_SUITE(W3x3)
Michalis Spyroub7b31532017-11-23 12:10:21 +0000219template <typename T>
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000220using NEDepthwiseConvolutionLayerFixture3x3 = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer3x3, T>;
Giorgio Arena76572242018-04-04 17:44:26 +0100221FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
222 depth_multipliers),
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000223 framework::dataset::make("DataType",
Giorgio Arena1ed1fc62018-03-26 16:20:05 +0100224 DataType::F32)),
Giorgio Arena26b22162018-08-13 15:49:49 +0100225 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100226{
227 validate(Accessor(_target), _reference, tolerance_f32);
228}
Giorgio Arena76572242018-04-04 17:44:26 +0100229FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
230 depth_multipliers),
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000231 framework::dataset::make("DataType",
Giorgio Arena1ed1fc62018-03-26 16:20:05 +0100232 DataType::F32)),
Giorgio Arena26b22162018-08-13 15:49:49 +0100233 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100234{
235 validate(Accessor(_target), _reference, tolerance_f32);
236}
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000237FIXTURE_DATA_TEST_CASE(RunOptimizedSmall, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::PRECOMMIT,
238 combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(),
239 framework::dataset::make("DepthMultiplier", 1)),
240 framework::dataset::make("DataType",
241 DataType::F32)),
242 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
243{
244 validate(Accessor(_target), _reference, tolerance_f32);
245}
246FIXTURE_DATA_TEST_CASE(RunOptimizedLarge, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::NIGHTLY,
247 combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(),
248 framework::dataset::make("DepthMultiplier", 1)),
249 framework::dataset::make("DataType",
250 DataType::F32)),
251 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Georgios Pinitas4074c992018-01-30 18:13:46 +0000252{
253 validate(Accessor(_target), _reference, tolerance_f32);
254}
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100255TEST_SUITE_END() // W3x3
256TEST_SUITE_END() // F32
Pablo Tello941cd702017-12-12 14:35:00 +0000257
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100258#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
259TEST_SUITE(F16)
Georgios Pinitas8cffcd62018-11-16 17:11:50 +0000260TEST_SUITE(Generic)
261template <typename T>
262using NEDepthwiseConvolutionLayerFixture = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T>;
263FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
264 depth_multipliers),
265 framework::dataset::make("DataType",
266 DataType::F16)),
267 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
268{
269 validate(Accessor(_target), _reference, tolerance_f16, tolerance_num);
270}
271FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
272 depth_multipliers),
273 framework::dataset::make("DataType",
274 DataType::F16)),
275 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
276{
277 validate(Accessor(_target), _reference, tolerance_f16, tolerance_num);
278}
279TEST_SUITE_END() // Generic
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100280TEST_SUITE(W3x3)
281template <typename T>
282using NEDepthwiseConvolutionLayerFixture3x3 = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer3x3, T>;
283FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
284 depth_multipliers),
285 framework::dataset::make("DataType",
286 DataType::F16)),
287 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
288{
289 validate(Accessor(_target), _reference, tolerance_f16);
290}
291FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture3x3<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, DataLayout::NHWC })))
296{
297 validate(Accessor(_target), _reference, tolerance_f16);
298}
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000299FIXTURE_DATA_TEST_CASE(RunOptimizedSmall, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::PRECOMMIT,
300 combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(),
301 framework::dataset::make("DepthMultiplier", 1)),
302 framework::dataset::make("DataType",
303 DataType::F16)),
304 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
305{
306 validate(Accessor(_target), _reference, tolerance_f16);
307}
308FIXTURE_DATA_TEST_CASE(RunOptimizedLarge, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::NIGHTLY,
309 combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(),
310 framework::dataset::make("DepthMultiplier", 1)),
311 framework::dataset::make("DataType",
312 DataType::F16)),
313 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100314{
315 validate(Accessor(_target), _reference, tolerance_f16);
316}
317TEST_SUITE_END() // W3x3
318TEST_SUITE_END() // FP16
319#endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
320
321TEST_SUITE_END() // Float
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100322
Georgios Pinitasf72f9362018-01-12 16:29:45 +0000323template <typename T>
324using NEDepthwiseConvolutionLayerQuantizedFixture3x3 = DepthwiseConvolutionLayerValidationQuantizedFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer3x3, T>;
Georgios Pinitasd05dce42018-01-22 16:29:17 +0000325template <typename T>
326using NEDepthwiseConvolutionLayerQuantizedFixture = DepthwiseConvolutionLayerValidationQuantizedFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T>;
Georgios Pinitasf72f9362018-01-12 16:29:45 +0000327
328TEST_SUITE(Quantized)
329TEST_SUITE(QASYMM8)
Georgios Pinitasd05dce42018-01-22 16:29:17 +0000330TEST_SUITE(Generic)
Giorgio Arena76572242018-04-04 17:44:26 +0100331FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
332 combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
333 depth_multipliers),
Giorgio Arenadfca60b2018-01-31 10:30:59 +0000334 framework::dataset::make("DataType", DataType::QASYMM8)),
335 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
Giorgio Arena26b22162018-08-13 15:49:49 +0100336 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Georgios Pinitasf72f9362018-01-12 16:29:45 +0000337{
338 validate(Accessor(_target), _reference, tolerance_qasymm8);
339}
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000340TEST_SUITE_END() // Generic
Giorgio Arena76572242018-04-04 17:44:26 +0100341TEST_SUITE(W3x3)
342FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::PRECOMMIT,
343 combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), depth_multipliers),
344 framework::dataset::make("DataType", DataType::QASYMM8)),
345 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
Giorgio Arena26b22162018-08-13 15:49:49 +0100346 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Giorgio Arena76572242018-04-04 17:44:26 +0100347{
348 validate(Accessor(_target), _reference, tolerance_qasymm8);
349}
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000350FIXTURE_DATA_TEST_CASE(RunOptimizedSmall, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::PRECOMMIT,
351 combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(),
352 framework::dataset::make("DepthMultiplier", 1)),
353 framework::dataset::make("DataType",
354 DataType::QASYMM8)),
355 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
356 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
357{
358 validate(Accessor(_target), _reference, tolerance_qasymm8);
359}
360FIXTURE_DATA_TEST_CASE(RunOptimizedLarge, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::NIGHTLY,
361 combine(combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(),
Georgios Pinitasa799ce02018-09-12 20:11:34 +0100362 framework::dataset::make("DepthMultiplier", 1)),
363 framework::dataset::make("DataType",
364 DataType::QASYMM8)),
365 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
366 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
367{
368 validate(Accessor(_target), _reference, tolerance_qasymm8);
369}
Giorgio Arena76572242018-04-04 17:44:26 +0100370FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::NIGHTLY,
371 combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
372 depth_multipliers),
373 framework::dataset::make("DataType", DataType::QASYMM8)),
374 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
Giorgio Arena26b22162018-08-13 15:49:49 +0100375 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Georgios Pinitasf72f9362018-01-12 16:29:45 +0000376{
377 validate(Accessor(_target), _reference, tolerance_qasymm8);
378}
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000379TEST_SUITE_END() // W3x3
380TEST_SUITE_END() // QASYMM8
381TEST_SUITE_END() // Quantized
Georgios Pinitasf72f9362018-01-12 16:29:45 +0000382
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000383TEST_SUITE_END() // DepthwiseConvLayer
384TEST_SUITE_END() // NEON
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100385} // namespace validation
386} // namespace test
387} // namespace arm_compute