92 auto f = std::make_unique<ClWinogradConv2d>();
94 _operator = std::move(f);
100 auto f = std::make_unique<ClDirectConv2d>();
101 f->configure(compile_context, src, weights, biases, dst, conv2d_info.
conv_info, conv2d_info.
act_info);
102 _operator = std::move(f);
107 auto f = std::make_unique<ClGemmConvolution>();
108 f->configure(compile_context, src, weights, biases, dst, conv2d_info, weights_info);
109 _operator = std::move(f);
116 _aux_mem = _operator->workspace();
175 using ConvolutionConfiguration = std::tuple<Size2D, Size2D, Size2D, PadStrideInfo, DataLayout>;
176 using ConfigurationMethod = std::pair<ConvolutionConfiguration, ConvolutionMethod>;
178 const std::vector<ConfigurationMethod> known_configs =
181 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),
183 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),
185 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),
187 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),
189 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),
191 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),
194 const auto find_config = [&](ConfigurationMethod c)
196 const ConvolutionConfiguration config = c.first;
205 std::vector<ConfigurationMethod>::const_iterator found;
206 if((found = std::find_if(known_configs.begin(), known_configs.end(), find_config)) != known_configs.end())
208 return (*found).second;
238 const bool is_wino_valid = bool(
ClWinogradConv2d::validate(src, weights,
nullptr, dst, conv_info, act_info, enable_fast_math));
239 const size_t kernel_sz_direct_conv_thr = get_direct_conv_kernel_threshold_nhwc(gpu_target);
251 const bool is_large_kernel_sz = (weights->
dimension(idx_w) >= kernel_sz_direct_conv_thr) && (weights->
dimension(idx_h) >= kernel_sz_direct_conv_thr);
252 const bool is_ifm_ge_16 = src->
dimension(idx_c) >= 16;
256 if(is_wino_valid && is_ifm_ge_16)
261 if(is_large_kernel_sz && is_ifm_ge_16 && is_direct_valid && is_ifm_gt_ofm)
279 _operator->run(tensors);
284 _operator->prepare(tensors);
static Status validate(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *dst, const PadStrideInfo &conv_info, const ActivationLayerInfo &act_info=ActivationLayerInfo())
Static function to check if given info will lead to a valid configuration.
experimental::MemoryRequirements workspace() const override
Return the memory requirements required by the workspace.
static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const Conv2dInfo &conv2d_info, const WeightsInfo &weights_info=WeightsInfo())
Static function to check if given info will lead to a valid configuration.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
static CLScheduler & get()
Access the scheduler singleton.
ActivationLayerInfo act_info
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
GPUTarget target() const
Get the target GPU.
ClConv2d()
Default constructor.
#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.
#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
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)
void prepare(ITensorPack &tensors) override
Prepare the function for executing.
unsigned int pad_top() const
Get the top padding.
ConvolutionMethod
Available ConvolutionMethod.
Activation Layer Information class.
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
std::vector< MemoryInfo > MemoryRequirements
void run(ITensorPack &tensors) override
Run the kernels contained in the function.
static Status validate(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *dst, 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.
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.
~ClConv2d()
Default Destructor.
std::pair< unsigned int, unsigned int > stride() const
Get the stride.
unsigned int pad_right() const
Get the right padding.
Padding and stride information class.
void configure(const CLCompileContext &compile_context, ITensorInfo *src, ITensorInfo *weights, ITensorInfo *biases, ITensorInfo *dst, const Conv2dInfo &conv2d_info, const WeightsInfo &weights_info=WeightsInfo())
Set the src and dst tensors.
Descriptor used by the Convolution function.
Num samples, channels, height, width.
Convolution using Winograd.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
static ConvolutionMethod get_convolution_method(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *dst, const Conv2dInfo &conv2d_info, const WeightsInfo &weights_info, const GPUTarget gpu_target)
Static function to check if given info will return the convolution called by ClConv2d.
GPUTarget
Available GPU Targets.
Class for specifying the size of an image or rectangle.
Num samples, height, width, channels.
#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]
static Status validate(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *dst, const Conv2dInfo &conv2d_info, const WeightsInfo &weights_info=WeightsInfo())
Static function to check if given info will lead to a valid configuration of ClConv2d.
bool is_data_type_float(DataType dt)
Check if a given data type is of floating point type.
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.