Compute Library
 21.02
ConvolutionLayer.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-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  */
24 #include "arm_compute/core/Types.h"
31 #include "tests/NEON/Accessor.h"
33 #include "tests/datasets/LargeConvolutionLayerDataset.h"
34 #include "tests/datasets/SmallConvolutionLayerDataset.h"
35 #include "tests/datasets/TinyConvolutionLayerDataset.h"
37 #include "tests/framework/Macros.h"
40 #include "tests/validation/fixtures/ConvolutionLayerFixture.h"
41 #include "tests/validation/fixtures/WinogradConvolutionLayerFixture.h"
42 
43 namespace arm_compute
44 {
45 namespace test
46 {
47 namespace validation
48 {
49 namespace detail
50 {
51 template <>
53  Tensor *src, const Tensor *weights, const Tensor *bias, Tensor *dst,
55  const Size2D &dilation, const ActivationLayerInfo &act_info, unsigned int num_groups)
56 {
57  ARM_COMPUTE_UNUSED(weights_info);
58 
59  Conv2dInfo conv_info(info, dilation, act_info, false, num_groups);
60  func.configure(src, weights, bias, dst, conv_info);
61 }
62 } // namespace detail
63 namespace
64 {
65 const RelativeTolerance<float> rel_tolerance_f32(0.01f); /**< Relative tolerance for FP32 types */
66 const RelativeTolerance<float> rel_tolerance_winograd_3x3_f32(0.05f); /**< Relative tolerance for FP32 types */
67 const AbsoluteTolerance<float> abs_tolerance_f32(0.002f); /**< Absolute tolerance for FP32 types */
68 const AbsoluteTolerance<float> abs_tolerance_1xN_f32(0.0041f); /**< Absolute tolerance for FP32 types */
69 
70 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
71 const AbsoluteTolerance<half> tolerance_convolution_layer_f16(half(0.4f));
72 constexpr float tolerance_num_f16 = 0.15f;
73 #endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
74 
75 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
76 const RelativeTolerance<half_float::half> rel_tolerance_f16(half_float::half(0.2f)); /**< Relative tolerance value for FP16 types */
77 const AbsoluteTolerance<float> abs_tolerance_f16(0.2f); /**< Absolute tolerance for FP16 types */
78 constexpr float tolerance_num = 0.07f; /**< Tolerance number for the FP16 implementation */
79 #endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
80 constexpr AbsoluteTolerance<float> tolerance_qasymm8(0.0); /**< Tolerance value for comparing reference's output against implementation's output for quantized data types */
81 
82 /** CNN data types */
83 const auto CNNDataTypes = framework::dataset::make("DataType",
84 {
85 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
87 #endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
90 });
91 const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
92 {
96 });
97 
98 const auto QuantizationData = framework::dataset::make("QuantizationInfo",
99 {
100  QuantizationInfo(0.5f, 10),
101  QuantizationInfo(0.3f, 3),
102  QuantizationInfo(1.f, 10),
103  QuantizationInfo(1.1f, 10),
104 });
105 } // namespace
106 
108 TEST_SUITE(ConvolutionLayer)
109 
110 // *INDENT-OFF*
111 // clang-format off
112 DATA_TEST_CASE(ValidateConvolutionMethod, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(
113  framework::dataset::make("InputInfo", { TensorInfo(TensorShape(18U, 18U, 32U), 1, DataType::F32),
114  TensorInfo(TensorShape(23U, 27U, 32U, 4U), 1, DataType::F32),
115  TensorInfo(TensorShape(3U, 3U, 2U, 1U), 1, DataType::F32),
116  TensorInfo(TensorShape(33U, 27U, 7U, 4U), 1, DataType::F32)
117  }),
118  framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 32U, 21U), 1, DataType::F32),
119  TensorInfo(TensorShape(5U, 5U, 32U, 21U), 1, DataType::F32),
120  TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32),
121  TensorInfo(TensorShape(5U, 5U, 7U, 16U), 1, DataType::F16)
122  })),
123  framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(16U, 16U, 21U), 1, DataType::F32),
124  TensorInfo(TensorShape(19U, 23U, 21U, 4U), 1, DataType::F32),
125  TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32),
126  TensorInfo(TensorShape(11U, 12U, 16U, 4U), 1, DataType::F32)
127  })),
128  framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0),
129  PadStrideInfo(1, 1, 0, 0),
130  PadStrideInfo(2, 1, 0, 0),
131  PadStrideInfo(3, 2, 1, 0)
132  })),
133  framework::dataset::make("FastMath", { true,
134  true,
135  false,
136  false
137  })),
140 {
141  ConvolutionMethod is_valid = NEConvolutionLayer::get_convolution_method(&input_info.clone()->set_is_resizable(true),
142  &weights_info.clone()->set_is_resizable(true),
143  &output_info.clone()->set_is_resizable(true), conv_info, WeightsInfo(), Size2D(1U, 1U), ActivationLayerInfo(), fast_math);
145 }
146 // clang-format on
147 // *INDENT-ON*
148 TEST_SUITE_END() // ConvolutionLayer
149 
150 TEST_SUITE(WinogradLayer)
151 template <typename T>
152 using NEWinogradConvolutionLayerFixture = WinogradConvolutionLayerFastMathValidationFixture<Tensor, Accessor, NEWinogradConvolutionLayer, T>;
153 
154 template <typename T>
155 using NEWinogradConvolutionLayerNoBiasFixture = WinogradConvolutionLayerFastMathValidationFixture<Tensor, Accessor, NEWinogradConvolutionLayer, T, T, false>;
156 
157 TEST_SUITE(FP32)
158 
159 TEST_SUITE(Conv1x3)
160 FIXTURE_DATA_TEST_CASE(RunSmall, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT,
161  combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x3Dataset(),
162  framework::dataset::make("DataType", { DataType::F32 })),
163  ActivationFunctionsDataset),
165 {
166  // Validate output
167  validate(Accessor(_target), _reference, abs_tolerance_f32);
168 }
170  combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x3Dataset(),
171  framework::dataset::make("DataType", { DataType::F32 })),
172  ActivationFunctionsDataset),
174 {
175  // Validate output
176  validate(Accessor(_target), _reference, abs_tolerance_1xN_f32);
177 }
178 
179 TEST_SUITE_END() // Conv1x3
180 
181 TEST_SUITE(Conv3x1)
182 FIXTURE_DATA_TEST_CASE(RunSmall, NEWinogradConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT,
183  combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x1Dataset(),
184  framework::dataset::make("DataType", { DataType::F32 })),
185  ActivationFunctionsDataset),
187 {
188  // Validate output
189  validate(Accessor(_target), _reference, abs_tolerance_f32);
190 }
192  combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x1Dataset(),
193  framework::dataset::make("DataType", { DataType::F32 })),
194  ActivationFunctionsDataset),
196 {
197  // Validate output
198  validate(Accessor(_target), _reference, abs_tolerance_1xN_f32);
199 }
200 
201 TEST_SUITE_END() // Conv3x1
202 
203 TEST_SUITE(Conv1x5)
205  combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x5Dataset(),
206  framework::dataset::make("DataType", { DataType::F32 })),
207  ActivationFunctionsDataset),
209 {
210  // Validate output
211  validate(Accessor(_target), _reference, abs_tolerance_f32);
212 }
214  combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x5Dataset(),
215  framework::dataset::make("DataType", { DataType::F32 })),
216  ActivationFunctionsDataset),
218 {
219  // Validate output
220  validate(Accessor(_target), _reference, abs_tolerance_1xN_f32);
221 }
222 
223 TEST_SUITE_END() // Conv1x5
224 
225 TEST_SUITE(Conv5x1)
227  combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x1Dataset(),
228  framework::dataset::make("DataType", { DataType::F32 })),
229  ActivationFunctionsDataset),
231 {
232  // Validate output
233  validate(Accessor(_target), _reference, abs_tolerance_f32);
234 }
236  combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x1Dataset(),
237  framework::dataset::make("DataType", { DataType::F32 })),
238  ActivationFunctionsDataset),
240 {
241  // Validate output
242  validate(Accessor(_target), _reference, abs_tolerance_1xN_f32);
243 }
244 
245 TEST_SUITE_END() // Conv5x1
246 
247 TEST_SUITE(Conv7x1)
249  combine(combine(combine(datasets::SmallWinogradConvolutionLayer7x1Dataset(),
250  framework::dataset::make("DataType", { DataType::F32 })),
251  ActivationFunctionsDataset),
253 {
254  // Validate output
255  validate(Accessor(_target), _reference, abs_tolerance_f32);
256 }
257 
259  combine(combine(combine(datasets::LargeWinogradConvolutionLayer7x1Dataset(),
260  framework::dataset::make("DataType", { DataType::F32 })),
261  ActivationFunctionsDataset),
263 {
264  // Validate output
265  validate(Accessor(_target), _reference, abs_tolerance_1xN_f32);
266 }
267 TEST_SUITE_END() // Conv7x1
268 
269 TEST_SUITE(Conv1x7)
271  combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x7Dataset(),
272  framework::dataset::make("DataType", { DataType::F32 })),
273  ActivationFunctionsDataset),
275 {
276  // Validate output
277  validate(Accessor(_target), _reference, abs_tolerance_f32);
278 }
279 
281  combine(combine(combine(datasets::LargeWinogradConvolutionLayer7x1Dataset(),
282  framework::dataset::make("DataType", { DataType::F32 })),
283  ActivationFunctionsDataset),
285 {
286  // Validate output
287  validate(Accessor(_target), _reference, abs_tolerance_1xN_f32);
288 }
289 TEST_SUITE_END() // Conv1x7
290 
291 TEST_SUITE(Conv3x3)
293  combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x3Dataset(),
294  framework::dataset::make("DataType", { DataType::F32 })),
295  ActivationFunctionsDataset),
297 
298 {
299  // Validate output
300  validate(Accessor(_target), _reference, abs_tolerance_f32);
301 }
303  combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x3Dataset(),
304  framework::dataset::make("DataType", { DataType::F32 })),
305  ActivationFunctionsDataset),
307 
308 {
309  // Validate output
310  // floating point arithmetic the Winograd results will not be exactly the same as direct convolution, especially for big shapes
311  validate(Accessor(_target), _reference, rel_tolerance_winograd_3x3_f32, 0.f, float(abs_tolerance_f32));
312 }
313 TEST_SUITE_END() // Conv3x3
314 
315 TEST_SUITE(Conv5x5)
317  combine(combine(combine(datasets::SmallWinogradConvolutionLayer5x5Dataset(),
318  framework::dataset::make("DataType", { DataType::F32 })),
319  ActivationFunctionsDataset),
321 
322 {
323  // Validate output
324  validate(Accessor(_target), _reference, abs_tolerance_f32);
325 }
327  combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x5Dataset(),
328  framework::dataset::make("DataType", { DataType::F32 })),
329  ActivationFunctionsDataset),
331 
332 {
333  // Validate output
334  validate(Accessor(_target), _reference, abs_tolerance_f32);
335 }
336 
337 TEST_SUITE_END() // Conv5x5
338 
339 FIXTURE_DATA_TEST_CASE(RunSmallNoBias, NEWinogradConvolutionLayerNoBiasFixture<float>, framework::DatasetMode::PRECOMMIT,
340  combine(combine(combine(framework::dataset::concat(datasets::SmallWinogradConvolutionLayer3x3Dataset(),
341  datasets::SmallWinogradConvolutionLayer5x5Dataset()),
342  framework::dataset::make("DataType", { DataType::F32 })),
343  ActivationFunctionsDataset),
344 
346 {
347  // Validate output
348  validate(Accessor(_target), _reference, abs_tolerance_f32);
349 }
350 
351 TEST_SUITE_END() // FP32
352 
353 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
354 TEST_SUITE(FP16)
355 using CLWinogradConvolutionLayerFastMathFixture16 = WinogradConvolutionLayerFastMathValidationFixture<Tensor, Accessor, NEWinogradConvolutionLayer, half, float>;
356 
357 TEST_SUITE(Conv3x3)
358 FIXTURE_DATA_TEST_CASE(RunSmall, CLWinogradConvolutionLayerFastMathFixture16, framework::DatasetMode::PRECOMMIT,
359  combine(combine(combine(datasets::SmallWinogradConvolutionLayer3x3Dataset(),
360  framework::dataset::make("DataType", { DataType::F16 })),
361  ActivationFunctionsDataset),
363 
364 {
365  // Validate output
366  validate(Accessor(_target), _reference, tolerance_convolution_layer_f16, tolerance_num_f16);
367 }
368 
369 FIXTURE_DATA_TEST_CASE(RunLarge, CLWinogradConvolutionLayerFastMathFixture16, framework::DatasetMode::NIGHTLY,
370  combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x3Dataset(),
371  framework::dataset::make("DataType", { DataType::F16 })),
372  ActivationFunctionsDataset),
374 
375 {
376  // Validate output
377  validate(Accessor(_target), _reference, tolerance_convolution_layer_f16, tolerance_num_f16);
378 }
379 TEST_SUITE_END() // Conv3x3
380 TEST_SUITE_END() // FP16
381 #endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
382 TEST_SUITE_END() // WinogradLayer
383 
384 TEST_SUITE(GEMMConvolutionLayer)
385 template <typename T>
386 using NEGEMMConvolutionLayerFixture = ConvolutionValidationFixture<Tensor, Accessor, NEConvolutionLayer, T>;
387 
388 TEST_SUITE(Float)
389 #if defined(__ARM_FEATURE_BF16_VECTOR_ARITHMETIC) || defined(ARM_COMPUTE_FORCE_BF16)
391 FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
392  framework::dataset::make("ReshapeWeights", { true })),
394  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
395  ActivationFunctionsDataset))
396 {
397  // Validate output
398  validate(Accessor(_target), _reference, rel_tolerance_f32, 0.f, float(abs_tolerance_f32));
399 }
400 TEST_SUITE_END() // BFLOAT16
401 #endif /* defined(__ARM_FEATURE_BF16_VECTOR_ARITHMETIC) || defined(ARM_COMPUTE_FORCE_BF16) */
402 
403 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
404 TEST_SUITE(FP16)
405 FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMConvolutionLayerFixture<half>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
406  framework::dataset::make("ReshapeWeights", { true })),
408  framework::dataset::make("DataLayout", { DataLayout::NCHW })),
409  ActivationFunctionsDataset))
410 {
411  // Validate output
412  validate(Accessor(_target), _reference, rel_tolerance_f16, tolerance_num, abs_tolerance_f16);
413 }
414 TEST_SUITE_END() // FP16
415 #endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
416 
417 TEST_SUITE(FP32)
418 FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMConvolutionLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
419  framework::dataset::make("ReshapeWeights", { true })),
422  ActivationFunctionsDataset))
423 {
424  // Validate output
425  validate(Accessor(_target), _reference, rel_tolerance_f32, 0.f, float(abs_tolerance_f32));
426 }
427 TEST_SUITE_END() // FP32
428 TEST_SUITE_END() // Float
429 
430 template <typename T>
431 using NEGEMMConvolutionLayerQuantizedFixture = ConvolutionValidationQuantizedFixture<Tensor, Accessor, NEConvolutionLayer, T>;
432 
433 template <typename T>
434 using NEGEMMConvolutionLayerQuantizedPerChannelFixture = ConvolutionValidationQuantizedPerChannelFixture<Tensor, Accessor, NEConvolutionLayer, T, int8_t>;
435 
437 {
441 });
442 TEST_SUITE(Quantized)
444 FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
445  framework::dataset::make("ReshapeWeights", { true })),
448  framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255.f, 10) })),
450 {
451  // Validate output
452  validate(Accessor(_target), _reference, tolerance_qasymm8);
453 }
454 TEST_SUITE_END() // QASYMM8
455 
457 FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
458  framework::dataset::make("ReshapeWeights", { true })),
461  framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.01f, -10) })),
463 {
464  // Validate output
465  validate(Accessor(_target), _reference, tolerance_qasymm8);
466 }
467 TEST_SUITE_END() // QASYMM8_SIGNED
468 
471  combine(combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
472  framework::dataset::make("ReshapeWeights", { true })),
478 {
479  // Validate output
480  validate(Accessor(_target), _reference, tolerance_qasymm8);
481 }
483  combine(combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
484  framework::dataset::make("ReshapeWeights", { true })),
490 {
491  // Validate output
492  validate(Accessor(_target), _reference, tolerance_qasymm8);
493 }
494 TEST_SUITE_END() // QSYMM8_PER_CHANNEL
495 TEST_SUITE_END() // Quantized
496 
497 TEST_SUITE_END() // GEMMConvolutionLayer
498 
499 TEST_SUITE(DirectGEMMConv2d)
500 template <typename T>
501 using NEDirectGEMMConv2dLayerFixture = ConvolutionValidationFixture<Tensor, Accessor, NEGEMMConv2d, T>;
502 
503 TEST_SUITE(Float)
504 TEST_SUITE(FP32)
505 FIXTURE_DATA_TEST_CASE(RunSmall, NEDirectGEMMConv2dLayerFixture<float>, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
506  framework::dataset::make("ReshapeWeights", { true })),
508  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
509  ActivationFunctionsDataset))
510 {
511  // Validate output
512  validate(Accessor(_target), _reference, rel_tolerance_f32, 0.f, float(abs_tolerance_f32));
513 }
514 TEST_SUITE_END() // FP32
515 TEST_SUITE_END() // Float
516 
517 #ifdef __aarch64__
518 template <typename T>
519 using NEDirectGEMMConv2dLayerQuantizedFixture = ConvolutionValidationQuantizedFixture<Tensor, Accessor, NEGEMMConv2d, T>;
520 
521 template <typename T>
522 using NEDirectGEMMConv2dLayerQuantizedPerChannelFixture = ConvolutionValidationQuantizedPerChannelFixture<Tensor, Accessor, NEGEMMConv2d, T, int8_t>;
523 
525 {
529 });
530 TEST_SUITE(Quantized)
532 FIXTURE_DATA_TEST_CASE(RunSmall, NEDirectGEMMConv2dLayerQuantizedFixture<uint8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
533  framework::dataset::make("ReshapeWeights", { true })),
535  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
536  framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255.f, 10) })),
538 {
539  // Validate output
540  validate(Accessor(_target), _reference, tolerance_qasymm8);
541 }
542 TEST_SUITE_END() // QASYMM8
543 
545 FIXTURE_DATA_TEST_CASE(RunSmall, NEDirectGEMMConv2dLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
546  framework::dataset::make("ReshapeWeights", { true })),
548  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
549  framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.01f, -10) })),
551 {
552  // Validate output
553  validate(Accessor(_target), _reference, tolerance_qasymm8);
554 }
555 TEST_SUITE_END() // QASYMM8_SIGNED
556 
558 FIXTURE_DATA_TEST_CASE(RunSmallSigned, NEDirectGEMMConv2dLayerQuantizedPerChannelFixture<int8_t>, framework::DatasetMode::ALL,
559  combine(combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(),
560  framework::dataset::make("ReshapeWeights", { true })),
562  framework::dataset::make("DataLayout", { DataLayout::NHWC })),
566 {
567  // Validate output
568  validate(Accessor(_target), _reference, tolerance_qasymm8);
569 }
570 TEST_SUITE_END() // QSYMM8_PER_CHANNEL
571 TEST_SUITE_END() // Quantized
572 #endif // __aarch64__
573 
574 TEST_SUITE_END() // DirectGEMMConv2d
575 
576 TEST_SUITE_END() // Neon
577 } // namespace validation
578 } // namespace test
579 } // namespace arm_compute
Shape of a tensor.
Definition: TensorShape.h:39
Class reprensenting an absolute tolerance value.
Definition: Validation.h:50
constexpr float tolerance_num_f16
F16 Tolerance number.
Definition: cl_gemm.cpp:76
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)
ConvolutionValidationQuantizedPerChannelFixture< Tensor, Accessor, NEConvolutionLayer, T, int8_t > NEGEMMConvolutionLayerQuantizedPerChannelFixture
std::enable_if< is_container< T >::value, ContainerDataset< T > >::type make(std::string name, T &&values)
Helper function to create a ContainerDataset.
ConvolutionMethod
Available ConvolutionMethod.
Definition: Types.h:138
Activation Layer Information class.
Definition: Types.h:1550
WinogradConvolutionLayerFastMathValidationFixture< Tensor, Accessor, NEWinogradConvolutionLayer, T, T, false > NEWinogradConvolutionLayerNoBiasFixture
SimpleTensor< float > src
Definition: DFT.cpp:155
Copyright (c) 2017-2021 Arm Limited.
1 channel, 1 F16 per channel
Convolution Layer Weights Information class.
Definition: Types.h:1765
16-bit brain floating-point number
Quantization information.
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)
Accessor implementation for Tensor objects.
Definition: Accessor.h:35
DatasetMode
Possible dataset modes.
Definition: DatasetModes.h:40
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
TEST_SUITE_END() FIXTURE_DATA_TEST_CASE(RunSmall
[CLActivationLayer Test snippet]
quantized, asymmetric fixed-point 8-bit number unsigned
const unsigned int num_groups
Definition: Im2Col.cpp:153
const auto QuantizedActivationFunctionsDataset
Input data sets.
Basic implementation of the tensor interface.
Definition: Tensor.h:37
TEST_SUITE(U8_to_S8) FIXTURE_DATA_TEST_CASE(RunSmall
Padding and stride information class.
Definition: Types.h:722
validate(CLAccessor(output_state), expected_output)
Descriptor used by the Convolution function.
Num samples, channels, height, width.
quantized, symmetric per channel fixed-point 8-bit number
Convolution using Winograd.
FIXTURE_DATA_TEST_CASE(RunSmall, CLAbsLayerFixture< half >, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F16)))
Definition: AbsLayer.cpp:50
FloorUKernelPtr func
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
static ConvolutionMethod get_convolution_method(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *output, const PadStrideInfo &conv_info, const WeightsInfo &weights_info=WeightsInfo(), const Size2D &dilation=Size2D(1U, 1U), const ActivationLayerInfo &act_info=ActivationLayerInfo(), bool enable_fast_math=false)
Static function to check if given info will return the convolution called by NEConvolutionLayer.
Class reprensenting a relative tolerance value.
Definition: Validation.h:86
Class for specifying the size of an image or rectangle.
Definition: Size2D.h:34
Num samples, height, width, channels.
Store the tensor&#39;s metadata.
Definition: TensorInfo.h:45
JoinDataset< T, U > concat(T &&dataset1, U &&dataset2)
Helper function to create a JoinDataset.
Definition: JoinDataset.h:160
quantized, asymmetric fixed-point 8-bit number signed
Basic function to compute the convolution layer.
Definition: NEGEMMConv2d.h:51
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
constexpr float abs_tolerance_f32(0.0001f)
F32 Absolute tolerance value for comparing reference&#39;s output against implementation&#39;s output for flo...
combine(datasets::SmallShapes(), framework::dataset::make("DataType", DataType::F32)))
Definition: AbsLayer.cpp:65
Convolution using GEMM.
void configure_conv_function< NEGEMMConv2d, Tensor >(NEGEMMConv2d &func, Tensor *src, const Tensor *weights, const Tensor *bias, Tensor *dst, const PadStrideInfo &info, const WeightsInfo &weights_info, const Size2D &dilation, const ActivationLayerInfo &act_info, unsigned int num_groups)