Compute Library
 21.05
Winograd.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2021 Arm Limited.
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
25 #include "arm_compute/core/Types.h"
33 #include "tests/CL/CLAccessor.h"
34 #include "tests/CL/Helper.h"
36 #include "tests/datasets/LargeConvolutionLayerDataset.h"
37 #include "tests/datasets/ShapeDatasets.h"
38 #include "tests/datasets/SmallConvolutionLayerDataset.h"
39 #include "tests/datasets/WinogradInputTransformDataset.h"
40 #include "tests/datasets/WinogradOutputTransformDataset.h"
42 #include "tests/framework/Macros.h"
45 #include "tests/validation/fixtures/WinogradConvolutionLayerFixture.h"
46 
47 namespace arm_compute
48 {
49 namespace test
50 {
51 namespace validation
52 {
53 namespace
54 {
55 // *INDENT-OFF*
56 // clang-format off
57 constexpr AbsoluteTolerance<float> tolerance_f32(0.002f);
58 const AbsoluteTolerance<half> tolerance_f16(half(1.f));
59 constexpr AbsoluteTolerance<float> tolerance_convolution_layer_f32(0.1f);
60 const AbsoluteTolerance<half> tolerance_convolution_layer_f16(half(0.4f));
61 RelativeTolerance<half_float::half> rel_tolerance_f16(half(0.2)); /**< Tolerance value for comparing reference's output against implementation's output for FP16 data types */
62 constexpr float tolerance_num = 0.05f; /**< Tolerance number */
63 constexpr float abs_tolerance_f32_nightly = 0.003f; /**< Absolute Tolerance value */
64 constexpr float abs_tolerance_convolution_layer_f16 = 2.5f; /**< Tolerance number */
65 constexpr float tolerance_num_f16 = 0.15f; /**< Tolerance number */
66 
67 // Input transform
68 const auto SmallWinogradInputTransformDatasetNCHW =
69  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset2x2_3x3(),
70  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset2x1_3x1(),
71  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset1x2_1x3(),
72  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x4_3x3(),
73  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x1_3x1(),
74  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset1x4_1x3(),
75  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x4_5x5(),
76  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x1_5x1(),
77  datasets::SmallWinogradInputTransformDataset1x4_1x5()))))))));
78 
79 const auto SmallWinogradInputTransformDatasetNHWC = framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x4_3x3(),
80  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x1_3x1(),
81  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset1x4_1x3(),
82  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x4_5x5(),
83  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x1_5x1(),
84  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset1x4_1x5(),
85  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset2x1_7x1(),
86  datasets::SmallWinogradInputTransformDataset1x2_1x7())))))));
87 
88 const auto SmallWinogradInputTransformDatasetNHWC_FP32 = framework::dataset::concat(SmallWinogradInputTransformDatasetNHWC,
89  datasets::SmallWinogradInputTransformDataset2x2_7x7());
90 
91 const auto LargeWinogradInputTransformDatasetNCHW =
92  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset2x2_3x3(),
93  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset2x1_3x1(),
94  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset1x2_1x3(),
95  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x4_3x3(),
96  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x1_3x1(),
97  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset1x4_1x3(),
98  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x4_5x5(),
99  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x1_5x1(),
100  datasets::LargeWinogradInputTransformDataset1x4_1x5()))))))));
101 
102 const auto LargeWinogradInputTransformDatasetNHWC =
103  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x4_3x3(),
104  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x4_5x5(),
105  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x1_5x1(),
106  datasets::LargeWinogradInputTransformDataset1x4_1x5())));
107 
108 const auto LargeWinogradInputTransformDatasetNHWC_FP32 =
109  framework::dataset::concat(LargeWinogradInputTransformDatasetNHWC,
110  (datasets::LargeWinogradInputTransformDataset2x2_7x7()));
111 
112 // Filter transform
113 const auto SmallWinogradFilterTransformDatasetNCHW =
114  framework::dataset::concat(combine(datasets::Small3x3Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 2U), Size2D(4U, 4U) })),
115  framework::dataset::concat(combine(datasets::Small3x1Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 1U), Size2D(4U, 1U) })),
116  framework::dataset::concat(combine(datasets::Small1x3Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 2U), Size2D(1U, 4U) })),
117  framework::dataset::concat(combine(datasets::Small5x5Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
118  framework::dataset::concat(combine(datasets::Small5x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
119  combine(datasets::Small1x5Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })))))));
120 
121 const auto SmallWinogradFilterTransformDatasetNHWC_F16 =
122  framework::dataset::concat(combine(datasets::Small3x3Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
123  framework::dataset::concat(combine(datasets::Small3x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
124  framework::dataset::concat(combine(datasets::Small1x3Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })),
125  framework::dataset::concat(combine(datasets::Small5x5Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
126  framework::dataset::concat(combine(datasets::Small5x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
127  framework::dataset::concat(combine(datasets::Small1x5Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })),
128  framework::dataset::concat(combine(datasets::Small1x7Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 2U) })),
129  combine(datasets::Small7x1Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 1U) })))))))));
130 
131 const auto SmallWinogradFilterTransformDatasetNHWC_F32 =
132  framework::dataset::concat(SmallWinogradFilterTransformDatasetNHWC_F16,
133  combine(datasets::Small7x7Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 2U) })));
134 
135 const auto LargeWinogradFilterTransformDatasetNCHW =
136  framework::dataset::concat(combine(datasets::Large3x3Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 2U), Size2D(4U, 4U) })),
137  framework::dataset::concat(combine(datasets::Large3x1Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 1U), Size2D(4U, 1U) })),
138  framework::dataset::concat(combine(datasets::Large1x3Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 2U), Size2D(1U, 4U) })),
139  framework::dataset::concat(combine(datasets::Large5x5Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
140  framework::dataset::concat(combine(datasets::Large5x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
141  combine(datasets::Large1x5Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })))))));
142 
143 const auto LargeWinogradFilterTransformDatasetNHWC_F16 =
144  framework::dataset::concat(combine(datasets::Large3x3Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
145  framework::dataset::concat(combine(datasets::Large3x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
146  framework::dataset::concat(combine(datasets::Large1x3Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })),
147  framework::dataset::concat(combine(datasets::Large5x5Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
148  framework::dataset::concat(combine(datasets::Large5x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
149  framework::dataset::concat(combine(datasets::Large1x5Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })),
150  framework::dataset::concat(combine(datasets::Large7x1Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 1U) })),
151  combine(datasets::Large1x7Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 2U) })))))))));
152 
153 const auto LargeWinogradFilterTransformDatasetNHWC_F32 =
154  framework::dataset::concat(LargeWinogradFilterTransformDatasetNHWC_F16,
155  combine(datasets::Large7x7Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 2U) })));
156 
157 // Output transform
158 const auto SmallWinogradOutputTransformDatasetNCHW = datasets::SmallWinogradOutputTransformDatasetNCHW();
159 
160 const auto SmallWinogradOutputTransformDatasetNHWC_F16 = datasets::SmallWinogradOutputTransformDatasetNHWC_F16();
161 
162 const auto SmallWinogradOutputTransformDatasetNHWC_F32 = datasets::SmallWinogradOutputTransformDatasetNHWC_F32();
163 
164 const auto LargeWinogradOutputTransformDatasetNCHW = datasets::LargeWinogradOutputTransformDatasetNCHW();
165 
166 const auto LargeWinogradOutputTransformDatasetNHWC_F16 = datasets::LargeWinogradOutputTransformDatasetNHWC_F16();
167 
168 const auto LargeWinogradOutputTransformDatasetNHWC_F32 = datasets::LargeWinogradOutputTransformDatasetNHWC_F32();
169 
170 //Activation Functions
171 const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
172 {
173  ActivationLayerInfo(),
178 });
179 const auto ActivationFunctionsSmallDataset = framework::dataset::make("ActivationInfo",
180 {
181  ActivationLayerInfo(),
185 });
186 
187 } // namespace
188 
190 
191 TEST_SUITE(CL)
192 TEST_SUITE(Winograd)
193 
194 TEST_SUITE(InputTransform)
195 
196 DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
197  framework::dataset::make("InputInfo",{
198  TensorInfo(TensorShape(53U, 21U, 5U, 3U), 1, DataType::F16), // F16 not supported
199  TensorInfo(TensorShape(53U, 21U, 5U, 3U), 1, DataType::QASYMM8), // QASYMM8 not supported
200  TensorInfo(TensorShape(53U, 21U, 5U, 3U), 1, DataType::F32), // Kernel size not supported
201  TensorInfo(TensorShape(53U, 21U, 5U, 3U), 1, DataType::F32), // Strides not supported
202  TensorInfo(TensorShape(53U, 33U, 4U), 1, DataType::F32), // Padding needed
203  TensorInfo(TensorShape(34U, 42U, 7U, 3U), 1, DataType::F32), // Padding needed
204  TensorInfo(TensorShape(31U, 37U, 37U), 1, DataType::F32) // Padding needed
205  }),
206  framework::dataset::make("OutputInfo", {
207  TensorInfo(TensorShape(5U, 5U, 16U, 3U), 1, DataType::F16),
208  TensorInfo(TensorShape(5U, 5U, 16U, 3U), 1, DataType::QASYMM8),
209  TensorInfo(TensorShape(5U, 5U, 16U, 3U), 1, DataType::F32),
210  TensorInfo(TensorShape(5U, 1U, 16U, 3U), 1, DataType::F32),
211  TensorInfo(TensorShape(4U, 442U, 16U), 1, DataType::F32),
212  TensorInfo(TensorShape(7U, 320U, 16U, 3U), 1, DataType::F32),
213  TensorInfo(TensorShape(37U, 304U, 16U), 1, DataType::F32)
214  })),
215  framework::dataset::make("WinogradInfo", {
216  WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(53U, 21U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW),
217  WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(53U, 21U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW),
218  WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(53U, 21U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW),
219  WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(53U, 21U), PadStrideInfo(2, 1, 1, 1), DataLayout::NCHW),
220  WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(53U, 33U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW),
221  WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(34U, 42U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW),
222  WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(31U, 37U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW)
223  })),
224  framework::dataset::make("Expected", { false, false, false, false, false, false, false })),
226 {
227  ARM_COMPUTE_EXPECT(bool(CLWinogradInputTransform::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), winograd_info)) == expected, framework::LogLevel::ERRORS);
228 }
229 
230 using CLWinogradInputTransformFixtureFP32 = WinogradInputTransformValidationFixture<CLTensor, CLAccessor, CLWinogradInputTransform, float>;
231 using CLWinogradInputTransformMixedDataLayoutFixtureFP32 = WinogradInputTransformValidationFixture<CLTensor, CLAccessor, CLWinogradInputTransform, float, true>;
232 using CLWinogradInputTransformFixtureFP16 = WinogradInputTransformValidationFixture<CLTensor, CLAccessor, CLWinogradInputTransform, half>;
233 
234 TEST_SUITE(NCHW)
235 TEST_SUITE(FP32)
236 FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradInputTransformFixtureFP32, framework::DatasetMode::PRECOMMIT, combine(combine(SmallWinogradInputTransformDatasetNCHW,
237  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
238  framework::dataset::make("DataType", { DataType::F32 })))
239 {
240  validate(CLAccessor(_target), _reference, tolerance_f32);
241 }
243  datasets::SmallWinogradInputTransformDataset2x2_3x3(),
244  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
245  framework::dataset::make("DataType", { DataType::F32 })))
246 {
247  validate(CLAccessor(_target), _reference, tolerance_f32);
248 }
250  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
251  framework::dataset::make("DataType", { DataType::F32 })))
252 {
253  validate(CLAccessor(_target), _reference, tolerance_f32);
254 }
255 TEST_SUITE_END() // FP32
256 
257 TEST_SUITE(FP16)
258 FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradInputTransformFixtureFP16, framework::DatasetMode::PRECOMMIT, combine(combine(SmallWinogradInputTransformDatasetNCHW,
259  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
260  framework::dataset::make("DataType", { DataType::F16 })))
261 {
262  validate(CLAccessor(_target), _reference, tolerance_f16);
263 }
264 
266  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
267  framework::dataset::make("DataType", { DataType::F16 })))
268 {
269  validate(CLAccessor(_target), _reference, tolerance_f16);
270 }
271 TEST_SUITE_END() // FP16
272 TEST_SUITE_END() // NCHW
273 
274 TEST_SUITE(NHWC)
275 TEST_SUITE(FP16)
276 FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradInputTransformFixtureFP16, framework::DatasetMode::PRECOMMIT, combine(combine(SmallWinogradInputTransformDatasetNHWC,
277  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
278  framework::dataset::make("DataType", { DataType::F16 })))
279 {
280  validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num_f16);
281 }
282 
284  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
285  framework::dataset::make("DataType", { DataType::F16 })))
286 {
287  validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num_f16);
288 }
289 TEST_SUITE_END() // FP16
290 TEST_SUITE(FP32)
291 FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradInputTransformFixtureFP32, framework::DatasetMode::PRECOMMIT, combine(combine(SmallWinogradInputTransformDatasetNHWC_FP32,
292  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
293  framework::dataset::make("DataType", { DataType::F32 })))
294 {
295  validate(CLAccessor(_target), _reference, tolerance_f32);
296 }
298  datasets::SmallWinogradInputTransformDataset4x4_3x3(),
299  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
300  framework::dataset::make("DataType", { DataType::F32 })))
301 {
302  validate(CLAccessor(_target), _reference, tolerance_f32);
303 }
305  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
306  framework::dataset::make("DataType", { DataType::F32 })))
307 {
308  validate(CLAccessor(_target), _reference, tolerance_f32, 0.f, abs_tolerance_f32_nightly);
309 }
310 TEST_SUITE_END() // FP32
311 TEST_SUITE_END() // NHWC
312 TEST_SUITE_END() // InputTransform
313 
314 TEST_SUITE(FilterTransform)
315 DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
316  framework::dataset::make("InputInfo",{
317  TensorInfo(TensorShape(3U, 3U, 5U, 3U), 1, DataType::F16), // F16 supported
318  TensorInfo(TensorShape(3U, 3U, 5U, 3U), 1, DataType::QASYMM8), // QASYMM8 not supported
319  TensorInfo(TensorShape(5U, 5U, 5U, 3U), 1, DataType::F32), // Kernel size not supported
320  TensorInfo(TensorShape(3U, 3U), 1, DataType::F32), // Output tile not supported
321  TensorInfo(TensorShape(3U, 3U, 5U, 3U), 1, DataType::F32), // valid
322  TensorInfo(TensorShape(3U, 3U, 37U, 2U), 1, DataType::F32), // valid
323  TensorInfo(TensorShape(3U, 3U, 37U, 22U), 1, DataType::F32) // valid
324  }),
325  framework::dataset::make("OutputInfo", {
326  TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::F16),
327  TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::QASYMM8),
328  TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::F32),
329  TensorInfo(TensorShape(1U, 1U, 16U), 1, DataType::F32),
330  TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::F32),
331  TensorInfo(TensorShape(2U, 37U, 16U), 1, DataType::F32),
332  TensorInfo(TensorShape(22U, 37U, 36U), 1, DataType::F32)
333  })),
334  framework::dataset::make("WinogradInfo", {
335  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ),
336  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ),
337  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ),
338  WinogradInfo(Size2D(3U, 3U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ),
339  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ),
340  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ),
341  WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ )
342  })),
343  framework::dataset::make("Expected", { true, false, false, false, true, true, true })),
345 {
346  ARM_COMPUTE_EXPECT(bool(CLWinogradFilterTransformKernel::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), winograd_info)) == expected, framework::LogLevel::ERRORS);
347 }
348 
350 using CLWinogradFilterTransformFixtureFP32 = WinogradFilterTransformValidationFixture<CLTensor, CLAccessor, CLWinogradFilterTransform, float>;
351 using CLWinogradFilterTransformMixedDataLayoutFixtureFP32 = WinogradFilterTransformValidationFixture<CLTensor, CLAccessor, CLWinogradFilterTransform, float, true>;
352 using CLWinogradFilterTransformFixtureFP16 = WinogradFilterTransformValidationFixture<CLTensor, CLAccessor, CLWinogradFilterTransform, half>;
353 
354 TEST_SUITE(NCHW)
355 TEST_SUITE(FP32)
357  combine(combine(SmallWinogradFilterTransformDatasetNCHW,
358  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
359  framework::dataset::make("DataType", { DataType::F32 })))
360 {
361  // Validate output
362  validate(CLAccessor(_target), _reference, tolerance_f32);
363 }
365  combine(combine(combine(datasets::Small3x3Shapes(),
366  framework::dataset::make("OutputTile", { Size2D(2U, 2U), Size2D(4U, 4U) })),
367  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
368  framework::dataset::make("DataType", { DataType::F32 })))
369 {
370  // Validate output
371  validate(CLAccessor(_target), _reference, tolerance_f32);
372 }
374  combine(combine(LargeWinogradFilterTransformDatasetNCHW,
375  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
376  framework::dataset::make("DataType", { DataType::F32 })))
377 {
378  // Validate output
379  validate(CLAccessor(_target), _reference, tolerance_f32);
380 }
381 TEST_SUITE_END() // FP32
382 TEST_SUITE(FP16)
384  combine(combine(SmallWinogradFilterTransformDatasetNCHW,
385  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
386  framework::dataset::make("DataType", { DataType::F16 })))
387 {
388  // Validate output
389  validate(CLAccessor(_target), _reference, tolerance_f16);
390 }
391 
393  combine(combine(LargeWinogradFilterTransformDatasetNCHW,
394  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
395  framework::dataset::make("DataType", { DataType::F16 })))
396 {
397  // Validate output
398  validate(CLAccessor(_target), _reference, tolerance_f16);
399 }
400 TEST_SUITE_END() // FP16
401 TEST_SUITE_END() // NCHW
402 
403 TEST_SUITE(NHWC)
404 TEST_SUITE(FP16)
406  combine(combine(SmallWinogradFilterTransformDatasetNHWC_F16,
407  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
408  framework::dataset::make("DataType", { DataType::F16 })))
409 {
410  // Validate output
411  validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num_f16);
412 }
413 
415  combine(combine(LargeWinogradFilterTransformDatasetNHWC_F16,
416  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
417  framework::dataset::make("DataType", { DataType::F16 })))
418 {
419  // Validate output
420  validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num_f16);
421 }
422 TEST_SUITE_END() // FP16
423 TEST_SUITE(FP32)
425  combine(combine(SmallWinogradFilterTransformDatasetNHWC_F32,
426  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
427  framework::dataset::make("DataType", { DataType::F32 })))
428 {
429  // Validate output
430  validate(CLAccessor(_target), _reference, tolerance_f32);
431 }
433  combine(combine(combine(datasets::Small3x3Shapes(),
434  framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
435  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
436  framework::dataset::make("DataType", { DataType::F32 })))
437 {
438  // Validate output
439  validate(CLAccessor(_target), _reference, tolerance_f32);
440 }
442  combine(combine(LargeWinogradFilterTransformDatasetNHWC_F32,
443  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
444  framework::dataset::make("DataType", { DataType::F32 })))
445 {
446  // Validate output
447  validate(CLAccessor(_target), _reference, tolerance_f32);
448 }
449 TEST_SUITE_END() // FP32
450 TEST_SUITE_END() // NHWC
451 TEST_SUITE_END() // FilterTransform
452 
453 TEST_SUITE(OutputTransform)
454 DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
455  framework::dataset::make("InputInfo",{
456  TensorInfo(TensorShape(512U, 49U, 16U, 5U), 1, DataType::F16), // F16 supported
457  TensorInfo(TensorShape(512U, 49U, 16U, 5U), 1, DataType::QASYMM8), // QASYMM8 not supported
458  TensorInfo(TensorShape(512U, 49U, 16U, 5U), 1, DataType::F32), // Kernel size not supported
459  TensorInfo(TensorShape(512U, 49U, 16U, 5U), 1, DataType::F32), // Valid
460  TensorInfo(TensorShape(13U, 108U, 16U, 4U), 1, DataType::F32), // Padding needed
461  TensorInfo(TensorShape(7U, 20U, 16U, 7U), 1, DataType::F32), // Valid
462  TensorInfo(TensorShape(7U, 20U, 16U, 7U), 1, DataType::F32), // Wrong WinogradInfo
463  TensorInfo(TensorShape(7U, 256U, 36U, 3U), 1, DataType::F32), // Valid
464  TensorInfo(TensorShape(7U, 256U, 16U, 3U), 1, DataType::F32) // Wrong number of batches
465  }),
466  framework::dataset::make("BiasInfo", {
467  TensorInfo(TensorShape(512U), 1, DataType::F16),
468  TensorInfo(TensorShape(512U), 1, DataType::QASYMM8),
469  TensorInfo(TensorShape(512U), 1, DataType::F32),
470  TensorInfo(TensorShape(512U), 1, DataType::F32),
471  TensorInfo(TensorShape(13U), 1, DataType::F32),
472  TensorInfo(TensorShape(7U), 1, DataType::F32),
473  TensorInfo(TensorShape(7U), 1, DataType::F32),
474  TensorInfo(TensorShape(7U), 1, DataType::F32),
475  TensorInfo(TensorShape(7U), 1, DataType::F32)
476  })),
477  framework::dataset::make("OutputInfo", {
478  TensorInfo(TensorShape(14U, 14U, 512U, 5U), 1, DataType::F16),
479  TensorInfo(TensorShape(14U, 14U, 512U, 5U), 1, DataType::QASYMM8),
480  TensorInfo(TensorShape(14U, 14U, 512U, 5U), 1, DataType::F32),
481  TensorInfo(TensorShape(14U, 14U, 512U, 5U), 1, DataType::F32),
482  TensorInfo(TensorShape(17U, 23U, 13U, 4U), 1, DataType::F32),
483  TensorInfo(TensorShape(8U, 10U, 7U, 7U), 1, DataType::F32),
484  TensorInfo(TensorShape(7U, 9U, 7U, 7U), 1, DataType::F32),
485  TensorInfo(TensorShape(64U, 64U, 7U, 3U), 1, DataType::F32),
486  TensorInfo(TensorShape(64U, 64U, 7U, 3U), 1, DataType::F32)
487  })),
488  framework::dataset::make("WinogradInfo", {
489  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW),
490  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW),
491  WinogradInfo(Size2D(2U, 2U), Size2D(5U, 5U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW),
492  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW),
493  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(17U, 23U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW),
494  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(8U, 10U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW),
495  WinogradInfo(Size2D(2U, 3U), Size2D(3U, 3U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW),
496  WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(64U, 64U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW),
497  WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(64U, 64U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW)
498  })),
499  framework::dataset::make("Expected", { true, false, false, true, false, true, false, true, false })),
501 {
502  ARM_COMPUTE_EXPECT(bool(CLWinogradOutputTransformKernel::validate(&input_info.clone()->set_is_resizable(false), &bias_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), winograd_info)) == expected, framework::LogLevel::ERRORS);
503 }
504 
506 using CLWinogradOutputTransformFixtureFP32 = WinogradOutputTransformValidationFixture<CLTensor, CLAccessor, CLWinogradOutputTransform, float>;
507 using CLWinogradOutputTransformMixedDataLayoutFixtureFP32 = WinogradOutputTransformValidationFixture<CLTensor, CLAccessor, CLWinogradOutputTransform, float, true>;
508 using CLWinogradOutputTransformFixtureFP16 = WinogradOutputTransformValidationFixture<CLTensor, CLAccessor, CLWinogradOutputTransform, half>;
509 
510 TEST_SUITE(NCHW)
511 TEST_SUITE(FP16)
513  combine(combine(SmallWinogradOutputTransformDatasetNCHW,
514  framework::dataset::make("DataType", { DataType::F16 })),
515  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
516 {
517  // Validate output
518  validate(CLAccessor(_target), _reference, tolerance_f16);
519 }
520 
522  combine(combine(LargeWinogradOutputTransformDatasetNCHW,
523  framework::dataset::make("DataType", { DataType::F16 })),
524  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
525 {
526  // Validate output
527  validate(CLAccessor(_target), _reference, tolerance_f16);
528 }
529 TEST_SUITE_END() // FP16
530 TEST_SUITE(FP32)
532  combine(combine(SmallWinogradOutputTransformDatasetNCHW,
533  framework::dataset::make("DataType", { DataType::F32 })),
534  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
535 {
536  // Validate output
537  validate(CLAccessor(_target), _reference, tolerance_f32);
538 }
541  framework::dataset::make("WinogradInfo", WinogradInfo(Size2D(2U, 2U),Size2D(3U, 3U), Size2D(7U, 6U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW))),
542  framework::dataset::make("DataType", { DataType::F32 })),
543  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
544 {
545  // Validate output
546  validate(CLAccessor(_target), _reference, tolerance_f32);
547 }
549  combine(combine(LargeWinogradOutputTransformDatasetNCHW,
550  framework::dataset::make("DataType", { DataType::F32 })),
551  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
552 {
553  // Validate output
554  validate(CLAccessor(_target), _reference, tolerance_f32);
555 }
556 TEST_SUITE_END() // FP32
557 TEST_SUITE_END() // NCHW
558 
559 TEST_SUITE(NHWC)
560 TEST_SUITE(FP16)
562  combine(combine(SmallWinogradOutputTransformDatasetNHWC_F16,
563  framework::dataset::make("DataType", { DataType::F16 })),
564  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
565 {
566  // Validate output
567  validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num_f16);
568 }
569 
571  combine(combine(LargeWinogradOutputTransformDatasetNHWC_F16,
572  framework::dataset::make("DataType", { DataType::F16 })),
573  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
574 {
575  // Validate output
576  validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num_f16);
577 }
578 TEST_SUITE_END() // FP16
579 TEST_SUITE(FP32)
581  combine(combine(SmallWinogradOutputTransformDatasetNHWC_F32,
582  framework::dataset::make("DataType", { DataType::F32 })),
583  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
584 {
585  // Validate output
586  validate(CLAccessor(_target), _reference, tolerance_f32);
587 }
590  framework::dataset::make("WinogradInfo", WinogradInfo(Size2D(2U, 2U), Size2D(7U, 7U), Size2D(9U, 9U), PadStrideInfo(1, 1, 0, 0), DataLayout::NHWC))),
591  framework::dataset::make("DataType", { DataType::F32 })),
592  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
593 {
594  // Validate output
595  validate(CLAccessor(_target), _reference, tolerance_f32);
596 }
598  combine(combine(LargeWinogradOutputTransformDatasetNHWC_F32,
599  framework::dataset::make("DataType", { DataType::F32 })),
600  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
601 {
602  // Validate output
603  validate(CLAccessor(_target), _reference, tolerance_f32);
604 }
605 TEST_SUITE_END() // FP32
606 TEST_SUITE_END() // NHWC
607 TEST_SUITE_END() // OutputTransform
608 
609 TEST_SUITE(ConvolutionLayer)
610 DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(
611  framework::dataset::make("InputInfo", {
612  TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F16), // Insufficient padding
613  TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F32), // Datatype mismatch
614  TensorInfo(TensorShape(23U, 27U, 5U, 4U), 1, DataType::F32), // Stride y not supported
615  TensorInfo(TensorShape(16U, 16U, 8U), 1, DataType::F32), // Padding needed
616  TensorInfo(TensorShape(33U, 27U, 7U, 4U), 1, DataType::F32) // Kernel size not supported
617  }),
618  framework::dataset::make("WeightsInfo", {
619  TensorInfo(TensorShape(3U, 3U, 2U, 19U), 1, DataType::F16),
620  TensorInfo(TensorShape(3U, 3U, 2U, 19U), 1, DataType::QASYMM8),
621  TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32),
622  TensorInfo(TensorShape(3U, 3U, 8U, 16U), 1, DataType::F32),
623  TensorInfo(TensorShape(5U, 5U, 7U, 16U), 1, DataType::F16)
624  })),
625  framework::dataset::make("BiasesInfo", {
626  TensorInfo(TensorShape(19U), 1, DataType::F16),
627  TensorInfo(TensorShape(19U), 1, DataType::F32),
628  TensorInfo(TensorShape(21U), 1, DataType::F32),
629  TensorInfo(TensorShape(16U), 1, DataType::F32),
630  TensorInfo(TensorShape(16U), 1, DataType::F32)
631  })),
632  framework::dataset::make("OutputInfo", {
633  TensorInfo(TensorShape(17U, 31U, 19U), 1, DataType::F16),
634  TensorInfo(TensorShape(15U, 15U, 19U), 1, DataType::F32),
635  TensorInfo(TensorShape(21U, 25U, 21U, 4U), 1, DataType::F32),
636  TensorInfo(TensorShape(16U, 16U, 16U), 1, DataType::F32),
637  TensorInfo(TensorShape(11U, 12U, 16U, 4U), 1, DataType::F32)
638  })),
639  framework::dataset::make("ConvInfo", {
640  PadStrideInfo(1, 1, 1, 1),
641  PadStrideInfo(1, 1, 1, 1),
642  PadStrideInfo(1, 2, 0, 0),
643  PadStrideInfo(1, 1, 1, 1),
644  PadStrideInfo(1, 1, 1, 0)
645  })),
646  framework::dataset::make("Expected", { false, false, false, false, false })),
648 {
649  ARM_COMPUTE_EXPECT(bool(CLWinogradConvolutionLayer::validate(&input_info.clone()->set_is_resizable(false), &weights_info.clone()->set_is_resizable(false), &bias_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), conv_info)) == expected, framework::LogLevel::ERRORS);
650 }
651 
652 TEST_SUITE(FP32)
653 using CLWinogradConvolutionLayerFastMathFixture = WinogradConvolutionLayerFastMathValidationFixture<CLTensor, CLAccessor, CLWinogradConvolutionLayer, float>;
654 using CLWinogradConvolutionLayerFastMathMixedDataLayoutFixture = WinogradConvolutionLayerFastMathValidationFixture<CLTensor, CLAccessor, CLWinogradConvolutionLayer, float, float, true, true>;
655 TEST_SUITE(Conv3x3)
657  combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x3Dataset(),
658  framework::dataset::make("DataType", { DataType::F32 })),
659  ActivationFunctionsSmallDataset),
661 {
662  // Validate output
663  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
664 }
667  framework::dataset::make("Input", TensorShape(8U, 8U, 32U)),
668  framework::dataset::make("Weight", TensorShape(1U, 3U, 32U, 1U))),
670  framework::dataset::make("Output", TensorShape(8U, 6U, 1U))),
671  framework::dataset::make("PadStrideInfo", PadStrideInfo(1, 1, 0, 0))),
672  framework::dataset::make("Dilation", Size2D(1U, 1U))),
673  framework::dataset::make("DataType", { DataType::F32 })),
674  ActivationFunctionsSmallDataset),
676 {
677  // Validate output
678  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
679 }
681  combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x3Dataset(),
682  framework::dataset::make("DataType", { DataType::F32 })),
683  ActivationFunctionsDataset),
685 {
686  // Validate output
687  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
688 }
689 TEST_SUITE_END() // Conv3x3
690 
691 TEST_SUITE(Conv3x1)
693  combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x1Dataset(),
694  framework::dataset::make("DataType", { DataType::F32 })),
695  ActivationFunctionsSmallDataset),
697 {
698  // Validate output
699  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
700 }
701 
703  combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x1Dataset(),
704  framework::dataset::make("DataType", { DataType::F32 })),
705  ActivationFunctionsDataset),
707 {
708  // Validate output
709  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
710 }
711 TEST_SUITE_END() // Conv3x1
712 
713 TEST_SUITE(Conv1x3)
715  combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x3Dataset(),
716  framework::dataset::make("DataType", { DataType::F32 })),
717  ActivationFunctionsSmallDataset),
719 {
720  // Validate output
721  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
722 }
723 
725  combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x3Dataset(),
726  framework::dataset::make("DataType", { DataType::F32 })),
727  ActivationFunctionsDataset),
729 {
730  // Validate output
731  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
732 }
733 TEST_SUITE_END() // Conv1x3
734 
735 TEST_SUITE(Conv5x5)
737  combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x5Dataset(),
738  framework::dataset::make("DataType", { DataType::F32 })),
739  ActivationFunctionsSmallDataset ),
741 
742 {
743  // Validate output
744  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
745 }
746 
748  combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x5Dataset(),
749  framework::dataset::make("DataType", { DataType::F32 })),
750  ActivationFunctionsDataset ),
752 
753 {
754  // Validate output
755  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
756 }
757 TEST_SUITE_END() // Conv5x5
758 
759 TEST_SUITE(Conv5x1)
761  combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x1Dataset(),
762  framework::dataset::make("DataType", { DataType::F32 })),
763  ActivationFunctionsSmallDataset),
765 
766 {
767  // Validate output
768  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
769 }
770 
772  combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x1Dataset(),
773  framework::dataset::make("DataType", { DataType::F32 })),
774  ActivationFunctionsDataset),
776 
777 {
778  // Validate output
779  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
780 }
781 TEST_SUITE_END() // Conv5x1
782 
783 TEST_SUITE(Conv1x5)
785  combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x5Dataset(),
786  framework::dataset::make("DataType", { DataType::F32 })),
787  ActivationFunctionsSmallDataset),
789 
790 {
791  // Validate output
792  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
793 }
794 
796  combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x5Dataset(),
797  framework::dataset::make("DataType", { DataType::F32 })),
798  ActivationFunctionsDataset),
800 
801 {
802  // Validate output
803  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
804 }
805 TEST_SUITE_END() // Conv1x5
806 TEST_SUITE_END() // FP32
807 
808 
809 TEST_SUITE(FP16)
810 
811 using CLWinogradConvolutionLayerFastMathFixture16 = WinogradConvolutionLayerFastMathValidationFixture<CLTensor, CLAccessor, CLWinogradConvolutionLayer, half, float>;
812 TEST_SUITE(Conv3x3)
814  combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x3Dataset(),
815  framework::dataset::make("DataType", { DataType::F16 })),
816  ActivationFunctionsSmallDataset),
818 {
819  // Validate output
820  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16, tolerance_num_f16);
821 }
822 
824  combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x3Dataset(),
825  framework::dataset::make("DataType", { DataType::F16 })),
826  ActivationFunctionsDataset),
828 {
829  // Validate output
830  validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16);
831 }
832 TEST_SUITE_END() // Conv3x3
833 
834 TEST_SUITE(Conv3x1)
836  combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x1Dataset(),
837  framework::dataset::make("DataType", { DataType::F16 })),
838  ActivationFunctionsSmallDataset),
840 {
841  // Validate output
842  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16, tolerance_num_f16);
843 }
844 
846  combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x1Dataset(),
847  framework::dataset::make("DataType", { DataType::F16 })),
848  ActivationFunctionsDataset),
850 {
851  // Validate output
852  validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16);
853 }
854 TEST_SUITE_END() // Conv3x1
855 
856 TEST_SUITE(Conv1x3)
858  combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x3Dataset(),
859  framework::dataset::make("DataType", { DataType::F16 })),
860  ActivationFunctionsSmallDataset),
862 {
863  // Validate output
864  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16, tolerance_num_f16);
865 }
866 
868  combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x3Dataset(),
869  framework::dataset::make("DataType", { DataType::F16 })),
870  ActivationFunctionsDataset),
872 {
873  // Validate output
874  validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16);
875 }
876 TEST_SUITE_END() // Conv1x3
877 
878 TEST_SUITE(Conv5x5)
880  combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x5Dataset(),
881  framework::dataset::make("DataType", { DataType::F16 })),
882  ActivationFunctionsSmallDataset),
884 
885 {
886  // Validate output
887  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16, tolerance_num_f16);
888 }
889 
891  combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x5Dataset(),
892  framework::dataset::make("DataType", { DataType::F16 })),
893  ActivationFunctionsDataset),
895 
896 {
897  // Validate output
898  validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16);
899 }
900 TEST_SUITE_END() // Conv5x5
901 
902 TEST_SUITE(Conv5x1)
904  combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x1Dataset(),
905  framework::dataset::make("DataType", { DataType::F16 })),
906  ActivationFunctionsSmallDataset),
908 
909 {
910  // Validate output
911  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16, tolerance_num_f16);
912 }
913 
915  combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x1Dataset(),
916  framework::dataset::make("DataType", { DataType::F16 })),
917  ActivationFunctionsDataset),
919 
920 {
921  // Validate output
922  validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16);
923 }
924 TEST_SUITE_END() // Conv5x1
925 
926 TEST_SUITE(Conv1x5)
928  combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x5Dataset(),
929  framework::dataset::make("DataType", { DataType::F16 })),
930  ActivationFunctionsSmallDataset),
932 
933 {
934  // Validate output
935  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16, tolerance_num_f16);
936 }
937 
939  combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x5Dataset(),
940  framework::dataset::make("DataType", { DataType::F16 })),
941  ActivationFunctionsDataset),
943 
944 {
945  // Validate output
946  validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16);
947 }
948 TEST_SUITE_END() // Conv1x5
949 
950 TEST_SUITE(Conv1x7)
952  combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x7Dataset(),
953  framework::dataset::make("DataType", { DataType::F16 })),
954  ActivationFunctionsSmallDataset),
955  framework::dataset::make("DataLayout", { DataLayout::NHWC })))
956 
957 {
958  // Validate output
959  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16, tolerance_num_f16);
960 }
961 
963  combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x7Dataset(),
964  framework::dataset::make("DataType", { DataType::F16 })),
965  ActivationFunctionsDataset),
966  framework::dataset::make("DataLayout", { DataLayout::NHWC })))
967 
968 {
969  // Validate output
970  validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16);
971 }
972 TEST_SUITE_END() // Conv1x7
973 
974 TEST_SUITE_END() // FP16
975 
976 TEST_SUITE_END() // ConvolutionLayer
977 TEST_SUITE_END() // Winograd
978 TEST_SUITE_END() // CL
979 } // namespace validation
980 } // namespace test
981 } // namespace arm_compute
WinogradFilterTransformValidationFixture< CLTensor, CLAccessor, CLWinogradFilterTransform, float > CLWinogradFilterTransformFixtureFP32
Definition: Winograd.cpp:350
Shape of a tensor.
Definition: TensorShape.h:39
WinogradConvolutionLayerFastMathValidationFixture< CLTensor, CLAccessor, CLWinogradConvolutionLayer, float, float, true, true > CLWinogradConvolutionLayerFastMathMixedDataLayoutFixture
Definition: Winograd.cpp:654
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const WinogradInfo &winograd_info)
Static function to check if given info will lead to a valid configuration of CLWinogradFilterTransfor...
RelativeTolerance< float > tolerance_f32(0.001f)
F32 Tolerance value for comparing reference's output against implementation's output for floating poi...
static Status validate(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, const WinogradInfo &winograd_info, const ActivationLayerInfo &act_info=ActivationLayerInfo())
Static function to check if given info will lead to a valid configuration of CLWinogradOutputTransfor...
constexpr float tolerance_num_f16
F16 Tolerance number.
Definition: cl_gemm.cpp:76
Winograd information.
Definition: Types.h:2117
half_float::half half
16-bit floating point type
Definition: Types.h:46
1 channel, 1 F32 per channel
ARM_COMPUTE_EXPECT(has_error==expected, framework::LogLevel::ERRORS)
WinogradConvolutionLayerFastMathValidationFixture< CLTensor, CLAccessor, CLWinogradConvolutionLayer, float > CLWinogradConvolutionLayerFastMathFixture
Definition: Winograd.cpp:653
As above but this also setups a Zero border on the input tensor of the specified bordersize.
Definition: Helper.h:83
std::enable_if< is_container< T >::value, ContainerDataset< T > >::type make(std::string name, T &&values)
Helper function to create a ContainerDataset.
Activation Layer Information class.
Definition: Types.h:1478
Copyright (c) 2017-2021 Arm Limited.
1 channel, 1 F16 per channel
WinogradInputTransformValidationFixture< CLTensor, CLAccessor, CLWinogradInputTransform, float > CLWinogradInputTransformFixtureFP32
Definition: Winograd.cpp:230
WinogradFilterTransformValidationFixture< CLTensor, CLAccessor, CLWinogradFilterTransform, half > CLWinogradFilterTransformFixtureFP16
Definition: Winograd.cpp:352
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8), TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8), TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16), }), framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F16), TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8), TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8), TensorInfo(TensorShape(30U, 11U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16, QuantizationInfo(1.f/32768.f, 0)), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16, QuantizationInfo(1.f/32768.f, 0)), TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QSYMM16, QuantizationInfo(1.f/32768.f, 0)), })), framework::dataset::make("ActivationInfo", { ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::TANH), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::TANH), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LOGISTIC), ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::SQRT), })), framework::dataset::make("Expected", { false, true, true, true, false, false, true, true, false })), input_info, output_info, act_info, expected)
WinogradOutputTransformValidationFixture< CLTensor, CLAccessor, CLWinogradOutputTransform, float > CLWinogradOutputTransformFixtureFP32
Definition: Winograd.cpp:506
DatasetMode
Possible dataset modes.
Definition: DatasetModes.h:40
TEST_SUITE_END() FIXTURE_DATA_TEST_CASE(RunSmall
[CLActivationLayer Test snippet]
WinogradOutputTransformValidationFixture< CLTensor, CLAccessor, CLWinogradOutputTransform, half > CLWinogradOutputTransformFixtureFP16
Definition: Winograd.cpp:508
quantized, asymmetric fixed-point 8-bit number unsigned
Accessor implementation for CLTensor objects.
Definition: CLAccessor.h:36
TEST_SUITE(U8_to_S8) FIXTURE_DATA_TEST_CASE(RunSmall
Padding and stride information class.
Definition: Types.h:650
WinogradFilterTransformValidationFixture< CLTensor, CLAccessor, CLWinogradFilterTransform, float, true > CLWinogradFilterTransformMixedDataLayoutFixtureFP32
Definition: Winograd.cpp:351
validate(CLAccessor(output_state), expected_output)
static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const PadStrideInfo &conv_info, const ActivationLayerInfo &act_info=ActivationLayerInfo(), bool enable_fast_math=false)
Static function to check if given info will lead to a valid configuration of CLWinogradConvolutionLay...
WinogradOutputTransformValidationFixture< CLTensor, CLAccessor, CLWinogradOutputTransform, float, true > CLWinogradOutputTransformMixedDataLayoutFixtureFP32
Definition: Winograd.cpp:507
Num samples, channels, height, width.
FIXTURE_DATA_TEST_CASE(RunSmall, CLAbsLayerFixture< half >, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F16)))
Definition: AbsLayer.cpp:50
Class for specifying the size of an image or rectangle.
Definition: Size2D.h:34
Num samples, height, width, channels.
WinogradInputTransformValidationFixture< CLTensor, CLAccessor, CLWinogradInputTransform, half > CLWinogradInputTransformFixtureFP16
Definition: Winograd.cpp:232
Store the tensor's metadata.
Definition: TensorInfo.h:43
JoinDataset< T, U > concat(T &&dataset1, U &&dataset2)
Helper function to create a JoinDataset.
Definition: JoinDataset.h:160
RelativeTolerance< half_float::half > tolerance_f16(half(0.2))
F16 Tolerance value for comparing reference's output against implementation's output for floating poi...
Basic function to execute Winograd-based convolution on OpenCL.
zip(zip(framework::dataset::make("Weights", { TensorInfo(TensorShape(32U, 13U, 2U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U, 2U), 1, DataType::F32), TensorInfo(TensorShape(32U, 13U, 2U, 1U), 1, DataType::F32), }), framework::dataset::make("MVBGInfo",{ TensorInfo(TensorShape(2U), 1, DataType::F32), TensorInfo(TensorShape(2U), 1, DataType::F16), TensorInfo(TensorShape(5U), 1, DataType::F32), })), framework::dataset::make("Expected", { true, false, false}))
DataType
Available data types.
Definition: Types.h:77
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const WinogradInfo &winograd_info)
Static function to check if given info will lead to a valid configuration of CLWinogradInputTransform...
WinogradInputTransformValidationFixture< CLTensor, CLAccessor, CLWinogradInputTransform, float, true > CLWinogradInputTransformMixedDataLayoutFixtureFP32
Definition: Winograd.cpp:231
DataLayout
[DataLayout enum definition]
Definition: Types.h:114
combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F32)))
Definition: AbsLayer.cpp:65
Basic implementation of the OpenCL tensor interface.
Definition: CLTensor.h:41