blob: a5d7a31cfc12d483a6dca703239d8dcfc35ffea9 [file] [log] [blame]
Michalis Spyrou7362f0d2017-10-18 17:58:22 +01001/*
Gunes Bayir3af4c9b2023-10-08 17:51:28 +01002 * Copyright (c) 2017-2023 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{
Gunes Bayir3af4c9b2023-10-08 17:51:28 +010045using framework::dataset::make;
Giorgio Arena76572242018-04-04 17:44:26 +010046using namespace arm_compute::misc::shape_calculator;
47
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010048namespace
49{
Georgios Pinitas8cffcd62018-11-16 17:11:50 +000050constexpr RelativeTolerance<float> tolerance_f32(0.01f); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F32 */
51constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1); /**< Tolerance value for comparing reference's output against implementation's output for DataType::QASYMM8 */
52#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
Manuel Bottinie5df1d52021-04-29 12:06:33 +010053RelativeTolerance<half_float::half> tolerance_f16(half_float::half(0.02)); /**< Tolerance value for comparing reference's output against implementation's output for DataType::F16 */
Georgios Pinitas8cffcd62018-11-16 17:11:50 +000054constexpr float tolerance_num = 0.05f; /**< Tolerance number */
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +000055#endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
Giorgio Arena76572242018-04-04 17:44:26 +010056
Gunes Bayir3af4c9b2023-10-08 17:51:28 +010057const auto depth_multipliers = make("DepthMultiplier", { 1, 2, 8 });
58const auto large_depth_multipliers = make("DepthMultiplier", { 5, 32 });
Manuel Bottinia788c2f2019-04-08 13:18:00 +010059
60//Activation Functions
Gunes Bayir3af4c9b2023-10-08 17:51:28 +010061const auto ActivationFunctionsDataset = make("ActivationInfo",
Manuel Bottinia788c2f2019-04-08 13:18:00 +010062{
63 ActivationLayerInfo(),
64 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)
65});
Michele Di Giorgiof29d1b72019-10-29 10:58:13 +000066
Gunes Bayir3af4c9b2023-10-08 17:51:28 +010067const auto ActivationFunctionsDatasetNightly = make("ActivationInfo",
68{
69 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 0.5f),
70 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 0.5f, -0.5f),
71 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LEAKY_RELU, 0.1f),
72 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::SOFT_RELU),
73 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::ELU),
74 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::ABS),
75 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LOGISTIC),
76 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::TANH),
77 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::SQUARE),
78 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::SWISH),
79 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::HARD_SWISH),
80 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LINEAR, 2.f, 1.f),
81#ifdef __aarch64__
82 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::GELU),
83#endif // __aarch64__
84});
85
86const auto ActivationFunctionsQuantizedDataset = make("ActivationInfo",
87{
88 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, 0.5f),
89 ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 0.5f, -0.5f),
90});
91
92const auto input_qinfo_dataset = make("InputQInfo",
Michele Di Giorgiof29d1b72019-10-29 10:58:13 +000093{
94 QuantizationInfo(0.3f, 10),
95 QuantizationInfo(2.2f, 10),
96});
Michalis Spyrou7362f0d2017-10-18 17:58:22 +010097} // namespace
98
99TEST_SUITE(NEON)
Manuel Bottinia788c2f2019-04-08 13:18:00 +0100100TEST_SUITE(DepthwiseConvolutionLayer)
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100101
Abe Mbise7784c832018-05-31 16:48:41 +0100102// *INDENT-OFF*
103// clang-format off
Usama Arif881f2de2019-04-12 10:29:17 +0100104DATA_TEST_CASE(Validate3x3, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100105 make("InputInfo", { TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching data type input/weights
Abe Mbise7784c832018-05-31 16:48:41 +0100106 TensorInfo(TensorShape(32U, 18U, 3U), 1, DataType::F32), // Mismatching input feature maps
107 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Unsupported weights dimensions
108 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Mismatching depth multiplier
Giorgio Arena66cbafb2018-08-23 14:51:00 +0100109 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::QASYMM8), // Invalid stride
Abe Mbise7784c832018-05-31 16:48:41 +0100110 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases size
111 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid biases dimensions
112 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32), // Invalid output size
Usama Arif881f2de2019-04-12 10:29:17 +0100113 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // patch size bigger than input width
114 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // dilation < 1
Giorgio Arena66cbafb2018-08-23 14:51:00 +0100115 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +0100116 }),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100117 make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F16),
Giorgio Arena66cbafb2018-08-23 14:51:00 +0100118 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
119 TensorInfo(TensorShape(5U, 5U, 2U, 2U), 1, DataType::F32),
120 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
121 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::QASYMM8),
122 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
123 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
124 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
125 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
Usama Arif881f2de2019-04-12 10:29:17 +0100126 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
127 TensorInfo(TensorShape(3U, 3U, 2U, 2U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +0100128 })),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100129 make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +0100130 TensorInfo(TensorShape(2U), 1, DataType::F32),
131 TensorInfo(TensorShape(2U), 1, DataType::F32),
132 TensorInfo(TensorShape(2U), 1, DataType::F32),
Giorgio Arena66cbafb2018-08-23 14:51:00 +0100133 TensorInfo(TensorShape(2U), 1, DataType::S32),
Abe Mbise7784c832018-05-31 16:48:41 +0100134 TensorInfo(TensorShape(4U), 1, DataType::F32),
135 TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
136 TensorInfo(TensorShape(2U), 1, DataType::F32),
137 TensorInfo(TensorShape(2U), 1, DataType::F32),
Usama Arif881f2de2019-04-12 10:29:17 +0100138 TensorInfo(TensorShape(2U), 1, DataType::F32),
139 TensorInfo(TensorShape(2U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +0100140 })),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100141 make("OutputInfo", { TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +0100142 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
143 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
144 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
Giorgio Arena66cbafb2018-08-23 14:51:00 +0100145 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::QASYMM8),
Abe Mbise7784c832018-05-31 16:48:41 +0100146 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
147 TensorInfo(TensorShape(30U, 16U, 2U), 1, DataType::F32),
148 TensorInfo(TensorShape(32U, 18U, 2U), 1, DataType::F32),
149 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
Usama Arif881f2de2019-04-12 10:29:17 +0100150 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
151 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +0100152 })),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100153 make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
Abe Mbise7784c832018-05-31 16:48:41 +0100154 PadStrideInfo(1, 1, 0, 0),
155 PadStrideInfo(1, 1, 0, 0),
156 PadStrideInfo(1, 1, 0, 0),
157 PadStrideInfo(4, 1, 0, 0),
158 PadStrideInfo(1, 1, 0, 0),
159 PadStrideInfo(1, 1, 0, 0),
160 PadStrideInfo(1, 1, 0, 0),
161 PadStrideInfo(1, 1, 0, 0),
Usama Arif881f2de2019-04-12 10:29:17 +0100162 PadStrideInfo(1, 1, 0, 0),
163 PadStrideInfo(1, 1, 0, 0),
Abe Mbise7784c832018-05-31 16:48:41 +0100164 })),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100165 make("DepthMultiplier", { 1,
Abe Mbise7784c832018-05-31 16:48:41 +0100166 1,
167 1,
168 3,
169 1,
170 1,
171 1,
172 1,
173 1,
Usama Arif881f2de2019-04-12 10:29:17 +0100174 1,
175 1,
Abe Mbise7784c832018-05-31 16:48:41 +0100176 })),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100177 make("Dilation", { Size2D(1U, 1U),
Usama Arif881f2de2019-04-12 10:29:17 +0100178 Size2D(1U, 1U),
179 Size2D(1U, 1U),
180 Size2D(1U, 1U),
181 Size2D(1U, 1U),
182 Size2D(1U, 1U),
183 Size2D(1U, 1U),
184 Size2D(1U, 1U),
185 Size2D(25U, 1U),
186 Size2D(0U, 1U),
187 Size2D(1U, 1U),
188 })),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100189 make("Expected", { false, false, false, false, false, false, false, false, false, false, true })),
Usama Arif881f2de2019-04-12 10:29:17 +0100190 input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier,dilation, expected)
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100191{
Manuel Bottini05069f02019-09-26 17:18:26 +0100192 bool is_valid = bool(NEDepthwiseConvolutionLayer::validate(&input_info.clone()->set_is_resizable(false),
Usama Arif881f2de2019-04-12 10:29:17 +0100193 &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 +0100194 ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100195}
196
Usama Arif881f2de2019-04-12 10:29:17 +0100197DATA_TEST_CASE(ValidateGeneric, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zip(
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100198 make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/weights
Giorgio Arenad93e2632019-10-15 11:09:33 +0100199 TensorInfo(TensorShape(27U, 13U, 3U), 1, DataType::F32), // Mismatching input feature maps
200 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching depth multiplier
201 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases size
202 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases dimensions
203 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid output size
204 TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32), // Patch size bigger than input width
205 TensorInfo(TensorShape(27U, 13U, 8U), 1, DataType::F32), // Dilation < 1
Abe Mbise7784c832018-05-31 16:48:41 +0100206 }),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100207 make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F16),
Abe Mbise7784c832018-05-31 16:48:41 +0100208 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
209 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
210 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
211 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
212 TensorInfo(TensorShape(3U, 3U, 2U), 1, DataType::F32),
213 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
Usama Arif881f2de2019-04-12 10:29:17 +0100214 TensorInfo(TensorShape(3U, 3U, 16U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +0100215 })),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100216 make("BiasesInfo", { TensorInfo(TensorShape(2U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +0100217 TensorInfo(TensorShape(2U), 1, DataType::F32),
218 TensorInfo(TensorShape(2U), 1, DataType::F32),
219 TensorInfo(TensorShape(4U), 1, DataType::F32),
220 TensorInfo(TensorShape(2U, 2U), 1, DataType::F32),
221 TensorInfo(TensorShape(2U), 1, DataType::F32),
222 TensorInfo(TensorShape(16U), 1, DataType::F32),
Usama Arif881f2de2019-04-12 10:29:17 +0100223 TensorInfo(TensorShape(16U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +0100224 })),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100225 make("OutputInfo", { TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +0100226 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
227 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
228 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
229 TensorInfo(TensorShape(25U, 11U, 2U), 1, DataType::F32),
230 TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),
231 TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
Usama Arif881f2de2019-04-12 10:29:17 +0100232 TensorInfo(TensorShape(25U, 11U, 16U), 1, DataType::F32),
Abe Mbise7784c832018-05-31 16:48:41 +0100233 })),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100234 make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
Abe Mbise7784c832018-05-31 16:48:41 +0100235 PadStrideInfo(1, 1, 0, 0),
236 PadStrideInfo(1, 1, 0, 0),
237 PadStrideInfo(1, 1, 0, 0),
238 PadStrideInfo(1, 1, 0, 0),
239 PadStrideInfo(1, 1, 0, 0),
240 PadStrideInfo(1, 1, 0, 0),
Usama Arif881f2de2019-04-12 10:29:17 +0100241 PadStrideInfo(1, 1, 0, 0),
Abe Mbise7784c832018-05-31 16:48:41 +0100242 })),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100243 make("DepthMultiplier", { 1,
Abe Mbise7784c832018-05-31 16:48:41 +0100244 1,
245 3,
246 1,
247 1,
248 1,
249 2,
Usama Arif881f2de2019-04-12 10:29:17 +0100250 2,
Abe Mbise7784c832018-05-31 16:48:41 +0100251 })),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100252 make("Dilation", { Size2D(1U, 1U),
Usama Arif881f2de2019-04-12 10:29:17 +0100253 Size2D(1U, 1U),
254 Size2D(1U, 1U),
255 Size2D(1U, 1U),
256 Size2D(1U, 1U),
257 Size2D(1U, 1U),
258 Size2D(25U, 1U),
259 Size2D(0U, 1U),
Usama Arif881f2de2019-04-12 10:29:17 +0100260 })),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100261 make("Expected", { false, false, false, false, false, false, false, false})),
Usama Arif881f2de2019-04-12 10:29:17 +0100262 input_info, weights_info, biases_info, output_info, conv_info, depth_multiplier,dilation, expected)
Abe Mbise7784c832018-05-31 16:48:41 +0100263{
Usama Arif881f2de2019-04-12 10:29:17 +0100264 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 +0100265 ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
266}
267// clang-format on
268// *INDENT-ON*
Manuel Bottini05069f02019-09-26 17:18:26 +0100269template <typename T>
270using NEDepthwiseConvolutionLayerFixture = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T>;
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000271template <typename T>
272using NEDepthwiseConvolutionLayerMixedDataLayoutFixture = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T, true>;
Milos Puzovica7077e92022-10-28 16:49:15 +0100273template <typename T>
274using NEDepthwiseConvolutionLayerVariableWeightsFixture = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T, false, false, true>;
Abe Mbise7784c832018-05-31 16:48:41 +0100275
Dmitry Savenkod7295b72017-11-20 22:00:08 +0700276TEST_SUITE(Float)
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100277TEST_SUITE(F32)
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100278
279FIXTURE_DATA_TEST_CASE_NEW(RunActivations, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY,
280 combine(
281 make("In", TensorShape(33U, 27U, 11U, 3U)),
282 make("Weights", Size2D(3U, 4U)),
283 make("Info", PadStrideInfo(1, 2, 0, 1)),
284 make("Dilation", Size2D(2U, 2U)),
285 make("DepthMultiplier", { 5 }),
286 make("DataType", DataType::F32),
287 make("DataLayout", { DataLayout::NHWC, DataLayout::NCHW }),
288 ActivationFunctionsDatasetNightly))
289{
290 validate(Accessor(_target), _reference, tolerance_f32);
291}
292
Michalis Spyroub7b31532017-11-23 12:10:21 +0000293TEST_SUITE(Generic)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000294FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
295 depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100296 make("DataType", DataType::F32)),
297 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000298 ActivationFunctionsDataset))
Michalis Spyroub7b31532017-11-23 12:10:21 +0000299{
300 validate(Accessor(_target), _reference, tolerance_f32);
301}
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000302FIXTURE_DATA_TEST_CASE_NEW(RunMixedDataLayout, NEDepthwiseConvolutionLayerMixedDataLayoutFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100303 make("DepthMultiplier", { 2 })),
304 make("DataType", DataType::F32)),
305 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
306 make("ActivationInfo", ActivationLayerInfo())))
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000307{
308 validate(Accessor(_target), _reference, tolerance_f32);
309}
Giorgio Arena68e29da2021-02-08 16:31:10 +0000310FIXTURE_DATA_TEST_CASE_NEW(RunLarge, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
311 large_depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100312 make("DataType", DataType::F32)),
313 make("DataLayout", { DataLayout::NHWC })),
314 make("ActivationInfo", { ActivationLayerInfo() })))
Michalis Spyroub7b31532017-11-23 12:10:21 +0000315{
316 validate(Accessor(_target), _reference, tolerance_f32);
317}
Usama Arif881f2de2019-04-12 10:29:17 +0100318TEST_SUITE(Dilation)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000319FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT,
320 combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
321 depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100322 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000323 DataType::F32)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100324 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000325 ActivationFunctionsDataset))
Usama Arif881f2de2019-04-12 10:29:17 +0100326{
327 validate(Accessor(_target), _reference, tolerance_f32);
328}
Giorgio Arena68e29da2021-02-08 16:31:10 +0000329FIXTURE_DATA_TEST_CASE_NEW(RunLarge, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY,
330 combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(),
331 large_depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100332 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000333 DataType::F32)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100334 make("DataLayout", { DataLayout::NHWC })),
335 make("ActivationInfo", { ActivationLayerInfo() })))
Usama Arif881f2de2019-04-12 10:29:17 +0100336{
337 validate(Accessor(_target), _reference, tolerance_f32);
338}
339TEST_SUITE_END() // Dilation
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100340TEST_SUITE_END() // Generic
Michalis Spyroub7b31532017-11-23 12:10:21 +0000341
Georgios Pinitas4c758512019-07-10 19:49:11 +0100342TEST_SUITE(W3x3)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000343FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
344 depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100345 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000346 DataType::F32)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100347 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000348 ActivationFunctionsDataset))
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100349{
350 validate(Accessor(_target), _reference, tolerance_f32);
351}
Giorgio Arena68e29da2021-02-08 16:31:10 +0000352FIXTURE_DATA_TEST_CASE_NEW(RunLarge, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY,
353 combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
354 large_depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100355 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000356 DataType::F32)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100357 make("DataLayout", { DataLayout::NHWC })),
358 make("ActivationInfo", { ActivationLayerInfo() })))
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100359{
360 validate(Accessor(_target), _reference, tolerance_f32);
361}
Usama Arif881f2de2019-04-12 10:29:17 +0100362TEST_SUITE(Dilation)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000363FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT,
364 combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(),
365 depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100366 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000367 DataType::F32)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100368 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000369 ActivationFunctionsDataset))
Usama Arif881f2de2019-04-12 10:29:17 +0100370{
371 validate(Accessor(_target), _reference, tolerance_f32);
372}
Giorgio Arena68e29da2021-02-08 16:31:10 +0000373FIXTURE_DATA_TEST_CASE_NEW(RunLarge, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY,
374 combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
375 large_depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100376 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000377 DataType::F32)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100378 make("DataLayout", { DataLayout::NHWC })),
379 make("ActivationInfo", { ActivationLayerInfo() })))
Usama Arif881f2de2019-04-12 10:29:17 +0100380{
381 validate(Accessor(_target), _reference, tolerance_f32);
382}
383
384TEST_SUITE_END() // Dilation
Georgios Pinitas4c758512019-07-10 19:49:11 +0100385TEST_SUITE_END() // W3x3
Usama Arif881f2de2019-04-12 10:29:17 +0100386
Georgios Pinitas4c758512019-07-10 19:49:11 +0100387TEST_SUITE(Optimized)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000388FIXTURE_DATA_TEST_CASE_NEW(RunSmall3x3, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT,
389 combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100390 make("DepthMultiplier", 1)),
391 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000392 DataType::F32)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100393 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000394 ActivationFunctionsDataset))
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000395{
396 validate(Accessor(_target), _reference, tolerance_f32);
397}
Milos Puzovica7077e92022-10-28 16:49:15 +0100398FIXTURE_DATA_TEST_CASE_NEW(RunVariableWeightsSmall3x3, NEDepthwiseConvolutionLayerVariableWeightsFixture<float>, framework::DatasetMode::PRECOMMIT,
399 combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100400 make("DepthMultiplier", 1)),
401 make("DataType",
Milos Puzovica7077e92022-10-28 16:49:15 +0100402 DataType::F32)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100403 make("DataLayout", { DataLayout::NHWC })),
Milos Puzovica7077e92022-10-28 16:49:15 +0100404 ActivationFunctionsDataset))
405{
406 validate(Accessor(_target), _reference, tolerance_f32);
407}
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000408FIXTURE_DATA_TEST_CASE_NEW(RunMixedDataLayout3x3, NEDepthwiseConvolutionLayerMixedDataLayoutFixture<float>, framework::DatasetMode::PRECOMMIT,
409 combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100410 make("DepthMultiplier", 1)),
411 make("DataType", DataType::F32)),
412 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
413 make("ActivationInfo", ActivationLayerInfo())))
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000414{
415 validate(Accessor(_target), _reference, tolerance_f32);
416}
Giorgio Arena68e29da2021-02-08 16:31:10 +0000417FIXTURE_DATA_TEST_CASE_NEW(RunSmall5x5, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT,
418 combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset5x5(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100419 make("DepthMultiplier", 1)),
420 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000421 DataType::F32)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100422 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000423 ActivationFunctionsDataset))
Georgios Pinitas4c758512019-07-10 19:49:11 +0100424{
425 validate(Accessor(_target), _reference, tolerance_f32);
426}
Milos Puzovica7077e92022-10-28 16:49:15 +0100427FIXTURE_DATA_TEST_CASE_NEW(RunVariableWeightsSmall5x5, NEDepthwiseConvolutionLayerVariableWeightsFixture<float>, framework::DatasetMode::PRECOMMIT,
428 combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset5x5(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100429 make("DepthMultiplier", 1)),
430 make("DataType",
Milos Puzovica7077e92022-10-28 16:49:15 +0100431 DataType::F32)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100432 make("DataLayout", { DataLayout::NHWC })),
Milos Puzovica7077e92022-10-28 16:49:15 +0100433 ActivationFunctionsDataset))
434{
435 validate(Accessor(_target), _reference, tolerance_f32);
436}
Giorgio Arena68e29da2021-02-08 16:31:10 +0000437FIXTURE_DATA_TEST_CASE_NEW(RunLarge3x3, NEDepthwiseConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY,
438 combine(combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100439 make("DepthMultiplier", 1)),
440 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000441 DataType::F32)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100442 make("DataLayout", { DataLayout::NHWC })),
443 make("ActivationInfo", { ActivationLayerInfo() })))
Georgios Pinitas4074c992018-01-30 18:13:46 +0000444{
445 validate(Accessor(_target), _reference, tolerance_f32);
446}
Milos Puzovica7077e92022-10-28 16:49:15 +0100447FIXTURE_DATA_TEST_CASE_NEW(RunVariableWeightsLarge3x3, NEDepthwiseConvolutionLayerVariableWeightsFixture<float>, framework::DatasetMode::NIGHTLY,
448 combine(combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100449 make("DepthMultiplier", 1)),
450 make("DataType",
Milos Puzovica7077e92022-10-28 16:49:15 +0100451 DataType::F32)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100452 make("DataLayout", { DataLayout::NHWC })),
453 make("ActivationInfo", { ActivationLayerInfo() })))
Milos Puzovica7077e92022-10-28 16:49:15 +0100454{
455 validate(Accessor(_target), _reference, tolerance_f32);
456}
Georgios Pinitas4c758512019-07-10 19:49:11 +0100457TEST_SUITE_END() // Optimized
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100458TEST_SUITE_END() // F32
Pablo Tello941cd702017-12-12 14:35:00 +0000459
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100460#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
461TEST_SUITE(F16)
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100462
463FIXTURE_DATA_TEST_CASE_NEW(RunActivations, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY,
464 combine(
465 make("In", TensorShape(33U, 27U, 11U, 3U)),
466 make("Weights", Size2D(3U, 4U)),
467 make("Info", PadStrideInfo(1, 2, 0, 1)),
468 make("Dilation", Size2D(2U, 2U)),
469 make("DepthMultiplier", { 5 }),
470 make("DataType", DataType::F16),
471 make("DataLayout", { DataLayout::NHWC, DataLayout::NCHW }),
472 ActivationFunctionsDatasetNightly))
473{
474 validate(Accessor(_target), _reference, tolerance_f16, tolerance_num);
475}
476
Georgios Pinitas8cffcd62018-11-16 17:11:50 +0000477TEST_SUITE(Generic)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000478FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
479 depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100480 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000481 DataType::F16)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100482 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000483 ActivationFunctionsDataset))
Georgios Pinitas8cffcd62018-11-16 17:11:50 +0000484{
485 validate(Accessor(_target), _reference, tolerance_f16, tolerance_num);
486}
Giorgio Arena68e29da2021-02-08 16:31:10 +0000487FIXTURE_DATA_TEST_CASE_NEW(RunLarge, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset(),
488 large_depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100489 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000490 DataType::F16)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100491 make("DataLayout", { DataLayout::NHWC })),
492 make("ActivationInfo", { ActivationLayerInfo() })))
Georgios Pinitas8cffcd62018-11-16 17:11:50 +0000493{
494 validate(Accessor(_target), _reference, tolerance_f16, tolerance_num);
495}
Usama Arif881f2de2019-04-12 10:29:17 +0100496
497TEST_SUITE(Dilation)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000498FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT,
499 combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
500 depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100501 make("DataType", DataType::F16)),
502 make("DataLayout", { DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000503 ActivationFunctionsDataset))
Usama Arif881f2de2019-04-12 10:29:17 +0100504{
505 validate(Accessor(_target), _reference, tolerance_f16, tolerance_num);
506}
Giorgio Arena68e29da2021-02-08 16:31:10 +0000507FIXTURE_DATA_TEST_CASE_NEW(RunLarge, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY,
508 combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(),
509 large_depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100510 make("DataType", DataType::F16)),
511 make("DataLayout", { DataLayout::NHWC })),
512 make("ActivationInfo", { ActivationLayerInfo() })))
Usama Arif881f2de2019-04-12 10:29:17 +0100513{
514 validate(Accessor(_target), _reference, tolerance_f16, tolerance_num);
515}
516TEST_SUITE_END() // Dilation
517
Georgios Pinitas8cffcd62018-11-16 17:11:50 +0000518TEST_SUITE_END() // Generic
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100519template <typename T>
Manuel Bottini05069f02019-09-26 17:18:26 +0100520using NEDepthwiseConvolutionLayerFixture = DepthwiseConvolutionLayerValidationFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T>;
Georgios Pinitas4c758512019-07-10 19:49:11 +0100521TEST_SUITE(W3x3)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000522FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(),
523 depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100524 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000525 DataType::F16)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100526 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000527 ActivationFunctionsDataset))
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100528{
529 validate(Accessor(_target), _reference, tolerance_f16);
530}
Giorgio Arena68e29da2021-02-08 16:31:10 +0000531FIXTURE_DATA_TEST_CASE_NEW(RunLarge, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY,
532 combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
533 large_depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100534 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000535 DataType::F16)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100536 make("DataLayout", { DataLayout::NHWC })),
537 make("ActivationInfo", { ActivationLayerInfo() })))
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100538{
539 validate(Accessor(_target), _reference, tolerance_f16);
540}
Usama Arif881f2de2019-04-12 10:29:17 +0100541
542TEST_SUITE(Dilation)
543
Giorgio Arena68e29da2021-02-08 16:31:10 +0000544FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT,
545 combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(),
546 depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100547 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000548 DataType::F16)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100549 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000550 ActivationFunctionsDataset))
Usama Arif881f2de2019-04-12 10:29:17 +0100551{
552 validate(Accessor(_target), _reference, tolerance_f16);
553}
Giorgio Arena68e29da2021-02-08 16:31:10 +0000554FIXTURE_DATA_TEST_CASE_NEW(RunLarge, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY,
555 combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
556 large_depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100557 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000558 DataType::F16)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100559 make("DataLayout", { DataLayout::NHWC })),
560 make("ActivationInfo", { ActivationLayerInfo() })))
Usama Arif881f2de2019-04-12 10:29:17 +0100561{
562 validate(Accessor(_target), _reference, tolerance_f16);
563}
564
565TEST_SUITE_END() // Dilation
Georgios Pinitas4c758512019-07-10 19:49:11 +0100566TEST_SUITE_END() // W3x3
Usama Arif881f2de2019-04-12 10:29:17 +0100567
Georgios Pinitas4c758512019-07-10 19:49:11 +0100568TEST_SUITE(Optimized)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000569FIXTURE_DATA_TEST_CASE_NEW(RunSmallW3x3, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT,
570 combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100571 make("DepthMultiplier", 1)),
572 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000573 DataType::F16)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100574 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000575 ActivationFunctionsDataset))
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000576{
577 validate(Accessor(_target), _reference, tolerance_f16);
578}
Giorgio Arena68e29da2021-02-08 16:31:10 +0000579FIXTURE_DATA_TEST_CASE_NEW(RunSmallW5x5, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT,
580 combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset5x5(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100581 make("DepthMultiplier", 1)),
582 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000583 DataType::F16)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100584 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000585 ActivationFunctionsDataset))
Georgios Pinitas4c758512019-07-10 19:49:11 +0100586{
587 validate(Accessor(_target), _reference, tolerance_f16);
588}
Giorgio Arena68e29da2021-02-08 16:31:10 +0000589FIXTURE_DATA_TEST_CASE_NEW(RunLargeW3x3, NEDepthwiseConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY,
590 combine(combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100591 make("DepthMultiplier", 1)),
592 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000593 DataType::F16)),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100594 make("DataLayout", { DataLayout::NHWC })),
595 make("ActivationInfo", { ActivationLayerInfo() })))
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100596{
597 validate(Accessor(_target), _reference, tolerance_f16);
598}
Georgios Pinitas4c758512019-07-10 19:49:11 +0100599TEST_SUITE_END() // Optimized
Georgios Pinitas20c246a2018-09-12 16:45:53 +0100600TEST_SUITE_END() // FP16
601#endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
602
603TEST_SUITE_END() // Float
Michalis Spyrou7362f0d2017-10-18 17:58:22 +0100604
Georgios Pinitasf72f9362018-01-12 16:29:45 +0000605template <typename T>
Giorgio Arenad93e2632019-10-15 11:09:33 +0100606using NEDepthwiseConvolutionLayerQuantizedFixture = DepthwiseConvolutionLayerValidationQuantizedFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T>;
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000607template <typename T>
608using NEDepthwiseConvolutionLayerQuantizedMixedDataLayoutFixture = DepthwiseConvolutionLayerValidationQuantizedFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, T, true>;
Giorgio Arenad93e2632019-10-15 11:09:33 +0100609using NEDepthwiseConvolutionLayerQuantizedSymmetricPerChannelFixture = DepthwiseConvolutionLayerValidationQuantizedPerChannelFixture<Tensor, Accessor, NEDepthwiseConvolutionLayer, uint8_t, int8_t>;
Georgios Pinitasf72f9362018-01-12 16:29:45 +0000610
611TEST_SUITE(Quantized)
612TEST_SUITE(QASYMM8)
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100613
614FIXTURE_DATA_TEST_CASE_NEW(RunActivations, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
615 combine(
616 make("In", TensorShape(33U, 27U, 11U, 3U)),
617 make("Weights", Size2D(3U, 4U)),
618 make("Info", PadStrideInfo(1, 2, 0, 1)),
619 make("Dilation", Size2D(2U, 2U)),
620 make("DepthMultiplier", { 5 }),
621 make("DataType", DataType::QASYMM8),
622 make("SrcQuantizationInfo", { QuantizationInfo(0.3f, 10) }),
623 make("DstQuantizationInfo", { QuantizationInfo(0.05f, 4) }),
624 make("DataLayout", { DataLayout::NHWC, DataLayout::NCHW }),
625 ActivationFunctionsQuantizedDataset))
626{
627 validate(Accessor(_target), _reference, tolerance_qasymm8);
628}
629
Georgios Pinitasd05dce42018-01-22 16:29:17 +0000630TEST_SUITE(Generic)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000631FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
632 combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
633 depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100634 make("DataType", DataType::QASYMM8)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000635 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100636 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 4) })),
637 make("DataLayout", { DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000638 ActivationFunctionsDataset))
Georgios Pinitasf72f9362018-01-12 16:29:45 +0000639{
640 validate(Accessor(_target), _reference, tolerance_qasymm8);
641}
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000642FIXTURE_DATA_TEST_CASE_NEW(RunMixedDataLayout, NEDepthwiseConvolutionLayerQuantizedMixedDataLayoutFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
643 combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100644 make("DepthMultiplier", { 2 })),
645 make("DataType", DataType::QASYMM8)),
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000646 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100647 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 4) })),
648 make("DataLayout", { DataLayout::NHWC })),
649 make("ActivationInfo", ActivationLayerInfo())))
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000650{
651 validate(Accessor(_target), _reference, tolerance_qasymm8);
652}
Usama Arif881f2de2019-04-12 10:29:17 +0100653TEST_SUITE(Dilation)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000654FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
655 combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
656 depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100657 make("DataType", DataType::QASYMM8)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000658 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100659 make("DstQuantizationInfo", { QuantizationInfo(0.8f, 1) })),
660 make("DataLayout", { DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000661 ActivationFunctionsDataset))
Usama Arif881f2de2019-04-12 10:29:17 +0100662{
663 validate(Accessor(_target), _reference, tolerance_qasymm8);
664}
Giorgio Arena68e29da2021-02-08 16:31:10 +0000665FIXTURE_DATA_TEST_CASE_NEW(RunLarge, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
666 combine(combine(combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(),
667 large_depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100668 make("DataType", DataType::QASYMM8)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000669 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100670 make("DstQuantizationInfo", { QuantizationInfo(0.9f, 11) })),
671 make("DataLayout", { DataLayout::NHWC })),
672 make("ActivationInfo", { ActivationLayerInfo() })))
Usama Arif881f2de2019-04-12 10:29:17 +0100673{
674 validate(Accessor(_target), _reference, tolerance_qasymm8);
675}
Georgios Pinitas4c758512019-07-10 19:49:11 +0100676TEST_SUITE_END() // Dilation
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000677TEST_SUITE_END() // Generic
Giorgio Arena76572242018-04-04 17:44:26 +0100678TEST_SUITE(W3x3)
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000679FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
Giorgio Arena68e29da2021-02-08 16:31:10 +0000680 combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100681 make("DataType", DataType::QASYMM8)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000682 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100683 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })),
684 make("DataLayout", { DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000685 ActivationFunctionsDataset))
Giorgio Arena76572242018-04-04 17:44:26 +0100686{
687 validate(Accessor(_target), _reference, tolerance_qasymm8);
688}
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000689FIXTURE_DATA_TEST_CASE_NEW(RunLarge, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
Giorgio Arena68e29da2021-02-08 16:31:10 +0000690 combine(combine(combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
691 large_depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100692 make("DataType", DataType::QASYMM8)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000693 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100694 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })),
695 make("DataLayout", { DataLayout::NHWC })),
696 make("ActivationInfo", { ActivationLayerInfo() })))
Georgios Pinitasf72f9362018-01-12 16:29:45 +0000697{
698 validate(Accessor(_target), _reference, tolerance_qasymm8);
699}
Usama Arif881f2de2019-04-12 10:29:17 +0100700
701TEST_SUITE(Dilation)
702
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000703FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
Giorgio Arena68e29da2021-02-08 16:31:10 +0000704 combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(), depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100705 make("DataType", DataType::QASYMM8)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000706 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100707 make("DstQuantizationInfo", { QuantizationInfo(0.7f, 10) })),
708 make("DataLayout", { DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000709 ActivationFunctionsDataset))
Usama Arif881f2de2019-04-12 10:29:17 +0100710{
711 validate(Accessor(_target), _reference, tolerance_qasymm8);
712}
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000713FIXTURE_DATA_TEST_CASE_NEW(RunLarge, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
Giorgio Arena68e29da2021-02-08 16:31:10 +0000714 combine(combine(combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
715 large_depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100716 make("DataType", DataType::QASYMM8)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000717 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100718 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })),
719 make("DataLayout", { DataLayout::NHWC })),
720 make("ActivationInfo", { ActivationLayerInfo() })))
Usama Arif881f2de2019-04-12 10:29:17 +0100721{
722 validate(Accessor(_target), _reference, tolerance_qasymm8);
723}
724TEST_SUITE_END() // Dilation
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000725TEST_SUITE_END() // W3x3
Georgios Pinitas4c758512019-07-10 19:49:11 +0100726
727TEST_SUITE(Optimized)
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000728FIXTURE_DATA_TEST_CASE_NEW(RunSmall3x3, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
Giorgio Arena68e29da2021-02-08 16:31:10 +0000729 combine(combine(combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100730 make("DepthMultiplier", 1)),
731 make("DataType", DataType::QASYMM8)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000732 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100733 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })),
734 make("DataLayout", { DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000735 ActivationFunctionsDataset))
Georgios Pinitas4c758512019-07-10 19:49:11 +0100736{
737 validate(Accessor(_target), _reference, tolerance_qasymm8);
738}
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000739FIXTURE_DATA_TEST_CASE_NEW(RunMixedDataLayout3x3, NEDepthwiseConvolutionLayerQuantizedMixedDataLayoutFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
740 combine(combine(combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100741 make("DepthMultiplier", 1)),
742 make("DataType", DataType::QASYMM8)),
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000743 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100744 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })),
745 make("DataLayout", { DataLayout::NHWC })),
746 make("ActivationInfo", ActivationLayerInfo())))
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000747{
748 validate(Accessor(_target), _reference, tolerance_qasymm8);
749}
750FIXTURE_DATA_TEST_CASE_NEW(RunSmall5x5, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
Giorgio Arena68e29da2021-02-08 16:31:10 +0000751 combine(combine(combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset5x5(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100752 make("DepthMultiplier", 1)),
753 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000754 DataType::QASYMM8)),
755 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100756 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })),
757 make("DataLayout", { DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000758 ActivationFunctionsDataset))
Georgios Pinitas4c758512019-07-10 19:49:11 +0100759{
760 validate(Accessor(_target), _reference, tolerance_qasymm8);
761}
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000762FIXTURE_DATA_TEST_CASE_NEW(RunLarge3x3, NEDepthwiseConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
Giorgio Arena68e29da2021-02-08 16:31:10 +0000763 combine(combine(combine(combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100764 make("DepthMultiplier", 1)),
765 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000766 DataType::QASYMM8)),
767 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100768 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })),
769 make("DataLayout", { DataLayout::NHWC })),
770 make("ActivationInfo", { ActivationLayerInfo() })))
Georgios Pinitas4c758512019-07-10 19:49:11 +0100771{
772 validate(Accessor(_target), _reference, tolerance_qasymm8);
773}
774TEST_SUITE_END() // Optimized
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +0000775TEST_SUITE_END() // QASYMM8
Michele Di Giorgio13ec5f02020-01-02 12:11:13 +0000776
777TEST_SUITE(QASYMM8_SIGNED)
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100778
779FIXTURE_DATA_TEST_CASE_NEW(RunActivations, NEDepthwiseConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::NIGHTLY,
780 combine(
781 make("In", TensorShape(33U, 27U, 11U, 3U)),
782 make("Weights", Size2D(3U, 4U)),
783 make("Info", PadStrideInfo(1, 2, 0, 1)),
784 make("Dilation", Size2D(2U, 2U)),
785 make("DepthMultiplier", { 5 }),
786 make("DataType", DataType::QASYMM8_SIGNED),
787 make("SrcQuantizationInfo", { QuantizationInfo(0.3f, 10) }),
788 make("DstQuantizationInfo", { QuantizationInfo(0.05f, 4) }),
789 make("DataLayout", { DataLayout::NHWC, DataLayout::NCHW }),
790 ActivationFunctionsQuantizedDataset))
791{
792 validate(Accessor(_target), _reference, tolerance_qasymm8);
793}
794
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000795TEST_SUITE(Generic)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000796FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::PRECOMMIT,
797 combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
798 depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100799 make("DataType", DataType::QASYMM8_SIGNED)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000800 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100801 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 4) })),
802 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000803 ActivationFunctionsDataset))
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000804{
805 validate(Accessor(_target), _reference, tolerance_qasymm8);
806}
807
808TEST_SUITE(Dilation)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000809FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::PRECOMMIT,
810 combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
811 depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100812 make("DataType", DataType::QASYMM8_SIGNED)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000813 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100814 make("DstQuantizationInfo", { QuantizationInfo(0.8f, 1) })),
815 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000816 ActivationFunctionsDataset))
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000817{
818 validate(Accessor(_target), _reference, tolerance_qasymm8);
819}
Giorgio Arena68e29da2021-02-08 16:31:10 +0000820FIXTURE_DATA_TEST_CASE_NEW(RunLarge, NEDepthwiseConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::NIGHTLY,
821 combine(combine(combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(),
822 large_depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100823 make("DataType", DataType::QASYMM8_SIGNED)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000824 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100825 make("DstQuantizationInfo", { QuantizationInfo(0.9f, 11) })),
826 make("DataLayout", { DataLayout::NCHW })),
827 make("ActivationInfo", { ActivationLayerInfo() })))
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000828{
829 validate(Accessor(_target), _reference, tolerance_qasymm8);
830}
831TEST_SUITE_END() // Dilation
832TEST_SUITE_END() // Generic
833
Michele Di Giorgio13ec5f02020-01-02 12:11:13 +0000834TEST_SUITE(W3x3)
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000835FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::PRECOMMIT,
Giorgio Arena68e29da2021-02-08 16:31:10 +0000836 combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset3x3(), depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100837 make("DataType", DataType::QASYMM8_SIGNED)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000838 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100839 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })),
840 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000841 ActivationFunctionsDataset))
Michele Di Giorgio13ec5f02020-01-02 12:11:13 +0000842{
843 validate(Accessor(_target), _reference, tolerance_qasymm8);
844}
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000845FIXTURE_DATA_TEST_CASE_NEW(RunLarge, NEDepthwiseConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::NIGHTLY,
Giorgio Arena68e29da2021-02-08 16:31:10 +0000846 combine(combine(combine(combine(combine(combine(datasets::LargeDepthwiseConvolutionLayerDataset3x3(),
847 large_depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100848 make("DataType", DataType::QASYMM8_SIGNED)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000849 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100850 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })),
851 make("DataLayout", { DataLayout::NCHW })),
852 make("ActivationInfo", { ActivationLayerInfo() })))
Michele Di Giorgio13ec5f02020-01-02 12:11:13 +0000853{
854 validate(Accessor(_target), _reference, tolerance_qasymm8);
855}
856
857TEST_SUITE(Dilation)
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000858FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::PRECOMMIT,
Giorgio Arena68e29da2021-02-08 16:31:10 +0000859 combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset3x3(), depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100860 make("DataType", DataType::QASYMM8_SIGNED)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000861 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100862 make("DstQuantizationInfo", { QuantizationInfo(0.7f, 10) })),
863 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000864 ActivationFunctionsDataset))
Michele Di Giorgio13ec5f02020-01-02 12:11:13 +0000865{
866 validate(Accessor(_target), _reference, tolerance_qasymm8);
867}
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000868FIXTURE_DATA_TEST_CASE_NEW(RunLarge, NEDepthwiseConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::NIGHTLY,
Giorgio Arena68e29da2021-02-08 16:31:10 +0000869 combine(combine(combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset3x3(),
870 large_depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100871 make("DataType", DataType::QASYMM8_SIGNED)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000872 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100873 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })),
874 make("DataLayout", { DataLayout::NCHW })),
875 make("ActivationInfo", { ActivationLayerInfo() })))
Michele Di Giorgio13ec5f02020-01-02 12:11:13 +0000876{
877 validate(Accessor(_target), _reference, tolerance_qasymm8);
878}
879TEST_SUITE_END() // Dilation
880TEST_SUITE_END() // W3x3
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000881
882TEST_SUITE(Optimized)
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000883FIXTURE_DATA_TEST_CASE_NEW(RunSmall3x3, NEDepthwiseConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::PRECOMMIT,
Giorgio Arena68e29da2021-02-08 16:31:10 +0000884 combine(combine(combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100885 make("DepthMultiplier", 1)),
886 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000887 DataType::QASYMM8_SIGNED)),
888 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100889 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })),
890 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000891 ActivationFunctionsDataset))
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000892{
893 validate(Accessor(_target), _reference, tolerance_qasymm8);
894}
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000895FIXTURE_DATA_TEST_CASE_NEW(RunSmall5x5, NEDepthwiseConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::PRECOMMIT,
Giorgio Arena68e29da2021-02-08 16:31:10 +0000896 combine(combine(combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset5x5(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100897 make("DepthMultiplier", 1)),
898 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000899 DataType::QASYMM8_SIGNED)),
900 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100901 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })),
902 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000903 ActivationFunctionsDataset))
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000904{
905 validate(Accessor(_target), _reference, tolerance_qasymm8);
906}
Manuel Bottinica62c6f2021-03-23 11:50:34 +0000907FIXTURE_DATA_TEST_CASE_NEW(RunLarge3x3, NEDepthwiseConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::NIGHTLY,
Giorgio Arena68e29da2021-02-08 16:31:10 +0000908 combine(combine(combine(combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100909 make("DepthMultiplier", 1)),
910 make("DataType",
Giorgio Arena68e29da2021-02-08 16:31:10 +0000911 DataType::QASYMM8_SIGNED)),
912 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100913 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 10) })),
914 make("DataLayout", { DataLayout::NCHW })),
915 make("ActivationInfo", { ActivationLayerInfo() })))
Michele Di Giorgio8c837ca2020-01-07 15:06:41 +0000916{
917 validate(Accessor(_target), _reference, tolerance_qasymm8);
918}
919TEST_SUITE_END() // Optimized
Michele Di Giorgio13ec5f02020-01-02 12:11:13 +0000920TEST_SUITE_END() // QASYMM8_SIGNED
921
Giorgio Arenad93e2632019-10-15 11:09:33 +0100922TEST_SUITE(QSYMM8_PER_CHANNEL)
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100923
924FIXTURE_DATA_TEST_CASE_NEW(RunActivations, NEDepthwiseConvolutionLayerQuantizedSymmetricPerChannelFixture, framework::DatasetMode::NIGHTLY,
925 combine(
926 make("In", TensorShape(33U, 27U, 11U, 3U)),
927 make("Weights", Size2D(3U, 4U)),
928 make("Info", PadStrideInfo(1, 2, 0, 1)),
929 make("Dilation", Size2D(2U, 2U)),
930 make("DepthMultiplier", { 5 }),
931 make("InputDataType", DataType::QASYMM8),
932 make("WeightsDataType", DataType::QSYMM8_PER_CHANNEL),
933 make("SrcQuantizationInfo", { QuantizationInfo(0.3f, 10) }),
934 make("DstQuantizationInfo", { QuantizationInfo(0.05f, 4) }),
935 make("DataLayout", { DataLayout::NHWC, DataLayout::NCHW }),
936 ActivationFunctionsQuantizedDataset))
937{
938 validate(Accessor(_target), _reference, tolerance_qasymm8);
939}
940
Giorgio Arenad93e2632019-10-15 11:09:33 +0100941TEST_SUITE(Generic)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000942FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerQuantizedSymmetricPerChannelFixture, framework::DatasetMode::PRECOMMIT,
943 combine(combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseConvolutionLayerDataset(),
944 depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100945 make("InputDataType", DataType::QASYMM8)),
946 make("WeightsDataType", DataType::QSYMM8_PER_CHANNEL)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000947 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100948 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 4) })),
949 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000950 ActivationFunctionsDataset))
Giorgio Arenad93e2632019-10-15 11:09:33 +0100951{
952 validate(Accessor(_target), _reference, tolerance_qasymm8);
953}
954
955TEST_SUITE(Dilation)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000956FIXTURE_DATA_TEST_CASE_NEW(RunSmall, NEDepthwiseConvolutionLayerQuantizedSymmetricPerChannelFixture, framework::DatasetMode::PRECOMMIT,
957 combine(combine(combine(combine(combine(combine(combine(datasets::SmallDepthwiseDilatedConvolutionLayerDataset(),
958 depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100959 make("InputDataType", DataType::QASYMM8)),
960 make("WeightsDataType", DataType::QSYMM8_PER_CHANNEL)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000961 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100962 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 4) })),
963 make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000964 ActivationFunctionsDataset))
Giorgio Arenad93e2632019-10-15 11:09:33 +0100965{
966 validate(Accessor(_target), _reference, tolerance_qasymm8);
967}
Giorgio Arena68e29da2021-02-08 16:31:10 +0000968FIXTURE_DATA_TEST_CASE_NEW(RunLarge, NEDepthwiseConvolutionLayerQuantizedSymmetricPerChannelFixture, framework::DatasetMode::NIGHTLY,
969 combine(combine(combine(combine(combine(combine(combine(datasets::LargeDepthwiseDilatedConvolutionLayerDataset(),
970 depth_multipliers),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100971 make("InputDataType", DataType::QASYMM8)),
972 make("WeightsDataType", DataType::QSYMM8_PER_CHANNEL)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000973 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100974 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 4) })),
975 make("DataLayout", { DataLayout::NHWC })),
976 make("ActivationInfo", { ActivationLayerInfo() })))
Giorgio Arenad93e2632019-10-15 11:09:33 +0100977{
978 validate(Accessor(_target), _reference, tolerance_qasymm8);
979}
980TEST_SUITE_END() // Dilation
981TEST_SUITE_END() // Generic
Giuseppe Rossinif01201a2019-11-06 14:57:49 +0000982
983TEST_SUITE(Optimized)
Giorgio Arena68e29da2021-02-08 16:31:10 +0000984FIXTURE_DATA_TEST_CASE_NEW(RunSmall3x3, NEDepthwiseConvolutionLayerQuantizedSymmetricPerChannelFixture, framework::DatasetMode::PRECOMMIT,
985 combine(combine(combine(combine(combine(combine(combine(datasets::SmallOptimizedDepthwiseConvolutionLayerDataset3x3(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100986 make("DepthMultiplier", 1)),
987 make("InputDataType", DataType::QASYMM8)),
988 make("WeightsDataType", DataType::QSYMM8_PER_CHANNEL)),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000989 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100990 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 4) })),
991 make("DataLayout", { DataLayout::NHWC })),
Giorgio Arena68e29da2021-02-08 16:31:10 +0000992 ActivationFunctionsDataset))
Giuseppe Rossinif01201a2019-11-06 14:57:49 +0000993{
994 validate(Accessor(_target), _reference, tolerance_qasymm8);
995}
Giorgio Arena68e29da2021-02-08 16:31:10 +0000996FIXTURE_DATA_TEST_CASE_NEW(RunLarge3x3, NEDepthwiseConvolutionLayerQuantizedSymmetricPerChannelFixture, framework::DatasetMode::NIGHTLY,
997 combine(combine(combine(combine(combine(combine(combine(datasets::LargeOptimizedDepthwiseConvolutionLayerDataset3x3(),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +0100998 make("DepthMultiplier", 1)),
999 make("InputDataType", DataType::QASYMM8)),
1000 make("WeightsDataType", DataType::QSYMM8_PER_CHANNEL)),
Giorgio Arena68e29da2021-02-08 16:31:10 +00001001 input_qinfo_dataset),
Gunes Bayir3af4c9b2023-10-08 17:51:28 +01001002 make("DstQuantizationInfo", { QuantizationInfo(0.5f, 4) })),
1003 make("DataLayout", { DataLayout::NHWC })),
1004 make("ActivationInfo", { ActivationLayerInfo() })))
Giuseppe Rossinif01201a2019-11-06 14:57:49 +00001005{
1006 validate(Accessor(_target), _reference, tolerance_qasymm8);
1007}
1008TEST_SUITE_END() // Optimized
Giorgio Arenad93e2632019-10-15 11:09:33 +01001009TEST_SUITE_END() // QSYMM8_PER_CHANNEL
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +00001010TEST_SUITE_END() // Quantized
Georgios Pinitasf72f9362018-01-12 16:29:45 +00001011
Michalis Spyrouaeebe4a2019-01-09 14:21:03 +00001012TEST_SUITE_END() // DepthwiseConvLayer
Sheri Zhangac6499a2021-02-10 15:32:38 +00001013TEST_SUITE_END() // Neon
Michalis Spyrou7362f0d2017-10-18 17:58:22 +01001014} // namespace validation
1015} // namespace test
1016} // namespace arm_compute