24.02.1
|
Basic function to compute the convolution layer. More...
#include <ClGemmConv2d.h>
Public Member Functions | |
ClGemmConv2d () | |
Constructor. More... | |
ClGemmConv2d (const ClGemmConv2d &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
ClGemmConv2d (ClGemmConv2d &&)=default | |
Default move constructor. More... | |
ClGemmConv2d & | operator= (const ClGemmConv2d &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
ClGemmConv2d & | operator= (ClGemmConv2d &&)=default |
Default move assignment operator. More... | |
~ClGemmConv2d () | |
Default destructor. 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 input and output tensors. More... | |
void | run (ITensorPack &tensors) override |
Run the kernels contained in the function. More... | |
void | prepare (ITensorPack &constants) 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... | |
ICLOperator & | operator= (const ICLOperator &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
ICLOperator & | operator= (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 *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. More... | |
Basic function to compute the convolution layer.
This function calls the following OpenCL kernels/functions:
Definition at line 59 of file ClGemmConv2d.h.
ClGemmConv2d | ( | ) |
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
default |
Default move constructor.
|
default |
Default destructor.
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 input and output tensors.
Valid data layouts:
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 |
[in] | compile_context | The compile context to be used. |
[in] | src | Source tensor info. 3 lower dimensions represent a single input [width, height, IFM], while every optional dimension from 4 and above represent a batch of inputs. Data types supported: QASYMM8/QASYMM8_SIGNED/F16/F32. |
[in] | weights | Weights tensor info. Weights are 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM]. Data type supported: Same as input or QASYMM8/QSYMM8_PER_CHANNEL when input is QASYMM8 or QASYMM8_SIGNED/QSYMM8_PER_CHANNEL when input is QASYMM8_SIGNED. |
[in] | biases | Biases tensor info. Shared biases supported. Biases are 1D tensor with dimensions [OFM]. Data type supported: Should match input data type, except for input of quantized type where biases should be of S32 type. |
[out] | dst | Destination tensor info. 3 lower dimensions represent a single output [width, height, OFM], while the rest represent batch of outputs. Data types supported: Same as input . |
[in] | conv2d_info | Contains convolution 2d info described in Conv2dInfo. |
[in] | weights_info | Specifies if the weights tensor has been reshaped with CLWeightsReshapeKernel. If this is not part of the fully connected layer the weights tensor has also been transposed with CLGEMMReshapeRHSMatrixKernel. Data type supported: Same as input . |
Definition at line 188 of file ClGemmConv2d.cpp.
References Conv2dInfo::act_info, ActivationLayerInfo::activation(), ARM_COMPUTE_ERROR_ON_MSG, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, ARM_COMPUTE_LOG_PARAMS, arm_compute::BATCHES, arm_compute::quantization::compute_quantized_multipliers_and_shifts(), Conv2dInfo::conv_info, arm_compute::cpu::data_layout, arm_compute::test::validation::data_type, ITensorInfo::data_type(), Conv2dInfo::dilation, ITensorInfo::dimension(), arm_compute::test::validation::dst, ActivationLayerInfo::enabled(), GEMMLowpOutputStageInfo::gemmlowp_max_bound, GEMMLowpOutputStageInfo::gemmlowp_min_bound, GEMMLowpOutputStageInfo::gemmlowp_multiplier, GEMMLowpOutputStageInfo::gemmlowp_multipliers, GEMMLowpOutputStageInfo::gemmlowp_offset, GEMMLowpOutputStageInfo::gemmlowp_shift, GEMMLowpOutputStageInfo::gemmlowp_shifts, CLScheduler::get(), arm_compute::get_data_layout_dimension_index(), arm_compute::get_min_max(), arm_compute::get_quantized_activation_min_max(), arm_compute::HEIGHT, arm_compute::test::validation::idx_height, arm_compute::test::validation::idx_width, arm_compute::is_data_type_quantized_asymmetric(), arm_compute::is_data_type_quantized_per_channel(), GEMMLowpOutputStageInfo::is_quantized_per_channel, arm_compute::NHWC, Conv2dInfo::num_groups, arm_compute::offset_int_vec(), arm_compute::QUANTIZE_DOWN_FIXEDPOINT, arm_compute::scaled_dimensions(), TensorShape::set(), ITensorInfo::set_data_layout(), TensorInfo::set_quantization_info(), arm_compute::test::validation::src, PadStrideInfo::stride(), TensorInfo::tensor_shape(), TensorInfo::total_size(), CLScheduler::tune_kernel_static(), GEMMLowpOutputStageInfo::type, ClGemmConv2d::validate(), arm_compute::test::validation::weights_info, and arm_compute::WIDTH.
|
default |
Default move assignment operator.
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
overridevirtual |
Prepare the function for executing.
Any one off pre-processing step required by the function is handled here
[in] | constants | Vector that contains the constants tensors. |
Reimplemented from ICLOperator.
Definition at line 639 of file ClGemmConv2d.cpp.
References arm_compute::ACL_BIAS, arm_compute::ACL_DST, arm_compute::ACL_SRC, arm_compute::ACL_SRC_1, arm_compute::ACL_SRC_2, ITensorPack::add_const_tensor(), CLScheduler::enqueue_op(), CLScheduler::get(), CLAuxTensorHandler::get(), ITensorPack::get_const_tensor(), ITensorPack::get_tensor(), arm_compute::offset_int_vec(), and arm_compute::test::validation::pack.
Referenced by ClGemmConv2d::run().
|
overridevirtual |
Run the kernels contained in the function.
[in] | tensors | Vector that contains the tensors to operate on. |
Reimplemented from ICLOperator.
Definition at line 579 of file ClGemmConv2d.cpp.
References arm_compute::ACL_DST, arm_compute::ACL_SRC, arm_compute::ACL_SRC_0, arm_compute::ACL_SRC_1, arm_compute::ACL_SRC_2, ITensorPack::add_const_tensor(), ITensorPack::add_tensor(), arm_compute::test::validation::dst, CLScheduler::enqueue_op(), CLScheduler::get(), CLAuxTensorHandler::get(), ITensorPack::get_const_tensor(), ITensorPack::get_tensor(), arm_compute::offset_int_vec(), arm_compute::test::validation::pack, ClGemmConv2d::prepare(), and arm_compute::test::validation::src.
|
static |
Static function to check if given info will lead to a valid configuration.
Similar to ClGemmConvolution::configure()
Definition at line 379 of file ClGemmConv2d.cpp.
References ActivationLayerInfo::a(), Conv2dInfo::act_info, ActivationLayerInfo::activation(), ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_RETURN_ERROR_ON, ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT, ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES, ARM_COMPUTE_RETURN_ERROR_ON_MSG, ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR, ARM_COMPUTE_RETURN_ON_ERROR, arm_compute::auto_init_if_empty(), ActivationLayerInfo::b(), arm_compute::BATCHES, arm_compute::CHANNEL, arm_compute::misc::shape_calculator::compute_im2col_conv_shape(), arm_compute::quantization::compute_quantized_multipliers_and_shifts(), arm_compute::misc::shape_calculator::compute_weights_reshaped_shape(), Conv2dInfo::conv_info, arm_compute::cpu::data_layout, arm_compute::test::validation::data_type, ITensorInfo::data_type(), Conv2dInfo::dilation, ITensorInfo::dimension(), arm_compute::test::validation::dst, ActivationLayerInfo::enabled(), arm_compute::F16, arm_compute::F32, GEMMLowpOutputStageInfo::gemmlowp_max_bound, GEMMLowpOutputStageInfo::gemmlowp_min_bound, GEMMLowpOutputStageInfo::gemmlowp_multiplier, GEMMLowpOutputStageInfo::gemmlowp_multipliers, GEMMLowpOutputStageInfo::gemmlowp_offset, GEMMLowpOutputStageInfo::gemmlowp_shift, GEMMLowpOutputStageInfo::gemmlowp_shifts, arm_compute::get_data_layout_dimension_index(), arm_compute::get_quantized_activation_min_max(), arm_compute::HEIGHT, arm_compute::test::validation::idx_height, arm_compute::test::validation::idx_width, arm_compute::is_data_type_quantized_asymmetric(), arm_compute::is_data_type_quantized_per_channel(), GEMMLowpOutputStageInfo::is_quantized_per_channel, arm_compute::NCHW, arm_compute::NHWC, ITensorInfo::num_dimensions(), Conv2dInfo::num_groups, arm_compute::QASYMM8, arm_compute::QASYMM8_SIGNED, arm_compute::QUANTIZE_DOWN_FIXEDPOINT, arm_compute::S32, arm_compute::scaled_dimensions(), TensorShape::set(), arm_compute::test::validation::src, PadStrideInfo::stride(), ITensorInfo::tensor_shape(), GEMMLowpOutputStageInfo::type, ClActivationKernel::validate(), ClCol2ImKernel::validate(), ClIm2ColKernel::validate(), arm_compute::test::validation::weights_info, and arm_compute::WIDTH.
Referenced by ClGemmConv2d::configure(), ClConv2d::validate(), and CLGEMMConvolutionLayer::validate().
|
overridevirtual |
Return the memory requirements required by the workspace.
Reimplemented from ICLOperator.
Definition at line 663 of file ClGemmConv2d.cpp.