blob: b61393f9ea5829d7f2df670e46e506617b724bbc [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"
Usama Arif881f2de2019-04-12 10:29:17 +010032#include "tests/datasets/DilatedDepthwiseConvolutionLayerDataset.h"
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010033#include "tests/framework/Asserts.h"
34#include "tests/framework/Macros.h"
35#include "tests/framework/datasets/Datasets.h"
36#include "tests/validation/Validation.h"
Giorgio Arena04a8f8c2017-11-23 11:45:24 +000037#include "tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h"
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010038
39namespace arm_compute
40{
41namespace test
42{
43namespace validation
44{
Giorgio Arena76572242018-04-04 17:44:26 +010045using namespace arm_compute::misc::shape_calculator;
46
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010047namespace
48{
Georgios Pinitas8cffcd62018-11-16 17:11:50 +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 */
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +000054#endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
Giorgio Arena76572242018-04-04 17:44:26 +010055
56const auto depth_multipliers = framework::dataset::make("DepthMultiplier", { 1, 2, 3 });
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010057} // namespace
58
59TEST_SUITE(NEON)
Pablo Tello941cd702017-12-12 14:35:00 +000060TEST_SUITE(DepthwiseConvLayer)
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010061
Abe Mbise7784c832018-05-31 16:48:41 +010062// *INDENT-OFF*
63// clang-format off
Usama Arif881f2de2019-04-12 10:29:17 +010064DATA_TEST_CASE(Validate3x3, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
Abe Mbise7784c832018-05-31 16:48:41 +010065 framework::dataset::make("InputInfo", { TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching data type input/weights
66 TensorInfo(TensorShape(32U, 18U, 3U), 1, DataType::F32), // Mismatching input feature maps
67 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Unsupported weights dimensions
68 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching depth multiplier
Giorgio Arena66cbafb2018-08-23 14:51:00 +010069 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::QASYMM8), // Invalid stride
Abe Mbise7784c832018-05-31 16:48:41 +010070 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases size
71 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases dimensions
72 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid output size
Usama Arif881f2de2019-04-12 10:29:17 +010073 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // patch size bigger than input width
74 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // dilation < 1
Giorgio Arena66cbafb2018-08-23 14:51:00 +010075 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +010076 }),
Giorgio Arena66cbafb2018-08-23 14:51:00 +010077 framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F16),
78 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
79 TensorInfo(TensorShape(5U, 5U, 2U, 2U), 1, DataType::F32),
80 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
81 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::QASYMM8),
82 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
83 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
84 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
85 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
Usama Arif881f2de2019-04-12 10:29:17 +010086 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
87 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +010088 })),
89 framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
90 TensorInfo(TensorShape(2U), 1, DataType::F32),
91 TensorInfo(TensorShape(2U), 1, DataType::F32),
92 TensorInfo(TensorShape(2U), 1, DataType::F32),
Giorgio Arena66cbafb2018-08-23 14:51:00 +010093 TensorInfo(TensorShape(2U), 1, DataType::S32),
Abe Mbise7784c832018-05-31 16:48:41 +010094 TensorInfo(TensorShape(4U), 1, DataType::F32),
95 TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
96 TensorInfo(TensorShape(2U), 1, DataType::F32),
97 TensorInfo(TensorShape(2U), 1, DataType::F32),
Usama Arif881f2de2019-04-12 10:29:17 +010098 TensorInfo(TensorShape(2U), 1, DataType::F32),
99 TensorInfo(TensorShape(2U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +0100100 })),
101 framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
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),
Giorgio Arena66cbafb2018-08-23 14:51:00 +0100105 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::QASYMM8),
Abe Mbise7784c832018-05-31 16:48:41 +0100106 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
107 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
108 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32),
109 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
Usama Arif881f2de2019-04-12 10:29:17 +0100110 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
111 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +0100112 })),
113 framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
114 PadStrideInfo(1, 1, 0, 0),
115 PadStrideInfo(1, 1, 0, 0),
116 PadStrideInfo(1, 1, 0, 0),
117 PadStrideInfo(4, 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),
Usama Arif881f2de2019-04-12 10:29:17 +0100122 PadStrideInfo(1, 1, 0, 0),
123 PadStrideInfo(1, 1, 0, 0),
Abe Mbise7784c832018-05-31 16:48:41 +0100124 })),
125 framework::dataset::make("DepthMultiplier", { 1,
126 1,
127 1,
128 3,
129 1,
130 1,
131 1,
132 1,
133 1,
Usama Arif881f2de2019-04-12 10:29:17 +0100134 1,
135 1,
Abe Mbise7784c832018-05-31 16:48:41 +0100136 })),
Usama Arif881f2de2019-04-12 10:29:17 +0100137 framework::dataset::make("Dilation", { Size2D(1U, 1U),
138 Size2D(1U, 1U),
139 Size2D(1U, 1U),
140 Size2D(1U, 1U),
141 Size2D(1U, 1U),
142 Size2D(1U, 1U),
143 Size2D(1U, 1U),
144 Size2D(1U, 1U),
145 Size2D(25U, 1U),
146 Size2D(0U, 1U),
147 Size2D(1U, 1U),
148 })),
149 framework::dataset::make("Expected", { false, false, false, false, false, false, false, false, false, false, true })),
150 input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier,dilation, expected)
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100151{
Usama Arif881f2de2019-04-12 10:29:17 +0100152 bool is_valid = bool(NEDepthwiseConvolutionLayer3x3::validate(&input_info.clone()->set_is_resizable(false),
153 &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));
Abe Mbise7784c832018-05-31 16:48:41 +0100154 ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100155}
156
Usama Arif881f2de2019-04-12 10:29:17 +0100157DATA_TEST_CASE(ValidateGeneric, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
Abe Mbise7784c832018-05-31 16:48:41 +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
Usama Arif881f2de2019-04-12 10:29:17 +0100164 TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32), // patch size bigger than input width
165 TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32), // dilation < 1
Abe Mbise7784c832018-05-31 16:48:41 +0100166 TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32),
167 TensorInfo(TensorShape(32U, 13U, 8U), 1, DataType::QASYMM8),
168 }),
169 framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16),
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, 2U), 1, DataType::F32),
174 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
175 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
Usama Arif881f2de2019-04-12 10:29:17 +0100176 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
177 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +0100178 TensorInfo(TensorShape(3U, 3U, 24U), 1, DataType::QASYMM8),
179 })),
180 framework::dataset::make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
181 TensorInfo(TensorShape(2U), 1, DataType::F32),
182 TensorInfo(TensorShape(2U), 1, DataType::F32),
183 TensorInfo(TensorShape(4U), 1, DataType::F32),
184 TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
185 TensorInfo(TensorShape(2U), 1, DataType::F32),
186 TensorInfo(TensorShape(16U), 1, DataType::F32),
Usama Arif881f2de2019-04-12 10:29:17 +0100187 TensorInfo(TensorShape(16U), 1, DataType::F32),
188 TensorInfo(TensorShape(16U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +0100189 TensorInfo(TensorShape(24U), 1, DataType::S32),
190 })),
191 framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
192 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
193 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
194 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
195 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
196 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
197 TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
Usama Arif881f2de2019-04-12 10:29:17 +0100198 TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
199 TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +0100200 TensorInfo(TensorShape(32U, 11U, 24U), 1, DataType::QASYMM8),
201 })),
202 framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
203 PadStrideInfo(1, 1, 0, 0),
204 PadStrideInfo(1, 1, 0, 0),
205 PadStrideInfo(1, 1, 0, 0),
206 PadStrideInfo(1, 1, 0, 0),
207 PadStrideInfo(1, 1, 0, 0),
208 PadStrideInfo(1, 1, 0, 0),
Usama Arif881f2de2019-04-12 10:29:17 +0100209 PadStrideInfo(1, 1, 0, 0),
210 PadStrideInfo(1, 1, 0, 0),
Abe Mbise7784c832018-05-31 16:48:41 +0100211 PadStrideInfo(1, 1, 1, 0),
212 })),
213 framework::dataset::make("DepthMultiplier", { 1,
214 1,
215 3,
216 1,
217 1,
218 1,
219 2,
Usama Arif881f2de2019-04-12 10:29:17 +0100220 2,
221 2,
Abe Mbise7784c832018-05-31 16:48:41 +0100222 3,
223 })),
Usama Arif881f2de2019-04-12 10:29:17 +0100224 framework::dataset::make("Dilation", { Size2D(1U, 1U),
225 Size2D(1U, 1U),
226 Size2D(1U, 1U),
227 Size2D(1U, 1U),
228 Size2D(1U, 1U),
229 Size2D(1U, 1U),
230 Size2D(25U, 1U),
231 Size2D(0U, 1U),
232 Size2D(1U, 1U),
233 Size2D(1U, 1U),
234 })),
235 framework::dataset::make("Expected", { false, false, false, false, false, false,false, false, true, true })),
236 input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier,dilation, expected)
Abe Mbise7784c832018-05-31 16:48:41 +0100237{
Usama Arif881f2de2019-04-12 10:29:17 +0100238 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));
Abe Mbise7784c832018-05-31 16:48:41 +0100239 ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
240}
241// clang-format on
242// *INDENT-ON*
243
Dmitry Savenkod7295b72017-11-20 22:00:08 +0700244TEST_SUITE(Float)
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100245TEST_SUITE(F32)
Michalis Spyroub7b31532017-11-23 12:10:21 +0000246TEST_SUITE(Generic)
247template <typename T>
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000248using NEDepthwiseConvolutionLayerFixture = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T>;
Giorgio Arena76572242018-04-04 17:44:26 +0100249FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
250 depth_multipliers),
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000251 framework::dataset::make("DataType",
Giorgio Arena1ed1fc62018-03-26 16:20:05 +0100252 DataType::F32)),
Giorgio Arena26b22162018-08-13 15:49:49 +0100253 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Michalis Spyroub7b31532017-11-23 12:10:21 +0000254{
255 validate(Accessor(_target), _reference, tolerance_f32);
256}
Giorgio Arena76572242018-04-04 17:44:26 +0100257FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
258 depth_multipliers),
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000259 framework::dataset::make("DataType",
Giorgio Arena1ed1fc62018-03-26 16:20:05 +0100260 DataType::F32)),
Giorgio Arena26b22162018-08-13 15:49:49 +0100261 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Michalis Spyroub7b31532017-11-23 12:10:21 +0000262{
263 validate(Accessor(_target), _reference, tolerance_f32);
264}
Usama Arif881f2de2019-04-12 10:29:17 +0100265
266TEST_SUITE(Dilation)
267FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
268 depth_multipliers),
269 framework::dataset::make("DataType",
270 DataType::F32)),
271 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
272{
273 validate(Accessor(_target), _reference, tolerance_f32);
274}
275FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(),
276 depth_multipliers),
277 framework::dataset::make("DataType",
278 DataType::F32)),
279 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
280{
281 validate(Accessor(_target), _reference, tolerance_f32);
282}
283TEST_SUITE_END() // Dilation
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100284TEST_SUITE_END() // Generic
Michalis Spyroub7b31532017-11-23 12:10:21 +0000285
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100286TEST_SUITE(W3x3)
Michalis Spyroub7b31532017-11-23 12:10:21 +0000287template <typename T>
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000288using NEDepthwiseConvolutionLayerFixture3x3 = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer3x3, T>;
Giorgio Arena76572242018-04-04 17:44:26 +0100289FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
290 depth_multipliers),
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000291 framework::dataset::make("DataType",
Giorgio Arena1ed1fc62018-03-26 16:20:05 +0100292 DataType::F32)),
Giorgio Arena26b22162018-08-13 15:49:49 +0100293 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100294{
295 validate(Accessor(_target), _reference, tolerance_f32);
296}
Giorgio Arena76572242018-04-04 17:44:26 +0100297FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
298 depth_multipliers),
Giorgio Arena04a8f8c2017-11-23 11:45:24 +0000299 framework::dataset::make("DataType",
Giorgio Arena1ed1fc62018-03-26 16:20:05 +0100300 DataType::F32)),
Giorgio Arena26b22162018-08-13 15:49:49 +0100301 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100302{
303 validate(Accessor(_target), _reference, tolerance_f32);
304}
Usama Arif881f2de2019-04-12 10:29:17 +0100305TEST_SUITE(Dilation)
306FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(),
307 depth_multipliers),
308 framework::dataset::make("DataType",
309 DataType::F32)),
310 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
311{
312 validate(Accessor(_target), _reference, tolerance_f32);
313}
314FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
315 depth_multipliers),
316 framework::dataset::make("DataType",
317 DataType::F32)),
318 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
319{
320 validate(Accessor(_target), _reference, tolerance_f32);
321}
322
323TEST_SUITE_END() // Dilation
324
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000325FIXTURE_DATA_TEST_CASE(RunOptimizedSmall, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::PRECOMMIT,
326 combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(),
327 framework::dataset::make("DepthMultiplier", 1)),
328 framework::dataset::make("DataType",
329 DataType::F32)),
330 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
331{
332 validate(Accessor(_target), _reference, tolerance_f32);
333}
334FIXTURE_DATA_TEST_CASE(RunOptimizedLarge, NEDepthwiseConvolutionLayerFixture3x3<float>, framework::DatasetMode::NIGHTLY,
335 combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(),
336 framework::dataset::make("DepthMultiplier", 1)),
337 framework::dataset::make("DataType",
338 DataType::F32)),
339 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Georgios Pinitas4074c992018-01-30 18:13:46 +0000340{
341 validate(Accessor(_target), _reference, tolerance_f32);
342}
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100343TEST_SUITE_END() // W3x3
344TEST_SUITE_END() // F32
Pablo Tello941cd702017-12-12 14:35:00 +0000345
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100346#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
347TEST_SUITE(F16)
Georgios Pinitas8cffcd62018-11-16 17:11:50 +0000348TEST_SUITE(Generic)
349template <typename T>
350using NEDepthwiseConvolutionLayerFixture = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T>;
351FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
352 depth_multipliers),
353 framework::dataset::make("DataType",
354 DataType::F16)),
355 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
356{
357 validate(Accessor(_target), _reference, tolerance_f16, tolerance_num);
358}
359FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
360 depth_multipliers),
361 framework::dataset::make("DataType",
362 DataType::F16)),
363 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
364{
365 validate(Accessor(_target), _reference, tolerance_f16, tolerance_num);
366}
Usama Arif881f2de2019-04-12 10:29:17 +0100367
368TEST_SUITE(Dilation)
369FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
370 depth_multipliers),
371 framework::dataset::make("DataType",
372 DataType::F16)),
373 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
374{
375 validate(Accessor(_target), _reference, tolerance_f16, tolerance_num);
376}
377FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(),
378 depth_multipliers),
379 framework::dataset::make("DataType",
380 DataType::F16)),
381 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
382{
383 validate(Accessor(_target), _reference, tolerance_f16, tolerance_num);
384}
385TEST_SUITE_END() // Dilation
386
Georgios Pinitas8cffcd62018-11-16 17:11:50 +0000387TEST_SUITE_END() // Generic
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100388TEST_SUITE(W3x3)
389template <typename T>
390using NEDepthwiseConvolutionLayerFixture3x3 = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer3x3, T>;
391FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
392 depth_multipliers),
393 framework::dataset::make("DataType",
394 DataType::F16)),
395 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
396{
397 validate(Accessor(_target), _reference, tolerance_f16);
398}
399FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
400 depth_multipliers),
401 framework::dataset::make("DataType",
402 DataType::F16)),
403 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
404{
405 validate(Accessor(_target), _reference, tolerance_f16);
406}
Usama Arif881f2de2019-04-12 10:29:17 +0100407
408TEST_SUITE(Dilation)
409
410FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::ALL, combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(),
411 depth_multipliers),
412 framework::dataset::make("DataType",
413 DataType::F16)),
414 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
415{
416 validate(Accessor(_target), _reference, tolerance_f16);
417}
418FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
419 depth_multipliers),
420 framework::dataset::make("DataType",
421 DataType::F16)),
422 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
423{
424 validate(Accessor(_target), _reference, tolerance_f16);
425}
426
427TEST_SUITE_END() // Dilation
428
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000429FIXTURE_DATA_TEST_CASE(RunOptimizedSmall, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::PRECOMMIT,
430 combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(),
431 framework::dataset::make("DepthMultiplier", 1)),
432 framework::dataset::make("DataType",
433 DataType::F16)),
434 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
435{
436 validate(Accessor(_target), _reference, tolerance_f16);
437}
438FIXTURE_DATA_TEST_CASE(RunOptimizedLarge, NEDepthwiseConvolutionLayerFixture3x3<half>, framework::DatasetMode::NIGHTLY,
439 combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(),
440 framework::dataset::make("DepthMultiplier", 1)),
441 framework::dataset::make("DataType",
442 DataType::F16)),
443 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100444{
445 validate(Accessor(_target), _reference, tolerance_f16);
446}
447TEST_SUITE_END() // W3x3
448TEST_SUITE_END() // FP16
449#endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
450
451TEST_SUITE_END() // Float
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100452
Georgios Pinitasf72f9362018-01-12 16:29:45 +0000453template <typename T>
454using NEDepthwiseConvolutionLayerQuantizedFixture3x3 = DepthwiseConvolutionLayerValidationQuantizedFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer3x3, T>;
Georgios Pinitasd05dce42018-01-22 16:29:17 +0000455template <typename T>
456using NEDepthwiseConvolutionLayerQuantizedFixture = DepthwiseConvolutionLayerValidationQuantizedFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T>;
Georgios Pinitasf72f9362018-01-12 16:29:45 +0000457
458TEST_SUITE(Quantized)
459TEST_SUITE(QASYMM8)
Georgios Pinitasd05dce42018-01-22 16:29:17 +0000460TEST_SUITE(Generic)
Giorgio Arena76572242018-04-04 17:44:26 +0100461FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
462 combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
463 depth_multipliers),
Giorgio Arenadfca60b2018-01-31 10:30:59 +0000464 framework::dataset::make("DataType", DataType::QASYMM8)),
465 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
Giorgio Arena26b22162018-08-13 15:49:49 +0100466 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Georgios Pinitasf72f9362018-01-12 16:29:45 +0000467{
468 validate(Accessor(_target), _reference, tolerance_qasymm8);
469}
Usama Arif881f2de2019-04-12 10:29:17 +0100470
471TEST_SUITE(Dilation)
472FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
473 combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
474 depth_multipliers),
475 framework::dataset::make("DataType", DataType::QASYMM8)),
476 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
477 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
478{
479 validate(Accessor(_target), _reference, tolerance_qasymm8);
480}
481FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
482 combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(),
483 depth_multipliers),
484 framework::dataset::make("DataType", DataType::QASYMM8)),
485 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
486 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
487{
488 validate(Accessor(_target), _reference, tolerance_qasymm8);
489}
490TEST_SUITE_END() //Dilation
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000491TEST_SUITE_END() // Generic
Giorgio Arena76572242018-04-04 17:44:26 +0100492TEST_SUITE(W3x3)
493FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::PRECOMMIT,
494 combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), depth_multipliers),
495 framework::dataset::make("DataType", DataType::QASYMM8)),
496 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
Giorgio Arena26b22162018-08-13 15:49:49 +0100497 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Giorgio Arena76572242018-04-04 17:44:26 +0100498{
499 validate(Accessor(_target), _reference, tolerance_qasymm8);
500}
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000501FIXTURE_DATA_TEST_CASE(RunOptimizedSmall, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::PRECOMMIT,
502 combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(),
503 framework::dataset::make("DepthMultiplier", 1)),
504 framework::dataset::make("DataType",
505 DataType::QASYMM8)),
506 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
507 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
508{
509 validate(Accessor(_target), _reference, tolerance_qasymm8);
510}
511FIXTURE_DATA_TEST_CASE(RunOptimizedLarge, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::NIGHTLY,
512 combine(combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(),
Georgios Pinitasa799ce02018-09-12 20:11:34 +0100513 framework::dataset::make("DepthMultiplier", 1)),
514 framework::dataset::make("DataType",
515 DataType::QASYMM8)),
516 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
517 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
518{
519 validate(Accessor(_target), _reference, tolerance_qasymm8);
520}
Giorgio Arena76572242018-04-04 17:44:26 +0100521FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::NIGHTLY,
522 combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
523 depth_multipliers),
524 framework::dataset::make("DataType", DataType::QASYMM8)),
525 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
Giorgio Arena26b22162018-08-13 15:49:49 +0100526 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
Georgios Pinitasf72f9362018-01-12 16:29:45 +0000527{
528 validate(Accessor(_target), _reference, tolerance_qasymm8);
529}
Usama Arif881f2de2019-04-12 10:29:17 +0100530
531TEST_SUITE(Dilation)
532
533FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::PRECOMMIT,
534 combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(), depth_multipliers),
535 framework::dataset::make("DataType", DataType::QASYMM8)),
536 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
537 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
538{
539 validate(Accessor(_target), _reference, tolerance_qasymm8);
540}
541FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthwiseConvolutionLayerQuantizedFixture3x3<uint8_t>, framework::DatasetMode::NIGHTLY,
542 combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
543 depth_multipliers),
544 framework::dataset::make("DataType", DataType::QASYMM8)),
545 framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.5f, 10) })),
546 framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
547{
548 validate(Accessor(_target), _reference, tolerance_qasymm8);
549}
550TEST_SUITE_END() // Dilation
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000551TEST_SUITE_END() // W3x3
552TEST_SUITE_END() // QASYMM8
553TEST_SUITE_END() // Quantized
Georgios Pinitasf72f9362018-01-12 16:29:45 +0000554
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000555TEST_SUITE_END() // DepthwiseConvLayer
556TEST_SUITE_END() // NEON
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100557} // namespace validation
558} // namespace test
559} // namespace arm_compute