42 : _memory_manager(
std::move(memory_manager)), _function()
51 configure(
CLKernelLibrary::get().get_compile_context(), input, weights, biases, output, conv_info, weights_info, dilation, act_info, enable_fast_math, num_groups);
68 auto f = std::make_unique<CLWinogradConvolutionLayer>(_memory_manager);
69 f->configure(compile_context, input, weights, biases, output, conv_info, act_info, enable_fast_math);
70 _function = std::move(f);
76 auto f = std::make_unique<CLDirectConvolutionLayer>();
77 f->configure(compile_context, input, weights, biases, output, conv_info, act_info);
78 _function = std::move(f);
83 auto f = std::make_unique<CLGEMMConvolutionLayer>(_memory_manager);
84 f->configure(compile_context, input, weights, biases, output, conv_info, weights_info, dilation, act_info, num_groups);
85 _function = std::move(f);
90 auto f = std::make_unique<CLFFTConvolutionLayer>(_memory_manager);
91 f->configure(compile_context, input, weights, biases, output, conv_info, act_info, enable_fast_math);
92 _function = std::move(f);
159 using ConvolutionConfiguration = std::tuple<Size2D, Size2D, Size2D, PadStrideInfo, DataLayout>;
160 using ConfigurationMethod = std::pair<ConvolutionConfiguration, ConvolutionMethod>;
162 const std::vector<ConfigurationMethod> known_configs =
165 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),
DataLayout::NCHW),
ConvolutionMethod::DIRECT),
167 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),
DataLayout::NCHW),
ConvolutionMethod::DIRECT),
169 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),
DataLayout::NCHW),
ConvolutionMethod::GEMM),
171 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),
DataLayout::NCHW),
ConvolutionMethod::GEMM),
173 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),
DataLayout::NHWC),
ConvolutionMethod::GEMM),
175 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),
DataLayout::NHWC),
ConvolutionMethod::GEMM),
178 const auto find_config = [&](ConfigurationMethod c)
180 const ConvolutionConfiguration config = c.first;
189 std::vector<ConfigurationMethod>::const_iterator found;
190 if((found = std::find_if(known_configs.begin(), known_configs.end(), find_config)) != known_configs.end())
192 return (*found).second;
248 _function->prepare();
void run() override
Run the kernels contained in the function.
CLConvolutionLayer(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Default constructor.
void configure(ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *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.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
static CLScheduler & get()
Access the scheduler singleton.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
GPUTarget target() const
Get the target GPU.
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
~CLConvolutionLayer()
Default Destructor.
void prepare() override
Prepare the function for executing.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
const DataLayout data_layout
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 CLGEMMConvolutionLayer.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
Store the tensor's metadata.
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 CLFFTConvolutionLayer.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, 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 CLDirectConvolutionLayer...
unsigned int pad_top() const
Get the top 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 CLConvolutionLayer.
ConvolutionMethod
Available ConvolutionMethod.
Activation Layer Information class.
Copyright (c) 2017-2021 Arm Limited.
Convolution Layer Weights Information class.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
Interface to enqueue OpenCL kernels and get/set the OpenCL CommandQueue and ICLTuner.
#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.
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.
Convolution using Winograd.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Interface for OpenCL tensor.
GPUTarget
Available GPU Targets.
Class for specifying the size of an image or rectangle.
Num samples, height, width, channels.
static ConvolutionMethod get_convolution_method(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *output, const PadStrideInfo &conv_info, const WeightsInfo &weights_info, const ActivationLayerInfo &act_info, const GPUTarget gpu_target, const Size2D &dilation=Size2D(1U, 1U), bool enable_fast_math=false)
Static function to check if given info will return the convolution called by CLConvolutionLayer.
#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.
unsigned int pad_left() const
Get the left padding.
DataLayout
[DataLayout enum definition]
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.