Compute Library
 22.11
ConvolutionLayer.cpp File Reference
#include "arm_compute/core/Types.h"
#include "arm_compute/runtime/NEON/functions/NEConvolutionLayer.h"
#include "arm_compute/runtime/NEON/functions/NEGEMMConv2d.h"
#include "arm_compute/runtime/NEON/functions/NEGEMMConvolutionLayer.h"
#include "arm_compute/runtime/NEON/functions/NEWinogradConvolutionLayer.h"
#include "arm_compute/runtime/Tensor.h"
#include "arm_compute/runtime/TensorAllocator.h"
#include "src/core/helpers/MemoryHelpers.h"
#include "src/cpu/operators/CpuGemmConv2d.h"
#include "src/cpu/operators/CpuGemmDirectConv2d.h"
#include "src/cpu/operators/CpuWinogradConv2d.h"
#include "tests/NEON/Accessor.h"
#include "tests/PaddingCalculator.h"
#include "tests/datasets/LargeConvolutionLayerDataset.h"
#include "tests/datasets/SmallConvolutionLayerDataset.h"
#include "tests/datasets/TinyConvolutionLayerDataset.h"
#include "tests/framework/Asserts.h"
#include "tests/framework/Macros.h"
#include "tests/framework/datasets/Datasets.h"
#include "tests/validation/Validation.h"
#include "tests/validation/fixtures/ConvolutionLayerFixture.h"
#include "tests/validation/fixtures/WinogradConvolutionLayerFixture.h"

Go to the source code of this file.

Namespaces

 arm_compute
 Copyright (c) 2017-2022 Arm Limited.
 
 arm_compute::test
 
 arm_compute::test::validation
 
 arm_compute::test::validation::detail
 

Typedefs

template<typename T >
using NEWinogradConvolutionLayerMixedDataLayoutFixture = WinogradConvolutionLayerFastMathValidationFixture< Tensor, Accessor, NEWinogradConvolutionLayer, T, T, true, true >
 
template<typename T >
using NEWinogradConvolutionLayerNoBiasFixture = WinogradConvolutionLayerFastMathValidationFixture< Tensor, Accessor, NEWinogradConvolutionLayer, T, T, false >
 
template<typename T >
using NEGEMMConvolutionLayerMixedDataLayoutFixture = ConvolutionValidationFixture< Tensor, Accessor, NEConvolutionLayer, T, true >
 
template<typename T >
using NEGEMMConvolutionLayerQuantizedMixedDataLayoutFixture = ConvolutionValidationQuantizedFixture< Tensor, Accessor, NEConvolutionLayer, T, true >
 
template<typename T >
using NEGEMMConvolutionLayerQuantizedPerChannelFixture = ConvolutionValidationQuantizedPerChannelFixture< Tensor, Accessor, NEConvolutionLayer, T, int8_t >
 

Functions

