43 : _memory_manager(
std::move(memory_manager)),
57 const Conv2dInfo info(conv_info, dilation, act_info, enable_fast_math, num_groups);
62 auto f = std::make_unique<NEWinogradConvolutionLayer>(_memory_manager);
63 f->configure(input, weights, biases, output, conv_info, act_info, enable_fast_math);
64 _function = std::move(f);
69 auto f = std::make_unique<NEGEMMConvolutionLayer>(_memory_manager);
70 f->configure(input, weights, biases, output, conv_info, weights_info, dilation, act_info);
71 _function = std::move(f);
76 auto f = std::make_unique<NEGEMMConv2d>(_memory_manager);
77 f->configure(input, weights, biases, output, info);
78 _function = std::move(f);
83 auto f = std::make_unique<NEDirectConvolutionLayer>(_memory_manager);
84 f->configure(input, weights, biases, output, conv_info, act_info);
85 _function = std::move(f);
90 auto f = std::make_unique<NEFFTConvolutionLayer>(_memory_manager);
91 f->configure(input, weights, biases, output, conv_info, act_info);
92 _function = std::move(f);
106 const Conv2dInfo info(conv_info, dilation, act_info, enable_fast_math, num_groups);
143 const Conv2dInfo info(conv_info, dilation, act_info, enable_fast_math, 1);
146 using ConvolutionConfiguration = std::tuple<Size2D, Size2D, Size2D, PadStrideInfo>;
147 using ConfigurationMethod = std::pair<ConvolutionConfiguration, ConvolutionMethod>;
149 const std::vector<ConfigurationMethod> known_configs =
152 ConfigurationMethod(ConvolutionConfiguration(
Size2D(27
U, 27
U),
Size2D(5
U, 5
U),
Size2D(48
U, 128
U),
PadStrideInfo(1
U, 1
U, 2
U, 2
U)),
ConvolutionMethod::GEMM),
154 ConfigurationMethod(ConvolutionConfiguration(
Size2D(224
U, 224
U),
Size2D(3
U, 3
U),
Size2D(3
U, 64
U),
PadStrideInfo(1
U, 1
U, 1
U, 1
U)),
ConvolutionMethod::GEMM),
156 ConfigurationMethod(ConvolutionConfiguration(
Size2D(224
U, 224
U),
Size2D(3
U, 3
U),
Size2D(3
U, 32
U),
PadStrideInfo(2
U, 2
U, 0
U, 1
U, 0
U, 1
U,
DimensionRoundingType::FLOOR)),
ConvolutionMethod::GEMM),
158 ConfigurationMethod(ConvolutionConfiguration(
Size2D(160
U, 160
U),
Size2D(3
U, 3
U),
Size2D(3
U, 24
U),
PadStrideInfo(2
U, 2
U, 0
U, 1
U, 0
U, 1
U,
DimensionRoundingType::FLOOR)),
ConvolutionMethod::GEMM)
161 const auto find_config = [&](ConfigurationMethod c)
163 const ConvolutionConfiguration config = c.first;
171 std::vector<ConfigurationMethod>::const_iterator found;
172 if((found = std::find_if(known_configs.begin(), known_configs.end(), find_config)) != known_configs.end())
174 return (*found).second;
199 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 204 const std::vector<ConvolutionConfiguration> known_bad_winograd_f16_with_fastmath_configs =
207 ConvolutionConfiguration(
Size2D(56
U, 56
U),
Size2D(3
U, 3
U),
Size2D(16
U, 64
U),
PadStrideInfo(1
U, 1
U, 1
U, 1
U)),
209 ConvolutionConfiguration(
Size2D(14
U, 14
U),
Size2D(3
U, 3
U),
Size2D(48
U, 192
U),
PadStrideInfo(1
U, 1
U, 1
U, 1
U)),
211 ConvolutionConfiguration(
Size2D(14
U, 14
U),
Size2D(3
U, 3
U),
Size2D(64
U, 256
U),
PadStrideInfo(1
U, 1
U, 1
U, 1
U)),
213 const auto find_conv_config = [&](ConvolutionConfiguration c)
222 bool found_bad = std::find_if(known_bad_winograd_f16_with_fastmath_configs.begin(), known_bad_winograd_f16_with_fastmath_configs.end(),
224 != known_bad_winograd_f16_with_fastmath_configs.end();
230 #endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 257 _function->prepare();
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Direct 2D GEMM convolution.
void run() override
Run the kernels contained in the function.
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
void configure(ITensor *input, const ITensor *weights, const ITensor *biases, ITensor *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, unsigned int num_groups=1)
Set the input and output tensors.
Store the tensor's metadata.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
CPUInfo & cpu_info()
Get CPU info.
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 NEFFTConvolutionLayer.
unsigned int pad_top() const
Get the top padding.
ConvolutionMethod
Available ConvolutionMethod.
Activation Layer Information class.
Interface for Neon tensor.
static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const PadStrideInfo &conv_info, const WeightsInfo &weights_info=WeightsInfo(), const Size2D &dilation=Size2D(1U, 1U), const ActivationLayerInfo &act_info=ActivationLayerInfo(), unsigned int num_groups=1)
Static function to check if given info will lead to a valid configuration of NEGEMMConvolutionLayer.
Copyright (c) 2017-2021 Arm Limited.
CPUModel get_cpu_model(unsigned int cpuid) const
Gets the cpu model for a given cpuid.
1 channel, 1 F16 per channel
Convolution Layer Weights Information class.
static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const Conv2dInfo &info)
Static function to check if given info will lead to a valid configuration of NEGEMMConv2d.
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 NEGEMMConvolutionLayer.
NEConvolutionLayer(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Constructor.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
const unsigned int num_groups
std::pair< unsigned int, unsigned int > stride() const
Get the stride.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
unsigned int pad_right() const
Get the right padding.
Padding and stride information class.
Descriptor used by the Convolution function.
Convolution using Winograd.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
virtual size_t total_size() const =0
Returns the total size of the tensor in bytes.
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 for specifying the size of an image or rectangle.
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
size_t get_data_layout_dimension_index(const DataLayout data_layout, const DataLayoutDimension data_layout_dimension)
Get the index of the given dimension.
unsigned int pad_bottom() const
Get the bottom padding.
static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *bias, const ITensorInfo *output, const PadStrideInfo &conv_info, const ActivationLayerInfo &act_info=ActivationLayerInfo())
Static function to check if given info will lead to a valid configuration of NEDirectConvolutionLayer...
unsigned int pad_left() const
Get the left padding.
static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, 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, unsigned int num_groups=1)
Static function to check if given info will lead to a valid configuration of NEConvolutionLayer.
void prepare() override
Prepare the function for executing.
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.
static IScheduler & get()
Access the scheduler singleton.