Compute Library
 21.11
ClConv2d Class Reference

Basic function to compute the convolution layer. More...

#include <ClConv2d.h>

Collaboration diagram for ClConv2d:
[legend]

Public Member Functions

 ClConv2d ()
 Default constructor. More...
 
 ~ClConv2d ()
 Default Destructor. More...
 
 ClConv2d (const ClConv2d &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 ClConv2d (ClConv2d &&)=default
 Default move constructor. More...
 
ClConv2doperator= (const ClConv2d &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
ClConv2doperator= (ClConv2d &&)=default
 Default move assignment operator. More...
 
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. More...
 
void run (ITensorPack &tensors) override
 Run the kernels contained in the function. More...
 
void prepare (ITensorPack &tensors) override
 Prepare the function for executing. More...
 
experimental::MemoryRequirements workspace () const override
 Return the memory requirements required by the workspace. More...
 
- Public Member Functions inherited from ICLOperator
 ICLOperator (IRuntimeContext *ctx=nullptr)
 Constructor. More...
 
 ICLOperator (const ICLOperator &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 ICLOperator (ICLOperator &&)=default
 Default move constructor. More...
 
ICLOperatoroperator= (const ICLOperator &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
ICLOperatoroperator= (ICLOperator &&)=default
 Default move assignment operator. More...
 
- Public Member Functions inherited from IOperator
virtual ~IOperator ()=default
 Destructor. More...
 

Static Public Member Functions

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. More...
 
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. More...
 

Detailed Description

Basic function to compute the convolution layer.

This function calls the following OpenCL kernels/functions:

  1. opencl::ClGemmConv2d
  2. opencl::ClWinogradConv2d
  3. opencl::ClDirectConv2d
  4. CLFFTConvolutionLayer

The function selects one of the algorithms mentioned above based on:

  • The size of the kernel
  • Number of src/dst feature maps
  • Amount of memory needed

Generally GEMM-based convolution is executed when neither Winograd nor FFT nor Direct convolution can be performed.

FP32 AlgorithmFilter Size Input/Output feature maps
Winograd 3x3 1x3 3x1 5x1 1x5 5x5(fast maths) 7x1 1x7 Input channels is greater than 3
FFT Squared kernels and greater than 9x9 Input feature maps > Output feature maps
DirectConv 9x9
GEMM Any size

Winograd 5x5 requires fast maths enabled.

FP16 AlgorithmFilter Size Input/Output feature maps
Winograd 3x3 1x3 3x1 5x1 1x5 5x5 Input channels is greater than 3
FFT Not supported
DirectConv 9x9
GEMM Any size

Winograd FP16 requires fast maths enabled.

Definition at line 70 of file ClConv2d.h.

Constructor & Destructor Documentation

◆ ClConv2d() [1/3]

ClConv2d ( )

Default constructor.

Definition at line 76 of file ClConv2d.cpp.

References ClConv2d::~ClConv2d().

77  : _operator()
78 {
79 }

◆ ~ClConv2d()

~ClConv2d ( )
default

Default Destructor.

Referenced by ClConv2d::ClConv2d().

◆ ClConv2d() [2/3]

ClConv2d ( const ClConv2d )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ ClConv2d() [3/3]

ClConv2d ( ClConv2d &&  )
default

Default move constructor.

Member Function Documentation

◆ configure()

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.

Valid data layouts:

  • NHWC
  • NCHW

Valid data type configurations:

src0 src1 src2 dst
F16 F16 F16 F16
F32 F32 F32 F32
QASYMM8 QASYMM8 S32 QASYMM8
QASYMM8 QSYMM8_PER_CHANNEL S32 QASYMM8
QASYMM8_SIGNED QASYMM8_SIGNED S32 QASYMM8_SIGNED
QASYMM8_SIGNED QSYMM8_PER_CHANNEL S32 QASYMM8_SIGNED
Parameters
[in]compile_contextThe compile context to be used.
[in]srcSource tensor info. 3 lower dimensions represent a single src [width, height, IFM], while every optional dimension from 4 and above represent a batch of srcs. Data types supported: QASYMM8/QASYMM8_SIGNED/F16/F32.
[in]weightsWeights tensor info. Weights are 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM]. Data type supported: Same as src, also could be QSYMM8_PER_CHANNEL if src is QASYMM8/QASYMM8_SIGNED.
[in]biasesBiases tensor info. Shared biases supported. Biases are 1D tensor with dimensions [OFM]. Data type supported: Same as src, except for src of QASYMM8/QASYMM8_SIGNED type where biases should be of S32 type.
[out]dstDestination tensor info. 3 lower dimensions represent a single dst [width, height, OFM], while the rest represent batch of dsts. Data types supported: Same as src.
[in]conv2d_infoContains convolution 2d info described in Conv2dInfo.
[in]weights_infoSpecifies if the weights tensor has been reshaped with CLWeightsReshapeKernel. Data type supported: Same as src.

Definition at line 83 of file ClConv2d.cpp.

References Conv2dInfo::act_info, ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, ARM_COMPUTE_LOG_PARAMS, Conv2dInfo::conv_info, arm_compute::DIRECT, Conv2dInfo::enable_fast_math, arm_compute::GEMM, CLScheduler::get(), ClConv2d::get_convolution_method(), Conv2dInfo::num_groups, Conv2dInfo::post_ops, ClConv2d::validate(), and arm_compute::WINOGRAD.

85 {
87  ARM_COMPUTE_ERROR_THROW_ON(ClConv2d::validate(src, weights, ((biases != nullptr) ? biases : nullptr), dst, conv2d_info, weights_info));
88  ARM_COMPUTE_LOG_PARAMS(src, weights, biases, dst, conv2d_info, weights_info);
89 
90  switch(ClConv2d::get_convolution_method(src, weights, dst, conv2d_info, weights_info, CLScheduler::get().target()))
91  {
93  {
94  ARM_COMPUTE_ERROR_ON(conv2d_info.num_groups != 1);
95  ARM_COMPUTE_ERROR_ON(conv2d_info.post_ops.size() > 0);
96  auto f = std::make_unique<ClWinogradConv2d>();
97  f->configure(compile_context, src, weights, biases, dst, conv2d_info.conv_info, conv2d_info.act_info, conv2d_info.enable_fast_math);
98  _operator = std::move(f);
99  break;
100  }
102  {
103  ARM_COMPUTE_ERROR_ON(conv2d_info.num_groups != 1);
104  ARM_COMPUTE_ERROR_ON(conv2d_info.post_ops.size() > 0);
105  auto f = std::make_unique<ClDirectConv2d>();
106  f->configure(compile_context, src, weights, biases, dst, conv2d_info.conv_info, conv2d_info.act_info);
107  _operator = std::move(f);
108  break;
109  }
111  {
112  auto f = std::make_unique<ClGemmConv2d>();
113  f->configure(compile_context, src, weights, biases, dst, conv2d_info, weights_info);
114  _operator = std::move(f);
115  break;
116  }
117  default:
118  ARM_COMPUTE_ERROR("Not supported.");
119  break;
120  }
121  _aux_mem = _operator->workspace();
122 }
static CLScheduler & get()
Access the scheduler singleton.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:455
SimpleTensor< float > src
Definition: DFT.cpp:155
Convolution using Winograd.
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.
Definition: ClConv2d.cpp:164
#define ARM_COMPUTE_LOG_PARAMS(...)
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:157
Convolution using GEMM.
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.
Definition: ClConv2d.cpp:124

◆ get_convolution_method()

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

Static function to check if given info will return the convolution called by ClConv2d.

Parameters
[in]srcSource tensor. 3 lower dimensions represent a single src [width, height, IFM], while every optional dimension from 4 and above represent a batch of srcs. Data types supported: QASYMM8/QASYMM8_SIGNED/F16/F32.
[in]weightsWeights tensor. Weights are 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM]. Data type supported: Same as src, also could be QSYMM8_PER_CHANNEL if src is QASYMM8/QASYMM8_SIGNED.
[in]dstDestination tensor. 3 lower dimensions represent a single dst [width, height, OFM], while the rest represent batch of dsts. Data types supported: Same as src.
[in]conv2d_infoContains convolution 2d info described in Conv2dInfo.
[in]weights_infoSpecifies if the weights tensor has been reshaped with CLWeightsReshapeKernel.
[in]gpu_targetSpecifies the GPUTarget.
Returns
the Convolution Method Hint

Definition at line 164 of file ClConv2d.cpp.

References Conv2dInfo::act_info, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_UNUSED, arm_compute::CHANNEL, Conv2dInfo::conv_info, arm_compute::test::validation::conv_info, ITensorInfo::data_layout(), arm_compute::test::validation::data_layout, ITensorInfo::data_type(), Conv2dInfo::dilation, ITensorInfo::dimension(), arm_compute::DIRECT, Conv2dInfo::enable_fast_math, arm_compute::FFT, arm_compute::FLOOR, arm_compute::GEMM, arm_compute::get_data_layout_dimension_index(), arm_compute::HEIGHT, arm_compute::test::validation::info, arm_compute::is_data_type_float(), arm_compute::NCHW, arm_compute::NHWC, PadStrideInfo::pad_bottom(), PadStrideInfo::pad_left(), PadStrideInfo::pad_right(), PadStrideInfo::pad_top(), PadStrideInfo::stride(), arm_compute::utils::cast::U, ClDirectConv2d::validate(), ClWinogradConv2d::validate(), CLFFTConvolutionLayer::validate(), arm_compute::WIDTH, and arm_compute::WINOGRAD.

Referenced by ClConv2d::configure(), CLConvolutionLayer::configure(), CLConvolutionLayer::get_convolution_method(), ClConv2d::validate(), and CLConvolutionLayer::validate().

166 {
171 
172  const PadStrideInfo conv_info = conv2d_info.conv_info;
173  const ActivationLayerInfo act_info = conv2d_info.act_info;
174  const Size2D dilation = conv2d_info.dilation;
175  bool enable_fast_math = conv2d_info.enable_fast_math;
176 
177  const size_t idx_w = get_data_layout_dimension_index(src->data_layout(), DataLayoutDimension::WIDTH);
178  const size_t idx_h = get_data_layout_dimension_index(src->data_layout(), DataLayoutDimension::HEIGHT);
179  const size_t idx_c = get_data_layout_dimension_index(src->data_layout(), DataLayoutDimension::CHANNEL);
180 
181  /* Input spatial dims, kernel size, IFM/OFM, conv info*/
182  using ConvolutionConfiguration = std::tuple<Size2D, Size2D, Size2D, PadStrideInfo, DataLayout>;
183  using ConfigurationMethod = std::pair<ConvolutionConfiguration, ConvolutionMethod>;
184 
185  const std::vector<ConfigurationMethod> known_configs =
186  {
187  // Alexnet
188  ConfigurationMethod(ConvolutionConfiguration(Size2D(27U, 27U), Size2D(5U, 5U), Size2D(48U, 128U), PadStrideInfo(1U, 1U, 2U, 2U), DataLayout::NCHW), ConvolutionMethod::DIRECT),
189  // VGG16 / VGG19
190  ConfigurationMethod(ConvolutionConfiguration(Size2D(224U, 224U), Size2D(3U, 3U), Size2D(3U, 64U), PadStrideInfo(1U, 1U, 1U, 1U), DataLayout::NCHW), ConvolutionMethod::DIRECT),
191  // Mobilenet 224
192  ConfigurationMethod(ConvolutionConfiguration(Size2D(224U, 224U), Size2D(3U, 3U), Size2D(3U, 32U), PadStrideInfo(2U, 2U, 0U, 1U, 0U, 1U, DimensionRoundingType::FLOOR), DataLayout::NCHW), ConvolutionMethod::GEMM),
193  // Mobilenet 160
194  ConfigurationMethod(ConvolutionConfiguration(Size2D(160U, 160U), Size2D(3U, 3U), Size2D(3U, 24U), PadStrideInfo(2U, 2U, 0U, 1U, 0U, 1U, DimensionRoundingType::FLOOR), DataLayout::NCHW), ConvolutionMethod::GEMM),
195  // Mobilenet 224
196  ConfigurationMethod(ConvolutionConfiguration(Size2D(224U, 224U), Size2D(3U, 3U), Size2D(3U, 32U), PadStrideInfo(2U, 2U, 0U, 1U, 0U, 1U, DimensionRoundingType::FLOOR), DataLayout::NHWC), ConvolutionMethod::GEMM),
197  // Mobilenet 160
198  ConfigurationMethod(ConvolutionConfiguration(Size2D(160U, 160U), Size2D(3U, 3U), Size2D(3U, 24U), PadStrideInfo(2U, 2U, 0U, 1U, 0U, 1U, DimensionRoundingType::FLOOR), DataLayout::NHWC), ConvolutionMethod::GEMM),
199  };
200 
201  const auto find_config = [&](ConfigurationMethod c)
202  {
203  const ConvolutionConfiguration config = c.first;
204  const PadStrideInfo info = std::get<3>(config);
205  const DataLayout data_layout = std::get<4>(config);
206 
207  return std::get<0>(config) == Size2D(src->dimension(idx_w), src->dimension(idx_h)) && std::get<1>(config) == Size2D(weights->dimension(idx_w), weights->dimension(idx_h))
208  && std::get<2>(config) == Size2D(weights->dimension(idx_c), weights->dimension(3)) && info.pad_top() == conv_info.pad_top() && info.pad_right() == conv_info.pad_right()
209  && info.pad_bottom() == conv_info.pad_bottom() && info.pad_left() == conv_info.pad_left() && info.stride() == conv_info.stride() && (data_layout == src->data_layout());
210  };
211 
212  std::vector<ConfigurationMethod>::const_iterator found;
213  if((found = std::find_if(known_configs.begin(), known_configs.end(), find_config)) != known_configs.end())
214  {
215  return (*found).second;
216  }
217 
218  if(dilation != Size2D(1U, 1U))
219  {
221  }
222  else
223  {
224  if(src->data_layout() == DataLayout::NCHW)
225  {
226  // SRGAN
227  if((src->dimension(idx_h) > 720U) && (dst->dimension(idx_h) > 720U) && (weights->dimension(idx_h) == 9) && (conv_info.pad_top() < 3)
228  && (ClDirectConv2d::validate(src, weights, nullptr, dst, conv_info, act_info)))
229  {
231  }
232  if((weights->dimension(idx_h) > 5) && (src->dimension(idx_c) > dst->dimension(idx_c)) && (CLFFTConvolutionLayer::validate(src, weights, nullptr, dst, conv_info, act_info, enable_fast_math)))
233  {
234  return ConvolutionMethod::FFT;
235  }
236  if(src->dimension(idx_c) < 16)
237  {
239  }
240  return bool(ClWinogradConv2d::validate(src, weights, nullptr, dst, conv_info, act_info, enable_fast_math)) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM;
241  }
242  else
243  {
244  const bool is_direct_valid = bool(ClDirectConv2d::validate(src, weights, nullptr, dst, conv_info, act_info));
245  const bool is_wino_valid = bool(ClWinogradConv2d::validate(src, weights, nullptr, dst, conv_info, act_info, enable_fast_math));
246  const size_t kernel_sz_direct_conv_thr = get_direct_conv_kernel_threshold_nhwc(gpu_target);
247 
248  // SRGAN case
249  if((src->dimension(idx_h) > 720U) && (dst->dimension(idx_h) > 720U) && (weights->dimension(idx_h) == 9) && (conv_info.pad_top() < 3)
250  && is_direct_valid)
251  {
253  }
254 
255  // Floating-point case: GeMM/Direct/Winograd
256  if(is_data_type_float(src->data_type()))
257  {
258  const bool is_large_kernel_sz = (weights->dimension(idx_w) >= kernel_sz_direct_conv_thr) && (weights->dimension(idx_h) >= kernel_sz_direct_conv_thr);
259  const bool is_ifm_ge_16 = src->dimension(idx_c) >= 16;
260  const bool is_ifm_gt_ofm = src->dimension(idx_c) > weights->dimension(3U);
261 
262  // Run Winograd if valid and IFM >= 16
263  if(is_wino_valid && is_ifm_ge_16)
264  {
266  }
267  // Run Direct for Large kernel size
268  if(is_large_kernel_sz && is_ifm_ge_16 && is_direct_valid && is_ifm_gt_ofm)
269  {
271  }
272 
273  // Default case
275  }
276 
277  // Generic case for quantized. Only GeMM
279  }
280  }
281 }
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.
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.
SimpleTensor< float > src
Definition: DFT.cpp:155
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.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
Num samples, channels, height, width.
Convolution using Winograd.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
size_t get_data_layout_dimension_index(const DataLayout &data_layout, const DataLayoutDimension &data_layout_dimension)
Get the index of the given dimension.
Definition: Helpers.inl:193
Num samples, height, width, channels.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:157
DataLayout
[DataLayout enum definition]
Definition: Types.h:113
Convolution using GEMM.
bool is_data_type_float(DataType dt)
Check if a given data type is of floating point type.
Definition: Utils.h:961

◆ operator=() [1/2]

ClConv2d& operator= ( const ClConv2d )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ operator=() [2/2]

ClConv2d& operator= ( ClConv2d &&  )
default

Default move assignment operator.

◆ prepare()

void prepare ( ITensorPack constants)
overridevirtual

Prepare the function for executing.

Any one off pre-processing step required by the function is handled here

Parameters
[in]constantsVector that contains the constants tensors.
Note
Prepare stage might not need all the function's buffers' backing memory to be available in order to execute

Reimplemented from ICLOperator.

Definition at line 289 of file ClConv2d.cpp.

Referenced by ClConv2d::run().

290 {
291  _operator->prepare(tensors);
292 }

◆ run()

void run ( ITensorPack tensors)
overridevirtual

Run the kernels contained in the function.

Parameters
[in]tensorsVector that contains the tensors to operate on.

Reimplemented from ICLOperator.

Definition at line 283 of file ClConv2d.cpp.

References ClConv2d::prepare().

284 {
285  prepare(tensors);
286  _operator->run(tensors);
287 }
void prepare(ITensorPack &tensors) override
Prepare the function for executing.
Definition: ClConv2d.cpp:289

◆ validate()

Status validate ( const ITensorInfo src,
const ITensorInfo weights,
const ITensorInfo biases,
const ITensorInfo dst,
const Conv2dInfo conv2d_info,
const WeightsInfo weights_info = WeightsInfo() 
)
static

Static function to check if given info will lead to a valid configuration of ClConv2d.

Similar to ClConv2d::configure()

Returns
a status

Definition at line 124 of file ClConv2d.cpp.

References Conv2dInfo::act_info, ARM_COMPUTE_ERROR, ARM_COMPUTE_RETURN_ERROR_ON_MSG, ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR, ARM_COMPUTE_RETURN_ON_ERROR, Conv2dInfo::conv_info, ITensorInfo::data_layout(), arm_compute::DIRECT, Conv2dInfo::enable_fast_math, arm_compute::GEMM, CLScheduler::get(), ClConv2d::get_convolution_method(), arm_compute::NCHW, Conv2dInfo::num_groups, Conv2dInfo::post_ops, CLScheduler::target(), ClDirectConv2d::validate(), ClWinogradConv2d::validate(), ClGemmConv2d::validate(), and arm_compute::WINOGRAD.

Referenced by ClConv2d::configure(), and CLConvolutionLayer::validate().

126 {
128  ARM_COMPUTE_RETURN_ERROR_ON_MSG((conv2d_info.num_groups != 1) && (src->data_layout() != DataLayout::NCHW), "Grouping (num_groups != 1) with NHWC data layout is not supported");
129 
130  const GPUTarget gpu_target = CLScheduler::get().target();
131 
132  switch(ClConv2d::get_convolution_method(src, weights, dst, conv2d_info, weights_info, gpu_target))
133  {
135  {
136  //Validate Winograd
137  ARM_COMPUTE_RETURN_ERROR_ON_MSG(conv2d_info.num_groups != 1, "Grouping (num_groups != 1) with ClWinogradConv2d is not supported");
138  ARM_COMPUTE_RETURN_ERROR_ON_MSG(conv2d_info.post_ops.size() > 0, "ClWinogradConv2d does not support PostOps");
139  ARM_COMPUTE_RETURN_ON_ERROR(ClWinogradConv2d::validate(src, weights, biases, dst, conv2d_info.conv_info, conv2d_info.act_info, conv2d_info.enable_fast_math));
140  break;
141  }
143  {
144  // Validate direct convolution layer
145  ARM_COMPUTE_RETURN_ERROR_ON_MSG(conv2d_info.num_groups != 1, "Grouping (num_groups != 1) with ClDirectConv2d is not supported");
146  ARM_COMPUTE_RETURN_ERROR_ON_MSG(conv2d_info.post_ops.size() > 0, "ClDirectConv2d does not support PostOps");
147  ARM_COMPUTE_RETURN_ON_ERROR(ClDirectConv2d::validate(src, weights, biases, dst, conv2d_info.conv_info, conv2d_info.act_info));
148  break;
149  }
151  {
152  // Validate gemm-based convolution layer
153  ARM_COMPUTE_RETURN_ON_ERROR(ClGemmConv2d::validate(src, weights, biases, dst, conv2d_info, weights_info));
154  break;
155  }
156  default:
157  ARM_COMPUTE_ERROR("Not supported.");
158  break;
159  }
160 
161  return Status{};
162 }
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.
static CLScheduler & get()
Access the scheduler singleton.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
GPUTarget target() const
Get the target GPU.
Definition: CLScheduler.cpp:45
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
SimpleTensor< float > src
Definition: DFT.cpp:155
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.
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.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
Definition: Validate.h:159
Num samples, channels, height, width.
Convolution using Winograd.
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.
Definition: ClConv2d.cpp:164
GPUTarget
Available GPU Targets.
Definition: GPUTarget.h:34
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
Definition: Error.h:244
Convolution using GEMM.

◆ workspace()

experimental::MemoryRequirements workspace ( ) const
overridevirtual

Return the memory requirements required by the workspace.

Reimplemented from ICLOperator.

Definition at line 294 of file ClConv2d.cpp.

295 {
296  return _aux_mem;
297 }

The documentation for this class was generated from the following files: