Compute Library
 20.02.1
Winograd.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2019 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  */
27 #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(0.5f));
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_convolution_layer_f16 = 2.5f; /**< Tolerance number */
64 constexpr float tolerance_num_f16 = 0.15f; /**< Tolerance number */
65 
66 // Input transform
67 const auto SmallWinogradInputTransformDatasetNCHW =
68  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset2x2_3x3(),
69  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset2x1_3x1(),
70  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset1x2_1x3(),
71  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x4_3x3(),
72  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x1_3x1(),
73  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset1x4_1x3(),
74  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x4_5x5(),
75  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x1_5x1(),
76  datasets::SmallWinogradInputTransformDataset1x4_1x5()))))))));
77 
78 const auto SmallWinogradInputTransformDatasetNHWC = framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x4_3x3(),
79  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x1_3x1(),
80  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset1x4_1x3(),
81  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x4_5x5(),
82  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset4x1_5x1(),
83  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset1x4_1x5(),
84  framework::dataset::concat(datasets::SmallWinogradInputTransformDataset2x1_7x1(),
85  datasets::SmallWinogradInputTransformDataset1x2_1x7())))))));
86 
87 const auto SmallWinogradInputTransformDatasetNHWC_FP32 = framework::dataset::concat(SmallWinogradInputTransformDatasetNHWC,
88  datasets::SmallWinogradInputTransformDataset2x2_7x7());
89 
90 const auto LargeWinogradInputTransformDatasetNCHW =
91  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset2x2_3x3(),
92  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset2x1_3x1(),
93  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset1x2_1x3(),
94  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x4_3x3(),
95  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x1_3x1(),
96  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset1x4_1x3(),
97  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x4_5x5(),
98  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x1_5x1(),
99  datasets::LargeWinogradInputTransformDataset1x4_1x5()))))))));
100 
101 const auto LargeWinogradInputTransformDatasetNHWC =
102  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x4_3x3(),
103  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x4_5x5(),
104  framework::dataset::concat(datasets::LargeWinogradInputTransformDataset4x1_5x1(),
105  datasets::LargeWinogradInputTransformDataset1x4_1x5())));
106 
107 const auto LargeWinogradInputTransformDatasetNHWC_FP32 =
108  framework::dataset::concat(LargeWinogradInputTransformDatasetNHWC,
109  (datasets::LargeWinogradInputTransformDataset2x2_7x7()));
110 
111 // Filter transform
112 const auto SmallWinogradFilterTransformDatasetNCHW =
113  framework::dataset::concat(combine(datasets::Small3x3Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 2U), Size2D(4U, 4U) })),
114  framework::dataset::concat(combine(datasets::Small3x1Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 1U), Size2D(4U, 1U) })),
115  framework::dataset::concat(combine(datasets::Small1x3Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 2U), Size2D(1U, 4U) })),
116  framework::dataset::concat(combine(datasets::Small5x5Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
117  framework::dataset::concat(combine(datasets::Small5x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
118  combine(datasets::Small1x5Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })))))));
119 
120 const auto SmallWinogradFilterTransformDatasetNHWC_F16 =
121  framework::dataset::concat(combine(datasets::Small3x3Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
122  framework::dataset::concat(combine(datasets::Small3x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
123  framework::dataset::concat(combine(datasets::Small1x3Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })),
124  framework::dataset::concat(combine(datasets::Small5x5Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
125  framework::dataset::concat(combine(datasets::Small5x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
126  framework::dataset::concat(combine(datasets::Small1x5Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })),
127  framework::dataset::concat(combine(datasets::Small1x7Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 2U) })),
128  combine(datasets::Small7x1Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 1U) })))))))));
129 
130 const auto SmallWinogradFilterTransformDatasetNHWC_F32 =
131  framework::dataset::concat(SmallWinogradFilterTransformDatasetNHWC_F16,
132  combine(datasets::Small7x7Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 2U) })));
133 
134 const auto LargeWinogradFilterTransformDatasetNCHW =
135  framework::dataset::concat(combine(datasets::Large3x3Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 2U), Size2D(4U, 4U) })),
136  framework::dataset::concat(combine(datasets::Large3x1Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 1U), Size2D(4U, 1U) })),
137  framework::dataset::concat(combine(datasets::Large1x3Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 2U), Size2D(1U, 4U) })),
138  framework::dataset::concat(combine(datasets::Large5x5Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
139  framework::dataset::concat(combine(datasets::Large5x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
140  combine(datasets::Large1x5Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })))))));
141 
142 const auto LargeWinogradFilterTransformDatasetNHWC_F16 =
143  framework::dataset::concat(combine(datasets::Large3x3Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
144  framework::dataset::concat(combine(datasets::Large3x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
145  framework::dataset::concat(combine(datasets::Large1x3Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })),
146  framework::dataset::concat(combine(datasets::Large5x5Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 4U) })),
147  framework::dataset::concat(combine(datasets::Large5x1Shapes(), framework::dataset::make("OutputTile", { Size2D(4U, 1U) })),
148  framework::dataset::concat(combine(datasets::Large1x5Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 4U) })),
149  framework::dataset::concat(combine(datasets::Large7x1Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 1U) })),
150  combine(datasets::Large1x7Shapes(), framework::dataset::make("OutputTile", { Size2D(1U, 2U) })))))))));
151 
152 const auto LargeWinogradFilterTransformDatasetNHWC_F32 =
153  framework::dataset::concat(LargeWinogradFilterTransformDatasetNHWC_F16,
154  combine(datasets::Large7x7Shapes(), framework::dataset::make("OutputTile", { Size2D(2U, 2U) })));
155 
156 // Output transform
157 const auto SmallWinogradOutputTransformDatasetNCHW = datasets::SmallWinogradOutputTransformDatasetNCHW();
158 
159 const auto SmallWinogradOutputTransformDatasetNHWC_F16 = datasets::SmallWinogradOutputTransformDatasetNHWC_F16();
160 
161 const auto SmallWinogradOutputTransformDatasetNHWC_F32 = datasets::SmallWinogradOutputTransformDatasetNHWC_F32();
162 
163 const auto LargeWinogradOutputTransformDatasetNCHW = datasets::LargeWinogradOutputTransformDatasetNCHW();
164 
165 const auto LargeWinogradOutputTransformDatasetNHWC_F16 = datasets::LargeWinogradOutputTransformDatasetNHWC_F16();
166 
167 const auto LargeWinogradOutputTransformDatasetNHWC_F32 = datasets::LargeWinogradOutputTransformDatasetNHWC_F32();
168 
169 //Activation Functions
170 const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
171 {
172  ActivationLayerInfo(),
177 });
178 const auto ActivationFunctionsSmallDataset = framework::dataset::make("ActivationInfo",
179 {
180  ActivationLayerInfo(),
184 });
185 } // namespace
186 
188 
189 TEST_SUITE(CL)
190 TEST_SUITE(Winograd)
191 
192 TEST_SUITE(InputTransform)
193 DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
194  framework::dataset::make("InputInfo",{
195  TensorInfo(TensorShape(53U, 21U, 5U, 3U), 1, DataType::F16), // F16 not supported
196  TensorInfo(TensorShape(53U, 21U, 5U, 3U), 1, DataType::QASYMM8), // QASYMM8 not supported
197  TensorInfo(TensorShape(53U, 21U, 5U, 3U), 1, DataType::F32), // Kernel size not supported
198  TensorInfo(TensorShape(53U, 21U, 5U, 3U), 1, DataType::F32), // Strides not supported
199  TensorInfo(TensorShape(53U, 33U, 4U), 1, DataType::F32), // Padding needed
200  TensorInfo(TensorShape(34U, 42U, 7U, 3U), 1, DataType::F32), // Padding needed
201  TensorInfo(TensorShape(31U, 37U, 37U), 1, DataType::F32) // Padding needed
202  }),
203  framework::dataset::make("OutputInfo", {
204  TensorInfo(TensorShape(5U, 5U, 16U, 3U), 1, DataType::F16),
205  TensorInfo(TensorShape(5U, 5U, 16U, 3U), 1, DataType::QASYMM8),
206  TensorInfo(TensorShape(5U, 5U, 16U, 3U), 1, DataType::F32),
207  TensorInfo(TensorShape(5U, 1U, 16U, 3U), 1, DataType::F32),
208  TensorInfo(TensorShape(4U, 442U, 16U), 1, DataType::F32),
209  TensorInfo(TensorShape(7U, 320U, 16U, 3U), 1, DataType::F32),
210  TensorInfo(TensorShape(37U, 304U, 16U), 1, DataType::F32)
211  })),
212  framework::dataset::make("WinogradInfo", {
213  WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(53U, 21U), PadStrideInfo(1, 1, 1, 0), DataLayout::NCHW),
214  WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(53U, 21U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW),
215  WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(53U, 21U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW),
216  WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(53U, 21U), PadStrideInfo(2, 1, 1, 1), DataLayout::NCHW),
217  WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(53U, 33U), PadStrideInfo(1, 1, 0, 1), DataLayout::NCHW),
218  WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(34U, 42U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW),
219  WinogradInfo(Size2D(2, 2), Size2D(3, 3), Size2D(31U, 37U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW)
220  })),
221  framework::dataset::make("Expected", { false, false, false, false, false, false, false })),
223 {
224  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);
225 }
226 
227 using CLWinogradInputTransformFixtureFP32 = WinogradInputTransformValidationFixture<CLTensor, CLAccessor, CLWinogradInputTransform, float>;
228 using CLWinogradInputTransformFixtureFP16 = WinogradInputTransformValidationFixture<CLTensor, CLAccessor, CLWinogradInputTransform, half>;
229 
230 TEST_SUITE(NCHW)
231 TEST_SUITE(FP32)
232 FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradInputTransformFixtureFP32, framework::DatasetMode::PRECOMMIT, combine(combine(SmallWinogradInputTransformDatasetNCHW,
233  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
234  framework::dataset::make("DataType", { DataType::F32 })))
235 {
236  validate(CLAccessor(_target), _reference, tolerance_f32);
237 }
238 
240  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
241  framework::dataset::make("DataType", { DataType::F32 })))
242 {
243  validate(CLAccessor(_target), _reference, tolerance_f32);
244 }
245 TEST_SUITE_END() // FP32
246 
247 TEST_SUITE(FP16)
248 FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradInputTransformFixtureFP16, framework::DatasetMode::PRECOMMIT, combine(combine(SmallWinogradInputTransformDatasetNCHW,
249  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
250  framework::dataset::make("DataType", { DataType::F16 })))
251 {
252  validate(CLAccessor(_target), _reference, tolerance_f16);
253 }
254 
256  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
257  framework::dataset::make("DataType", { DataType::F16 })))
258 {
259  validate(CLAccessor(_target), _reference, tolerance_f16);
260 }
261 TEST_SUITE_END() // FP16
262 TEST_SUITE_END() // NCHW
263 
264 TEST_SUITE(NHWC)
265 TEST_SUITE(FP16)
266 FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradInputTransformFixtureFP16, framework::DatasetMode::PRECOMMIT, combine(combine(SmallWinogradInputTransformDatasetNHWC,
267  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
268  framework::dataset::make("DataType", { DataType::F16 })))
269 {
270  validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num_f16);
271 }
272 
274  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
275  framework::dataset::make("DataType", { DataType::F16 })))
276 {
277  validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num_f16);
278 }
279 TEST_SUITE_END() // FP16
280 TEST_SUITE(FP32)
281 FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradInputTransformFixtureFP32, framework::DatasetMode::PRECOMMIT, combine(combine(SmallWinogradInputTransformDatasetNHWC_FP32,
282  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
283  framework::dataset::make("DataType", { DataType::F32 })))
284 {
285  validate(CLAccessor(_target), _reference, tolerance_f32);
286 }
287 
289  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
290  framework::dataset::make("DataType", { DataType::F32 })))
291 {
292  validate(CLAccessor(_target), _reference, tolerance_f32);
293 }
294 TEST_SUITE_END() // FP32
295 TEST_SUITE_END() // NHWC
296 TEST_SUITE_END() // InputTransform
297 
298 TEST_SUITE(FilterTransform)
299 DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
300  framework::dataset::make("InputInfo",{
301  TensorInfo(TensorShape(3U, 3U, 5U, 3U), 1, DataType::F16), // F16 supported
302  TensorInfo(TensorShape(3U, 3U, 5U, 3U), 1, DataType::QASYMM8), // QASYMM8 not supported
303  TensorInfo(TensorShape(5U, 5U, 5U, 3U), 1, DataType::F32), // Kernel size not supported
304  TensorInfo(TensorShape(3U, 3U), 1, DataType::F32), // Output tile not supported
305  TensorInfo(TensorShape(3U, 3U, 5U, 3U), 1, DataType::F32), // valid
306  TensorInfo(TensorShape(3U, 3U, 37U, 2U), 1, DataType::F32), // valid
307  TensorInfo(TensorShape(3U, 3U, 37U, 22U), 1, DataType::F32) // valid
308  }),
309  framework::dataset::make("OutputInfo", {
310  TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::F16),
311  TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::QASYMM8),
312  TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::F32),
313  TensorInfo(TensorShape(1U, 1U, 16U), 1, DataType::F32),
314  TensorInfo(TensorShape(3U, 5U, 16U), 1, DataType::F32),
315  TensorInfo(TensorShape(2U, 37U, 16U), 1, DataType::F32),
316  TensorInfo(TensorShape(22U, 37U, 36U), 1, DataType::F32)
317  })),
318  framework::dataset::make("WinogradInfo", {
319  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ),
320  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ),
321  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ),
322  WinogradInfo(Size2D(3U, 3U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ),
323  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ),
324  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ ),
325  WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D() /* Not needed */, PadStrideInfo() /* Not needed */, DataLayout::NCHW /* Not needed */ )
326  })),
327  framework::dataset::make("Expected", { true, false, false, false, true, true, true })),
329 {
330  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);
331 }
332 
334 using CLWinogradFilterTransformFixtureFP32 = WinogradFilterTransformValidationFixture<CLTensor, CLAccessor, CLWinogradFilterTransform, float>;
335 using CLWinogradFilterTransformFixtureFP16 = WinogradFilterTransformValidationFixture<CLTensor, CLAccessor, CLWinogradFilterTransform, half>;
336 
337 TEST_SUITE(NCHW)
338 TEST_SUITE(FP32)
340  combine(combine(SmallWinogradFilterTransformDatasetNCHW,
341  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
342  framework::dataset::make("DataType", { DataType::F32 })))
343 {
344  // Validate output
345  validate(CLAccessor(_target), _reference, tolerance_f32);
346 }
347 
349  combine(combine(LargeWinogradFilterTransformDatasetNCHW,
350  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
351  framework::dataset::make("DataType", { DataType::F32 })))
352 {
353  // Validate output
354  validate(CLAccessor(_target), _reference, tolerance_f32);
355 }
356 TEST_SUITE_END() // FP32
357 TEST_SUITE(FP16)
359  combine(combine(SmallWinogradFilterTransformDatasetNCHW,
360  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
361  framework::dataset::make("DataType", { DataType::F16 })))
362 {
363  // Validate output
364  validate(CLAccessor(_target), _reference, tolerance_f16);
365 }
366 
368  combine(combine(LargeWinogradFilterTransformDatasetNCHW,
369  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
370  framework::dataset::make("DataType", { DataType::F16 })))
371 {
372  // Validate output
373  validate(CLAccessor(_target), _reference, tolerance_f16);
374 }
375 TEST_SUITE_END() // FP16
376 TEST_SUITE_END() // NCHW
377 
378 TEST_SUITE(NHWC)
379 TEST_SUITE(FP16)
381  combine(combine(SmallWinogradFilterTransformDatasetNHWC_F16,
382  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
383  framework::dataset::make("DataType", { DataType::F16 })))
384 {
385  // Validate output
386  validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num_f16);
387 }
388 
390  combine(combine(LargeWinogradFilterTransformDatasetNHWC_F16,
391  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
392  framework::dataset::make("DataType", { DataType::F16 })))
393 {
394  // Validate output
395  validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num_f16);
396 }
397 TEST_SUITE_END() // FP16
398 TEST_SUITE(FP32)
400  combine(combine(SmallWinogradFilterTransformDatasetNHWC_F32,
401  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
402  framework::dataset::make("DataType", { DataType::F32 })))
403 {
404  // Validate output
405  validate(CLAccessor(_target), _reference, tolerance_f32);
406 }
407 
409  combine(combine(LargeWinogradFilterTransformDatasetNHWC_F32,
410  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
411  framework::dataset::make("DataType", { DataType::F32 })))
412 {
413  // Validate output
414  validate(CLAccessor(_target), _reference, tolerance_f32);
415 }
416 TEST_SUITE_END() // FP32
417 TEST_SUITE_END() // NHWC
418 TEST_SUITE_END() // FilterTransform
419 
420 TEST_SUITE(OutputTransform)
421 DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
422  framework::dataset::make("InputInfo",{
423  TensorInfo(TensorShape(512U, 49U, 16U, 5U), 1, DataType::F16), // F16 supported
424  TensorInfo(TensorShape(512U, 49U, 16U, 5U), 1, DataType::QASYMM8), // QASYMM8 not supported
425  TensorInfo(TensorShape(512U, 49U, 16U, 5U), 1, DataType::F32), // Kernel size not supported
426  TensorInfo(TensorShape(512U, 49U, 16U, 5U), 1, DataType::F32), // Valid
427  TensorInfo(TensorShape(13U, 108U, 16U, 4U), 1, DataType::F32), // Padding needed
428  TensorInfo(TensorShape(7U, 20U, 16U, 7U), 1, DataType::F32), // Valid
429  TensorInfo(TensorShape(7U, 20U, 16U, 7U), 1, DataType::F32), // Wrong WinogradInfo
430  TensorInfo(TensorShape(7U, 256U, 36U, 3U), 1, DataType::F32), // Valid
431  TensorInfo(TensorShape(7U, 256U, 16U, 3U), 1, DataType::F32) // Wrong number of batches
432  }),
433  framework::dataset::make("BiasInfo", {
434  TensorInfo(TensorShape(512U), 1, DataType::F16),
435  TensorInfo(TensorShape(512U), 1, DataType::QASYMM8),
436  TensorInfo(TensorShape(512U), 1, DataType::F32),
437  TensorInfo(TensorShape(512U), 1, DataType::F32),
438  TensorInfo(TensorShape(13U), 1, DataType::F32),
439  TensorInfo(TensorShape(7U), 1, DataType::F32),
440  TensorInfo(TensorShape(7U), 1, DataType::F32),
441  TensorInfo(TensorShape(7U), 1, DataType::F32),
442  TensorInfo(TensorShape(7U), 1, DataType::F32)
443  })),
444  framework::dataset::make("OutputInfo", {
445  TensorInfo(TensorShape(14U, 14U, 512U, 5U), 1, DataType::F16),
446  TensorInfo(TensorShape(14U, 14U, 512U, 5U), 1, DataType::QASYMM8),
447  TensorInfo(TensorShape(14U, 14U, 512U, 5U), 1, DataType::F32),
448  TensorInfo(TensorShape(14U, 14U, 512U, 5U), 1, DataType::F32),
449  TensorInfo(TensorShape(17U, 23U, 13U, 4U), 1, DataType::F32),
450  TensorInfo(TensorShape(8U, 10U, 7U, 7U), 1, DataType::F32),
451  TensorInfo(TensorShape(7U, 9U, 7U, 7U), 1, DataType::F32),
452  TensorInfo(TensorShape(64U, 64U, 7U, 3U), 1, DataType::F32),
453  TensorInfo(TensorShape(64U, 64U, 7U, 3U), 1, DataType::F32)
454  })),
455  framework::dataset::make("WinogradInfo", {
456  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW),
457  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW),
458  WinogradInfo(Size2D(2U, 2U), Size2D(5U, 5U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW),
459  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(14U, 14U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW),
460  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(17U, 23U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW),
461  WinogradInfo(Size2D(2U, 2U), Size2D(3U, 3U), Size2D(8U, 10U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW),
462  WinogradInfo(Size2D(2U, 3U), Size2D(3U, 3U), Size2D(8U, 10U), PadStrideInfo(1, 1, 0, 0), DataLayout::NCHW),
463  WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(64U, 64U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW),
464  WinogradInfo(Size2D(4U, 4U), Size2D(3U, 3U), Size2D(64U, 64U), PadStrideInfo(1, 1, 1, 1), DataLayout::NCHW)
465  })),
466  framework::dataset::make("Expected", { true, false, false, true, false, true, false, true, false })),
468 {
469  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);
470 }
471 
473 using CLWinogradOutputTransformFixtureFP32 = WinogradOutputTransformValidationFixture<CLTensor, CLAccessor, CLWinogradOutputTransform, float>;
474 using CLWinogradOutputTransformFixtureFP16 = WinogradOutputTransformValidationFixture<CLTensor, CLAccessor, CLWinogradOutputTransform, half>;
475 
476 TEST_SUITE(NCHW)
477 TEST_SUITE(FP16)
479  combine(combine(SmallWinogradOutputTransformDatasetNCHW,
480  framework::dataset::make("DataType", { DataType::F16 })),
481  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
482 {
483  // Validate output
484  validate(CLAccessor(_target), _reference, tolerance_f16);
485 }
486 
488  combine(combine(LargeWinogradOutputTransformDatasetNCHW,
489  framework::dataset::make("DataType", { DataType::F16 })),
490  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
491 {
492  // Validate output
493  validate(CLAccessor(_target), _reference, tolerance_f16);
494 }
495 TEST_SUITE_END() // FP16
496 TEST_SUITE(FP32)
498  combine(combine(SmallWinogradOutputTransformDatasetNCHW,
499  framework::dataset::make("DataType", { DataType::F32 })),
500  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
501 {
502  // Validate output
503  validate(CLAccessor(_target), _reference, tolerance_f32);
504 }
505 
507  combine(combine(LargeWinogradOutputTransformDatasetNCHW,
508  framework::dataset::make("DataType", { DataType::F32 })),
509  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
510 {
511  // Validate output
512  validate(CLAccessor(_target), _reference, tolerance_f32);
513 }
514 TEST_SUITE_END() // FP32
515 TEST_SUITE_END() // NCHW
516 
517 TEST_SUITE(NHWC)
518 TEST_SUITE(FP16)
520  combine(combine(SmallWinogradOutputTransformDatasetNHWC_F16,
521  framework::dataset::make("DataType", { DataType::F16 })),
522  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
523 {
524  // Validate output
525  validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num_f16);
526 }
527 
529  combine(combine(LargeWinogradOutputTransformDatasetNHWC_F16,
530  framework::dataset::make("DataType", { DataType::F16 })),
531  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
532 {
533  // Validate output
534  validate(CLAccessor(_target), _reference, tolerance_f16, tolerance_num_f16);
535 }
536 TEST_SUITE_END() // FP16
537 TEST_SUITE(FP32)
539  combine(combine(SmallWinogradOutputTransformDatasetNHWC_F32,
540  framework::dataset::make("DataType", { DataType::F32 })),
541  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
542 {
543  // Validate output
544  validate(CLAccessor(_target), _reference, tolerance_f32);
545 }
546 
548  combine(combine(LargeWinogradOutputTransformDatasetNHWC_F32,
549  framework::dataset::make("DataType", { DataType::F32 })),
550  framework::dataset::make("ActivationInfo",{ ActivationLayerInfo() }) ))
551 {
552  // Validate output
553  validate(CLAccessor(_target), _reference, tolerance_f32);
554 }
555 TEST_SUITE_END() // FP32
556 TEST_SUITE_END() // NHWC
557 TEST_SUITE_END() // OutputTransform
558 
559 TEST_SUITE(ConvolutionLayer)
560 DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(
561  framework::dataset::make("InputInfo", {
562  TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F16), // Insufficient padding
563  TensorInfo(TensorShape(17U, 31U, 2U), 1, DataType::F32), // Datatype mismatch
564  TensorInfo(TensorShape(23U, 27U, 5U, 4U), 1, DataType::F32), // Stride y not supported
565  TensorInfo(TensorShape(16U, 16U, 8U), 1, DataType::F32), // Padding needed
566  TensorInfo(TensorShape(33U, 27U, 7U, 4U), 1, DataType::F32) // Kernel size not supported
567  }),
568  framework::dataset::make("WeightsInfo", {
569  TensorInfo(TensorShape(3U, 3U, 2U, 19U), 1, DataType::F16),
570  TensorInfo(TensorShape(3U, 3U, 2U, 19U), 1, DataType::QASYMM8),
571  TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32),
572  TensorInfo(TensorShape(3U, 3U, 8U, 16U), 1, DataType::F32),
573  TensorInfo(TensorShape(5U, 5U, 7U, 16U), 1, DataType::F16)
574  })),
575  framework::dataset::make("BiasesInfo", {
576  TensorInfo(TensorShape(19U), 1, DataType::F16),
577  TensorInfo(TensorShape(19U), 1, DataType::F32),
578  TensorInfo(TensorShape(21U), 1, DataType::F32),
579  TensorInfo(TensorShape(16U), 1, DataType::F32),
580  TensorInfo(TensorShape(16U), 1, DataType::F32)
581  })),
582  framework::dataset::make("OutputInfo", {
583  TensorInfo(TensorShape(17U, 31U, 19U), 1, DataType::F16),
584  TensorInfo(TensorShape(15U, 15U, 19U), 1, DataType::F32),
585  TensorInfo(TensorShape(21U, 25U, 21U, 4U), 1, DataType::F32),
586  TensorInfo(TensorShape(16U, 16U, 16U), 1, DataType::F32),
587  TensorInfo(TensorShape(11U, 12U, 16U, 4U), 1, DataType::F32)
588  })),
589  framework::dataset::make("ConvInfo", {
590  PadStrideInfo(1, 1, 1, 1),
591  PadStrideInfo(1, 1, 1, 1),
592  PadStrideInfo(1, 2, 0, 0),
593  PadStrideInfo(1, 1, 1, 1),
594  PadStrideInfo(1, 1, 1, 0)
595  })),
596  framework::dataset::make("Expected", { false, false, false, false, false })),
598 {
599  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);
600 }
601 
602 TEST_SUITE(FP32)
603 using CLWinogradConvolutionLayerFastMathFixture = WinogradConvolutionLayerFastMathValidationFixture<CLTensor, CLAccessor, CLWinogradConvolutionLayer, float>;
604 TEST_SUITE(Conv3x3)
606  combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x3Dataset(),
607  framework::dataset::make("DataType", { DataType::F32 })),
608  ActivationFunctionsSmallDataset),
610 {
611  // Validate output
612  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
613 }
614 
616  combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x3Dataset(),
617  framework::dataset::make("DataType", { DataType::F32 })),
618  ActivationFunctionsDataset),
620 {
621  // Validate output
622  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
623 }
624 TEST_SUITE_END() // Conv3x3
625 
626 TEST_SUITE(Conv3x1)
628  combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x1Dataset(),
629  framework::dataset::make("DataType", { DataType::F32 })),
630  ActivationFunctionsSmallDataset),
632 {
633  // Validate output
634  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
635 }
636 
638  combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x1Dataset(),
639  framework::dataset::make("DataType", { DataType::F32 })),
640  ActivationFunctionsDataset),
642 {
643  // Validate output
644  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
645 }
646 TEST_SUITE_END() // Conv3x1
647 
648 TEST_SUITE(Conv1x3)
650  combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x3Dataset(),
651  framework::dataset::make("DataType", { DataType::F32 })),
652  ActivationFunctionsSmallDataset),
654 {
655  // Validate output
656  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
657 }
658 
660  combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x3Dataset(),
661  framework::dataset::make("DataType", { DataType::F32 })),
662  ActivationFunctionsDataset),
664 {
665  // Validate output
666  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
667 }
668 TEST_SUITE_END() // Conv1x3
669 
670 TEST_SUITE(Conv5x5)
672  combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x5Dataset(),
673  framework::dataset::make("DataType", { DataType::F32 })),
674  ActivationFunctionsSmallDataset ),
676 
677 {
678  // Validate output
679  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
680 }
681 
683  combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x5Dataset(),
684  framework::dataset::make("DataType", { DataType::F32 })),
685  ActivationFunctionsDataset ),
687 
688 {
689  // Validate output
690  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
691 }
692 TEST_SUITE_END() // Conv5x5
693 
694 TEST_SUITE(Conv5x1)
696  combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x1Dataset(),
697  framework::dataset::make("DataType", { DataType::F32 })),
698  ActivationFunctionsSmallDataset),
700 
701 {
702  // Validate output
703  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
704 }
705 
707  combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x1Dataset(),
708  framework::dataset::make("DataType", { DataType::F32 })),
709  ActivationFunctionsDataset),
711 
712 {
713  // Validate output
714  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
715 }
716 TEST_SUITE_END() // Conv5x1
717 
718 TEST_SUITE(Conv1x5)
720  combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x5Dataset(),
721  framework::dataset::make("DataType", { DataType::F32 })),
722  ActivationFunctionsSmallDataset),
724 
725 {
726  // Validate output
727  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
728 }
729 
731  combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x5Dataset(),
732  framework::dataset::make("DataType", { DataType::F32 })),
733  ActivationFunctionsDataset),
735 
736 {
737  // Validate output
738  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f32);
739 }
740 TEST_SUITE_END() // Conv1x5
741 TEST_SUITE_END() // FP32
742 
743 
744 TEST_SUITE(FP16)
745 
746 using CLWinogradConvolutionLayerFastMathFixture16 = WinogradConvolutionLayerFastMathValidationFixture<CLTensor, CLAccessor, CLWinogradConvolutionLayer, half, float>;
747 TEST_SUITE(Conv3x3)
749  combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x3Dataset(),
750  framework::dataset::make("DataType", { DataType::F16 })),
751  ActivationFunctionsSmallDataset),
753 {
754  // Validate output
755  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16, tolerance_num_f16);
756 }
757 
759  combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x3Dataset(),
760  framework::dataset::make("DataType", { DataType::F16 })),
761  ActivationFunctionsDataset),
763 {
764  // Validate output
765  validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16);
766 }
767 TEST_SUITE_END() // Conv3x3
768 
769 TEST_SUITE(Conv3x1)
771  combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x1Dataset(),
772  framework::dataset::make("DataType", { DataType::F16 })),
773  ActivationFunctionsSmallDataset),
775 {
776  // Validate output
777  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16, tolerance_num_f16);
778 }
779 
781  combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x1Dataset(),
782  framework::dataset::make("DataType", { DataType::F16 })),
783  ActivationFunctionsDataset),
785 {
786  // Validate output
787  validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16);
788 }
789 TEST_SUITE_END() // Conv3x1
790 
791 TEST_SUITE(Conv1x3)
793  combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x3Dataset(),
794  framework::dataset::make("DataType", { DataType::F16 })),
795  ActivationFunctionsSmallDataset),
797 {
798  // Validate output
799  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16, tolerance_num_f16);
800 }
801 
803  combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x3Dataset(),
804  framework::dataset::make("DataType", { DataType::F16 })),
805  ActivationFunctionsDataset),
807 {
808  // Validate output
809  validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16);
810 }
811 TEST_SUITE_END() // Conv1x3
812 
813 TEST_SUITE(Conv5x5)
815  combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x5Dataset(),
816  framework::dataset::make("DataType", { DataType::F16 })),
817  ActivationFunctionsSmallDataset),
819 
820 {
821  // Validate output
822  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16, tolerance_num_f16);
823 }
824 
826  combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x5Dataset(),
827  framework::dataset::make("DataType", { DataType::F16 })),
828  ActivationFunctionsDataset),
830 
831 {
832  // Validate output
833  validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16);
834 }
835 TEST_SUITE_END() // Conv5x5
836 
837 TEST_SUITE(Conv5x1)
839  combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x1Dataset(),
840  framework::dataset::make("DataType", { DataType::F16 })),
841  ActivationFunctionsSmallDataset),
843 
844 {
845  // Validate output
846  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16, tolerance_num_f16);
847 }
848 
850  combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x1Dataset(),
851  framework::dataset::make("DataType", { DataType::F16 })),
852  ActivationFunctionsDataset),
854 
855 {
856  // Validate output
857  validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16);
858 }
859 TEST_SUITE_END() // Conv5x1
860 
861 TEST_SUITE(Conv1x5)
863  combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x5Dataset(),
864  framework::dataset::make("DataType", { DataType::F16 })),
865  ActivationFunctionsSmallDataset),
867 
868 {
869  // Validate output
870  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16, tolerance_num_f16);
871 }
872 
874  combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x5Dataset(),
875  framework::dataset::make("DataType", { DataType::F16 })),
876  ActivationFunctionsDataset),
878 
879 {
880  // Validate output
881  validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16);
882 }
883 TEST_SUITE_END() // Conv1x5
884 
885 TEST_SUITE(Conv1x7)
887  combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x7Dataset(),
888  framework::dataset::make("DataType", { DataType::F16 })),
889  ActivationFunctionsSmallDataset),
890  framework::dataset::make("DataLayout", { DataLayout::NHWC })))
891 
892 {
893  // Validate output
894  validate(CLAccessor(_target), _reference, tolerance_convolution_layer_f16, tolerance_num_f16);
895 }
896 
898  combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x7Dataset(),
899  framework::dataset::make("DataType", { DataType::F16 })),
900  ActivationFunctionsDataset),
901  framework::dataset::make("DataLayout", { DataLayout::NHWC })))
902 
903 {
904  // Validate output
905  validate(CLAccessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_convolution_layer_f16);
906 }
907 TEST_SUITE_END() // Conv1x7
908 
909 TEST_SUITE_END() // FP16
910 
911 TEST_SUITE_END() // ConvolutionLayer
912 TEST_SUITE_END() // Winograd
913 TEST_SUITE_END() // CL
914 } // namespace validation
915 } // namespace test
916 } // namespace arm_compute
WinogradFilterTransformValidationFixture< CLTensor, CLAccessor, CLWinogradFilterTransform, float > CLWinogradFilterTransformFixtureFP32
Definition: Winograd.cpp:334
Shape of a tensor.
Definition: TensorShape.h:39
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:60
Winograd information.
Definition: Types.h:2154
half_float::half half
16-bit floating point type
Definition: Types.h:45
1 channel, 1 F32 per channel
ARM_COMPUTE_EXPECT(has_error==expected, framework::LogLevel::ERRORS)
WinogradConvolutionLayerFastMathValidationFixture< CLTensor, CLAccessor, CLWinogradConvolutionLayer, float > CLWinogradConvolutionLayerFastMathFixture
Definition: Winograd.cpp:603
As above but this also setups a Zero border on the input tensor of the specified bordersize.
Definition: Helper.h:82
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:1615
Copyright (c) 2017-2020 ARM Limited.
1 channel, 1 F16 per channel
WinogradInputTransformValidationFixture< CLTensor, CLAccessor, CLWinogradInputTransform, float > CLWinogradInputTransformFixtureFP32
Definition: Winograd.cpp:227
WinogradFilterTransformValidationFixture< CLTensor, CLAccessor, CLWinogradFilterTransform, half > CLWinogradFilterTransformFixtureFP16
Definition: Winograd.cpp:335
WinogradOutputTransformValidationFixture< CLTensor, CLAccessor, CLWinogradOutputTransform, float > CLWinogradOutputTransformFixtureFP32
Definition: Winograd.cpp:473
DatasetMode
Possible dataset modes.
Definition: DatasetModes.h:40
WinogradOutputTransformValidationFixture< CLTensor, CLAccessor, CLWinogradOutputTransform, half > CLWinogradOutputTransformFixtureFP16
Definition: Winograd.cpp:474
quantized, asymmetric fixed-point 8-bit number unsigned
Accessor implementation for CLTensor objects.
Definition: CLAccessor.h:35
Padding and stride information class.
Definition: Types.h:686
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...
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
validate(dst.info() ->valid_region(), valid_region)
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:228
TEST_SUITE_END() FIXTURE_DATA_TEST_CASE(RunSmall
Input data sets.
Store the tensor's metadata.
Definition: TensorInfo.h:45
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:75
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...
DataLayout
[DataLayout enum definition]
Definition: Types.h:117
combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F32)))
Definition: AbsLayer.cpp:65
TEST_SUITE(U8_to_S8) DATA_TEST_CASE(Configuration
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(datasets::SmallShapes(), AbsoluteDifferenceU8Dataset), shape, data_type0, data_type1, output_data_type)
Basic implementation of the OpenCL tensor interface.
Definition: CLTensor.h:41