23.05
|
Basic function to compute the convolution layer. More...
#include <CpuGemmConv2d.h>
Public Member Functions | |
CpuGemmConv2d () | |
Constructor. More... | |
CpuGemmConv2d (const CpuGemmConv2d &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
CpuGemmConv2d (CpuGemmConv2d &&)=delete | |
Prevent instances of this class from being moved (As this class contains non movable objects) More... | |
CpuGemmConv2d & | operator= (const CpuGemmConv2d &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
CpuGemmConv2d & | operator= (CpuGemmConv2d &&)=delete |
Prevent instances of this class from being moved (As this class contains non movable objects) More... | |
~CpuGemmConv2d () | |
Destructor. More... | |
void | configure (const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *biases, ITensorInfo *dst, 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. 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... | |
![]() | |
INEOperator (IRuntimeContext *ctx=nullptr) | |
Constructor. More... | |
INEOperator (const INEOperator &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
INEOperator (INEOperator &&)=default | |
Default move constructor. More... | |
INEOperator & | operator= (const INEOperator &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
INEOperator & | operator= (INEOperator &&)=default |
Default move assignment operator. More... | |
~INEOperator () | |
Default destructor. More... | |
![]() | |
virtual | ~IOperator ()=default |
Destructor. More... | |
Static Public Member Functions | |
static Status | validate (const ITensorInfo *src, 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. More... | |
static Status | has_opt_impl (arm_compute::WeightFormat &expected_weight_format, const ITensorInfo *src, 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(), const bool enable_fast_math=false) |
Indicates whether or not there is an optimal assembly implementation that can be used to process the given parameters. More... | |
Basic function to compute the convolution layer.
This function calls the following kernels/functions:
Definition at line 58 of file CpuGemmConv2d.h.
CpuGemmConv2d | ( | ) |
Constructor.
Definition at line 94 of file CpuGemmConv2d.cpp.
References arm_compute::NCHW.
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
delete |
Prevent instances of this class from being moved (As this class contains non movable objects)
|
default |
Destructor.
void configure | ( | const ITensorInfo * | src, |
const ITensorInfo * | weights, | ||
const ITensorInfo * | biases, | ||
ITensorInfo * | dst, | ||
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.
Valid data layouts:
Valid data type configurations:
src0 | src1 | src2 | dst |
---|---|---|---|
F16 | F16 | F16 | F16 |
F32 | F32 | F32 | F32 |
BFLOAT16 | BFLOAT16 | BFLOAT16 | BFLOAT16 |
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] | 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/BFLOAT16/F16/F32. |
[in] | weights | Weights tensor info. Weights are 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM]. Data type supported: QASYMM8/QASYMM8_SIGNED/QSYMM8_PER_CHANNEL/BFLOAT16/F16/F32. |
[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 QASYMM8/QASYMM8_SIGNED 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] | conv_info | Contains padding and stride information described in PadStrideInfo. |
[in] | weights_info | Specifies if the weights tensor has been reshaped with NEWeightsReshapeKernel. If this is not part of the fully connected layer the weights tensor has also been transposed with cpu::kernels::CpuGemmTranspose1xWKernel. Data type supported: Same as input . |
[in] | dilation | (Optional) Dilation, in elements, across x and y. Defaults to (1, 1). |
[in] | act_info | (Optional) Activation layer information in case of a fused activation. Only RELU, BOUNDED_RELU and LU_BOUNDED_RELU supported. |
[in] | enable_fast_math | (Optional) Enable fast math computation. In case this flag were set, the function could dispatch the fastest implementation available which may introduce a drop of accuracy as well. Default is false |
[in] | num_groups | (Optional) Number of groups when performing a grouped convolution. num_groups != 1 is not supported |
Definition at line 256 of file CpuGemmConv2d.cpp.
References ARM_COMPUTE_ERROR_ON_MSG, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, ARM_COMPUTE_LOG_PARAMS, ARM_COMPUTE_UNUSED, arm_compute::BATCHES, arm_compute::BFLOAT16, arm_compute::block_by(), arm_compute::CHANNEL, arm_compute::test::validation::conv_info, ITensorInfo::data_layout(), arm_compute::test::validation::data_layout, arm_compute::test::validation::data_type, ITensorInfo::data_type(), ITensorInfo::dimension(), arm_compute::test::validation::dst, arm_compute::F32, arm_compute::get_data_layout_dimension_index(), arm_compute::HEIGHT, arm_compute::is_data_type_quantized_asymmetric(), arm_compute::NCHW, arm_compute::NHWC, arm_compute::offset_int_vec(), arm_compute::experimental::Prepare, ITensorInfo::quantization_info(), WeightsInfo::retain_internal_weights(), arm_compute::scaled_dimensions(), TensorShape::set(), ITensorInfo::set_data_layout(), arm_compute::test::validation::set_data_layout(), TensorInfo::set_data_type(), TensorInfo::set_quantization_info(), arm_compute::test::validation::src, PadStrideInfo::stride(), TensorInfo::tensor_shape(), TensorInfo::total_size(), arm_compute::UNSPECIFIED, CpuGemmConv2d::validate(), WeightsInfo::weight_format(), and arm_compute::WIDTH.
|
static |
Indicates whether or not there is an optimal assembly implementation that can be used to process the given parameters.
The paramter list is the same as NEGEMMConvolutionLayer::has_opt_impl
Definition at line 398 of file CpuGemmConv2d.cpp.
References arm_compute::test::validation::conv_info, ITensorInfo::data_layout(), ITensorInfo::dimension(), arm_compute::test::validation::gemm_info, arm_compute::get_data_layout_dimension_index(), CpuGemm::has_opt_impl(), arm_compute::HEIGHT, arm_compute::scaled_dimensions(), arm_compute::UNSPECIFIED, WeightsInfo::weight_format(), and arm_compute::WIDTH.
Referenced by NEGEMMConvolutionLayer::has_opt_impl().
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
delete |
Prevent instances of this class from being moved (As this class contains non movable objects)
|
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 INEOperator.
Definition at line 659 of file CpuGemmConv2d.cpp.
References arm_compute::ACL_DST, arm_compute::ACL_SRC, arm_compute::ACL_SRC_1, ITensorPack::add_const_tensor(), Scheduler::get(), CpuAuxTensorHandler::get(), ITensorPack::get_const_tensor(), arm_compute::offset_int_vec(), arm_compute::test::validation::pack, and IScheduler::schedule_op().
Referenced by CpuGemmConv2d::run().
|
overridevirtual |
Run the kernels contained in the function.
[in] | tensors | Vector that contains the tensors to operate on. |
Reimplemented from INEOperator.
Definition at line 564 of file CpuGemmConv2d.cpp.
References arm_compute::ACL_DST, arm_compute::ACL_SRC, arm_compute::ACL_SRC_0, arm_compute::ACL_SRC_1, ITensorPack::add_const_tensor(), ITensorPack::add_tensor(), Tensor::allocator(), BorderSize::bottom, ITensor::buffer(), Window::DimY, arm_compute::test::validation::dst, TensorInfo::extend_padding(), Scheduler::get(), CpuAuxTensorHandler::get(), ITensorPack::get_const_tensor(), arm_compute::get_data_layout_dimension_index(), ITensorPack::get_tensor(), arm_compute::HEIGHT, TensorAllocator::import_memory(), ITensor::info(), arm_compute::NCHW, arm_compute::offset_int_vec(), arm_compute::test::validation::pack, ITensorInfo::padding(), CpuGemmConv2d::prepare(), IScheduler::schedule_op(), ITensorAllocator::soft_init(), arm_compute::test::validation::src, and BorderSize::top.
|
static |
Static function to check if given info will lead to a valid configuration.
Similar to CpuGemmConvolution::configure()
Definition at line 430 of file CpuGemmConv2d.cpp.
References WeightsInfo::are_reshaped(), 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::BATCHES, arm_compute::BFLOAT16, arm_compute::block_by(), arm_compute::CHANNEL, arm_compute::misc::shape_calculator::compute_weights_reshaped_shape(), arm_compute::test::validation::conv_info, ITensorInfo::data_layout(), arm_compute::test::validation::data_type, ITensorInfo::data_type(), ITensorInfo::dimension(), arm_compute::test::validation::dst, arm_compute::F16, arm_compute::F32, arm_compute::get_data_layout_dimension_index(), arm_compute::HEIGHT, arm_compute::is_data_type_quantized_asymmetric(), arm_compute::is_fixed_format(), arm_compute::NCHW, ITensorInfo::num_dimensions(), arm_compute::QASYMM8, arm_compute::QASYMM8_SIGNED, arm_compute::QSYMM8_PER_CHANNEL, ITensorInfo::quantization_info(), arm_compute::S32, arm_compute::scaled_dimensions(), TensorShape::set(), arm_compute::test::validation::set_data_layout(), TensorInfo::set_quantization_info(), arm_compute::test::validation::src, ITensorInfo::tensor_shape(), arm_compute::UNSPECIFIED, CpuCol2ImKernel::validate(), CpuIm2ColKernel::validate(), WeightsInfo::weight_format(), and arm_compute::WIDTH.
Referenced by CpuGemmConv2d::configure(), CpuConv2d::validate(), and NEGEMMConvolutionLayer::validate().
|
overridevirtual |
Return the memory requirements required by the workspace.
Reimplemented from INEOperator.
Definition at line 688 of file CpuGemmConv2d.cpp.