template<>
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)
 
 DATA_TEST_CASE (ValidateConvolutionMethod, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(framework::dataset::make("InputInfo", { TensorInfo(TensorShape(18U, 18U, 32U), 1, DataType::F32), TensorInfo(TensorShape(23U, 27U, 32U, 4U), 1, DataType::F32), TensorInfo(TensorShape(3U, 3U, 2U, 1U), 1, DataType::F32), TensorInfo(TensorShape(33U, 27U, 7U, 4U), 1, DataType::F32) }), framework::dataset::make("WeightsInfo", { TensorInfo(TensorShape(3U, 3U, 32U, 21U), 1, DataType::F32), TensorInfo(TensorShape(5U, 5U, 32U, 21U), 1, DataType::F32), TensorInfo(TensorShape(3U, 3U, 5U, 21U), 1, DataType::F32), TensorInfo(TensorShape(5U, 5U, 7U, 16U), 1, DataType::F16) })), framework::dataset::make("OutputInfo", { TensorInfo(TensorShape(16U, 16U, 21U), 1, DataType::F32), TensorInfo(TensorShape(19U, 23U, 21U, 4U), 1, DataType::F32), TensorInfo(TensorShape(11U, 25U, 21U), 1, DataType::F32), TensorInfo(TensorShape(11U, 12U, 16U, 4U), 1, DataType::F32) })), framework::dataset::make("ConvInfo", { PadStrideInfo(1, 1, 0, 0), PadStrideInfo(1, 1, 0, 0), PadStrideInfo(2, 1, 0, 0), PadStrideInfo(3, 2, 1, 0) })), framework::dataset::make("FastMath", { true, true, false, false })), framework::dataset::make("Expected", { ConvolutionMethod::WINOGRAD, ConvolutionMethod::WINOGRAD, ConvolutionMethod::GEMM, ConvolutionMethod::GEMM })), input_info, weights_info, output_info, conv_info, fast_math, expected)
 
 TEST_SUITE_END () FIXTURE_DATA_TEST_CASE(RunSmall = ActivationValidationQuantizedFixture<CLTensor, CLAccessor, CLActivationLayer, T>
 [CLActivationLayer Test snippet] More...
 
 TEST_CASE (MemoryInjection, framework::DatasetMode::ALL)
 Test case for memory injection in cpu::CpuWinogradConv2d. More...
 
 TEST_CASE (MultipleExecutionWithConfigure, framework::DatasetMode::ALL)
 Test case for memory injection in NEWinogradConvolutionLayer. More...
 
 FIXTURE_DATA_TEST_CASE (RunSmall, NEWinogradConvolutionLayerFixture< float >, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::SmallWinogradConvolutionLayer1x3Dataset(), framework::dataset::make("DataType", { DataType::F32 })), ActivationFunctionsDataset), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
 
 FIXTURE_DATA_TEST_CASE (RunMixedDataLayout, NEWinogradConvolutionLayerMixedDataLayoutFixture< float >, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(combine(combine(combine(combine(framework::dataset::make("Input", TensorShape(8U, 8U, 32U)), framework::dataset::make("Weight", TensorShape(1U, 3U, 32U, 1U))), framework::dataset::make("Bias", TensorShape(1U))), framework::dataset::make("Output", TensorShape(8U, 6U, 1U))), framework::dataset::make("PadStrideInfo", PadStrideInfo(1, 1, 0, 0))), framework::dataset::make("Dilation", Size2D(1U, 1U))), framework::dataset::make("DataType", { DataType::F32 })), ActivationFunctionsDataset), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
 
 FIXTURE_DATA_TEST_CASE (RunLarge, NEWinogradConvolutionLayerFixture< float >, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x3Dataset(), framework::dataset::make("DataType", { DataType::F32 })), ActivationFunctionsDataset), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
 
 combine (combine(combine(datasets::SmallWinogradConvolutionLayer3x1Dataset(), framework::dataset::make("DataType", { DataType::F32 })), ActivationFunctionsDataset), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
 
 FIXTURE_DATA_TEST_CASE (RunLarge, NEWinogradConvolutionLayerFixture< float >, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x1Dataset(), framework::dataset::make("DataType", { DataType::F32 })), ActivationFunctionsDataset), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
 
 combine (combine(combine(datasets::SmallWinogradConvolutionLayer1x5Dataset(), framework::dataset::make("DataType", { DataType::F32 })), ActivationFunctionsDataset), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
 
 FIXTURE_DATA_TEST_CASE (RunLarge, NEWinogradConvolutionLayerFixture< float >, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeWinogradConvolutionLayer1x5Dataset(), framework::dataset::make("DataType", { DataType::F32 })), ActivationFunctionsDataset), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
 
 combine (combine(combine(datasets::SmallWinogradConvolutionLayer5x1Dataset(), framework::dataset::make("DataType", { DataType::F32 })), ActivationFunctionsDataset), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
 
 FIXTURE_DATA_TEST_CASE (RunLarge, NEWinogradConvolutionLayerFixture< float >, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x1Dataset(), framework::dataset::make("DataType", { DataType::F32 })), ActivationFunctionsDataset), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
 
 combine (combine(combine(datasets::SmallWinogradConvolutionLayer7x1Dataset(), framework::dataset::make("DataType", { DataType::F32 })), ActivationFunctionsDataset), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
 
 FIXTURE_DATA_TEST_CASE (RunLarge, NEWinogradConvolutionLayerFixture< float >, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeWinogradConvolutionLayer7x1Dataset(), framework::dataset::make("DataType", { DataType::F32 })), ActivationFunctionsDataset), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
 
 combine (combine(combine(datasets::SmallWinogradConvolutionLayer1x7Dataset(), framework::dataset::make("DataType", { DataType::F32 })), ActivationFunctionsDataset), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
 
 combine (combine(combine(datasets::SmallWinogradConvolutionLayer3x3Dataset(), framework::dataset::make("DataType", { DataType::F32 })), ActivationFunctionsDataset), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
 
 FIXTURE_DATA_TEST_CASE (RunLarge, NEWinogradConvolutionLayerFixture< float >, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeWinogradConvolutionLayer3x3Dataset(), framework::dataset::make("DataType", { DataType::F32 })), ActivationFunctionsDataset), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
 
 combine (combine(combine(datasets::SmallWinogradConvolutionLayer5x5Dataset(), framework::dataset::make("DataType", { DataType::F32 })), ActivationFunctionsDataset), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
 
 FIXTURE_DATA_TEST_CASE (RunLarge, NEWinogradConvolutionLayerFixture< float >, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::LargeWinogradConvolutionLayer5x5Dataset(), framework::dataset::make("DataType", { DataType::F32 })), ActivationFunctionsDataset), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
 
 combine (combine(combine(framework::dataset::concat(datasets::SmallWinogradConvolutionLayer3x3Dataset(), datasets::SmallWinogradConvolutionLayer5x5Dataset()), framework::dataset::make("DataType", { DataType::F32 })), ActivationFunctionsDataset), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
 
 FIXTURE_DATA_TEST_CASE (RunSmall, NEGEMMConvolutionLayerFixture< float >, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(), framework::dataset::make("ReshapeWeights", { true })), framework::dataset::make("DataType", DataType::F32)), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), ActivationFunctionsDataset))
 
 FIXTURE_DATA_TEST_CASE (RunMixedDataLayout, NEGEMMConvolutionLayerMixedDataLayoutFixture< float >, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine(combine(combine(combine(framework::dataset::make("Input", TensorShape(23U, 27U, 5U)), framework::dataset::make("Weights", TensorShape(3U, 3U, 5U, 2U))), framework::dataset::make("Bias", TensorShape(2U))), framework::dataset::make("Output", TensorShape(11U, 25U, 2U))), framework::dataset::make("PadStrideInfo", PadStrideInfo(2, 1, 0, 0))), framework::dataset::make("Dilation", Size2D(1, 1))), framework::dataset::make("ReshapeWeights", { true })), framework::dataset::make("DataType", DataType::F32)), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), ActivationFunctionsDataset))
 
 FIXTURE_DATA_TEST_CASE (RunSmall, NEGEMMConvolutionLayerQuantizedFixture< uint8_t >, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(), framework::dataset::make("ReshapeWeights", { true })), framework::dataset::make("DataType", DataType::QASYMM8)), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f/255.f, 10) })), QuantizedActivationFunctionsDataset))
 
 FIXTURE_DATA_TEST_CASE (RunMixedDataLayout, NEGEMMConvolutionLayerQuantizedFixture< uint8_t >, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(framework::dataset::make("Input", TensorShape(23U, 27U, 5U)), framework::dataset::make("Weights", TensorShape(3U, 3U, 5U, 2U))), framework::dataset::make("Bias", TensorShape(2U))), framework::dataset::make("Output", TensorShape(11U, 25U, 2U))), framework::dataset::make("PadStrideInfo", PadStrideInfo(2, 1, 0, 0))), framework::dataset::make("Dilation", Size2D(1, 1))), framework::dataset::make("ReshapeWeights", { true })), framework::dataset::make("DataType", DataType::QASYMM8)), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f/255.f, 10) })), QuantizedActivationFunctionsDataset))
 
 combine (combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(), framework::dataset::make("ReshapeWeights", { true })), framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), framework::dataset::make("QuantizationInfo", { QuantizationInfo(0.01f, -10) })), QuantizedActivationFunctionsDataset))
 
 FIXTURE_DATA_TEST_CASE (RunMixedDataLayout, NEGEMMConvolutionLayerQuantizedFixture< int8_t >, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine(combine(combine(combine(combine(framework::dataset::make("Input", TensorShape(23U, 27U, 5U)), framework::dataset::make("Weights", TensorShape(3U, 3U, 5U, 2U))), framework::dataset::make("Bias", TensorShape(2U))), framework::dataset::make("Output", TensorShape(11U, 25U, 2U))), framework::dataset::make("PadStrideInfo", PadStrideInfo(2, 1, 0, 0))), framework::dataset::make("Dilation", Size2D(1, 1))), framework::dataset::make("ReshapeWeights", { true })), framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f/255.f, 10) })), QuantizedActivationFunctionsDataset))
 
 combine (combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(), framework::dataset::make("ReshapeWeights", { true })), framework::dataset::make("DataType", { DataType::QASYMM8 })), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), QuantizationData), QuantizedActivationFunctionsDataset), framework::dataset::make("WeightsDataType", { DataType::QSYMM8_PER_CHANNEL })))
 
 FIXTURE_DATA_TEST_CASE (RunSmallSigned, NEGEMMConvolutionLayerQuantizedPerChannelFixture< int8_t >, framework::DatasetMode::ALL, combine(combine(combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(), framework::dataset::make("ReshapeWeights", { true })), framework::dataset::make("DataType", { DataType::QASYMM8_SIGNED })), framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })), QuantizationData), QuantizedActivationFunctionsDataset), framework::dataset::make("WeightsDataType", { DataType::QSYMM8_PER_CHANNEL })))
 
 FIXTURE_DATA_TEST_CASE (RunSmall, NEDirectGEMMConv2dLayerFixture< float >, framework::DatasetMode::ALL, combine(combine(combine(combine(datasets::SmallConvolutionLayerDataset(), framework::dataset::make("ReshapeWeights", { true })), framework::dataset::make("DataType", DataType::F32)), framework::dataset::make("DataLayout", { DataLayout::NHWC })), ActivationFunctionsDataset))
 

Variables

 NEWinogradConvolutionLayerFixture< float >
 
 NEWinogradConvolutionLayerNoBiasFixture< float >
 
 NEGEMMConvolutionLayerQuantizedFixture< int8_t >
 
 NEGEMMConvolutionLayerQuantizedPerChannelFixture< uint8_t >