24.04
|
Basic function to compute the convolution layer.
More...
#include <CpuGemmConv2d.h>
|
| 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 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.
Weight Transformations in CpuGemmConv2d
Definition at line 51 of file CpuGemmConv2d.h.
◆ CpuGemmConv2d() [1/3]
Constructor.
Definition at line 211 of file CpuGemmConv2d.cpp.
212 : _weights_reshape(
nullptr),
213 _weights_reshape_and_transpose_kernel(
nullptr),
226 _is_quantized(
false),
228 _wt_method(WeightTransformMethod::ReshapeThenTranspose),
230 _aux_mem(AuxTensorIdx::Count)
References arm_compute::NCHW.
◆ CpuGemmConv2d() [2/3]
Prevent instances of this class from being copied (As this class contains pointers)
◆ CpuGemmConv2d() [3/3]
Prevent instances of this class from being moved (As this class contains non movable objects)
◆ ~CpuGemmConv2d()
◆ configure()
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 |
- Parameters
-
[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 CpuWeightsReshapeKernel. 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 |
Which weights tensor should we use to configure gemm
A. The problem: In principle, we should use the weights tensor corresponding to the weights transformation path. I.e.:
- If no weight transformation (_run_wt == false): Use original weights
- else: Use transformed weights However in practice we have a dilemma:
- We need to know _run_wt before we can configure gemm with the corresponding weights, but
- _run_wt depends on isVarWeightsKernel(), which is only known after gemm is configured
B. The decision: To simplify the matter, we decide to always use the transformed weights, regardless of _run_wt
This decision requires the following conditions:
- The underlying gemm where isVarWeightsKernel() == true, must guarantee that: A. Ignore the flag to transpose weights (GEMMInfo::pretranspose_B) B. Use weights/B tensor passed to it at prepare() or run() instead of that passed at configure()
- CpuGemmConv2d where isVarWeightsKernel() == true, must guarantee that: A. Pass original weights instead of reshaped or reinterpreted weights
C. Future actions: Condition 2 is a given, based on our implementation. If condition 1 cannot hold, we must make changes to the underlying gemm to:
- Either expose isVarWeightsKernel() before gemm is configured somehow, or
- Take in an additional "original_weights" tensor info at configure
Definition at line 420 of file CpuGemmConv2d.cpp.
445 const unsigned int kernel_width = weights->dimension(
idx_width);
446 const unsigned int kernel_height = weights->dimension(
idx_height);
454 const ITensorInfo *gemm_input_to_use =
src;
455 ITensorInfo *gemm_output_to_use =
dst;
458 unsigned int conv_w = 0;
459 unsigned int conv_h = 0;
464 "Output shape does not match the expected one");
467 const CpuGemmConv2d::SkipInfo skip_info =
469 _skip_im2col = skip_info.skip_im2col;
470 _skip_col2im = skip_info.skip_col2im;
473 unsigned int stride_x = 0;
474 unsigned int stride_y = 0;
475 std::tie(stride_x, stride_y) =
conv_info.stride();
478 initialize_reshaped_weight_info(*weights, _weights_reshaped);
484 unsigned int input_pad_right = 0;
491 _im2col_kernel = std::make_unique<kernels::CpuIm2ColKernel>();
492 _im2col_kernel->configure(
src, &_im2col_output, Size2D(kernel_width, kernel_height),
conv_info,
false, dilation,
496 gemm_input_to_use = &_im2col_output;
499 const unsigned int mat_weights_cols = weights->
dimension(idx_kernels);
505 TensorShape shape_gemm;
509 shape_gemm.
set(0, mat_weights_cols);
510 shape_gemm.
set(1, conv_w * conv_h);
512 _gemm_output = TensorInfo(shape_gemm, 1, output_data_type);
514 _gemm_output_3d = TensorInfo(_gemm_output);
517 gemm_output_to_use = &_gemm_output;
521 _gemm_output_3d = TensorInfo(*
dst);
523 _gemm_output = TensorInfo(_gemm_output_3d);
526 gemm_output_to_use = &_gemm_output_3d;
531 const unsigned int gemm_3d_depth = _skip_col2im ? conv_h : 0;
559 configure_mm(gemm_input_to_use, &_weights_reshaped, biases, gemm_output_to_use,
act_info, enable_fast_math,
560 gemm_3d_depth, fixed_format,
weights_info.weight_format());
563 _run_wt = !isVarWeightsKernel();
568 _col2im_kernel = std::make_unique<kernels::CpuCol2ImKernel>();
569 _col2im_kernel->configure(gemm_output_to_use,
dst, Size2D(conv_w, conv_h));
574 _reshape = std::make_unique<CpuReshape>();
575 _reshape->configure(gemm_output_to_use,
dst);
579 _aux_mem[Im2ColOutput] =
591 bool gemm_trans_wei = _aux_mem[GemmAsmPretransposedRHS].size > 0;
592 gemm_trans_wei = _mm_gemm !=
nullptr ? _aux_mem[GemmTransposed1xWRHS].size > 0 : gemm_trans_wei;
593 gemm_trans_wei = _mm_gemmlowp !=
nullptr ? _aux_mem[GemmLowpTransposed1xWRHS].size > 0 : gemm_trans_wei;
References arm_compute::test::validation::act_info, 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, arm_compute::cpu::data_layout, arm_compute::test::validation::data_type, ITensorInfo::dimension(), arm_compute::test::validation::dst, arm_compute::F32, arm_compute::get_data_layout_dimension_index(), arm_compute::HEIGHT, arm_compute::test::validation::idx_height, arm_compute::test::validation::idx_width, arm_compute::is_data_type_quantized_asymmetric(), arm_compute::NCHW, arm_compute::NHWC, arm_compute::test::validation::num_groups, arm_compute::offset_int_vec(), arm_compute::experimental::Prepare, arm_compute::scaled_dimensions(), TensorShape::set(), ITensorInfo::set_data_layout(), TensorInfo::set_data_type(), ITensorInfo::set_is_resizable(), TensorInfo::set_quantization_info(), arm_compute::test::validation::src, TensorInfo::tensor_shape(), TensorInfo::total_size(), arm_compute::UNSPECIFIED, CpuGemmConv2d::validate(), arm_compute::test::validation::weights_info, and arm_compute::WIDTH.
◆ has_opt_impl()
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 |
|
) |
| |
|
static |
Indicates whether or not there is an optimal assembly implementation that can be used to process the given parameters.
The parameter list is the same as NEGEMMConvolutionLayer::has_opt_impl
- Returns
- a status.
Which weights tensor should we use for has_opt_impl
For the pretranspose_B flag, this shares a similar problem and thus the same decision as that of Which weights tensor should we use to configure gemm
But for the weights, we shall always use the original instead of reshaped weights here
Definition at line 602 of file CpuGemmConv2d.cpp.
616 const unsigned int kernel_width = weights->dimension(
idx_width);
617 const unsigned int kernel_height = weights->dimension(
idx_height);
618 unsigned int conv_w = 0;
619 unsigned int conv_h = 0;
623 const CpuGemmConv2d::SkipInfo skip_info =
626 const bool skip_im2col = skip_info.skip_im2col;
627 const bool skip_col2im = skip_info.skip_col2im;
628 const unsigned int gemm_3d_depth = skip_col2im ? conv_h : 0;
638 const GEMMInfo gemm_info = GEMMInfo(
false,
false,
true , gemm_3d_depth,
640 GEMMLowpOutputStageInfo(),
false, enable_fast_math,
false,
act_info,
References arm_compute::test::validation::act_info, arm_compute::test::validation::conv_info, arm_compute::cpu::data_layout, ITensorInfo::dimension(), arm_compute::test::validation::dst, arm_compute::get_data_layout_dimension_index(), CpuGemm::has_opt_impl(), arm_compute::HEIGHT, arm_compute::test::validation::idx_height, arm_compute::test::validation::idx_width, arm_compute::scaled_dimensions(), arm_compute::test::validation::src, arm_compute::UNSPECIFIED, arm_compute::test::validation::weights_info, and arm_compute::WIDTH.
Referenced by NEGEMMConvolutionLayer::has_opt_impl().
◆ operator=() [1/2]
Prevent instances of this class from being copied (As this class contains pointers)
◆ operator=() [2/2]
Prevent instances of this class from being moved (As this class contains non movable objects)
◆ prepare()
Prepare the function for executing.
Any one off pre-processing step required by the function is handled here
- Parameters
-
[in] | constants | Vector 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 INEOperator.
Definition at line 895 of file CpuGemmConv2d.cpp.
905 _wt_method = get_wt_method(*(weights->info()));
908 case (WeightTransformMethod::FusedReshapeAndTranspose):
911 _weights_reshape_and_transpose_kernel = std::make_unique<kernels::CpuWeightsReshapeKernel>();
912 _weights_reshape_and_transpose_kernel->configure(weights->info(),
nullptr, &_weights_reshaped);
915 case (WeightTransformMethod::ReshapeThenTranspose):
918 _weights_reshape = std::make_unique<CpuReshape>();
919 _weights_reshape->configure(weights->info(), &_weights_reshaped);
922 case (WeightTransformMethod::ReinterpretThenTranspose):
938 ITensorPack gemm_pack = tensors;
940 CpuAuxTensorHandler reinterpreted_wei(
943 CpuAuxTensorHandler reshaped_wei(
offset_int_vec(WeightsReshaped), _weights_reshaped, tensors);
949 case (WeightTransformMethod::FusedReshapeAndTranspose):
953 _weights_reshape_and_transpose_kernel->window(),
pack);
954 weights->mark_as_unused();
958 case (WeightTransformMethod::ReshapeThenTranspose):
961 _weights_reshape->run(
pack);
962 weights->mark_as_unused();
966 case (WeightTransformMethod::ReinterpretThenTranspose):
978 _is_quantized ? _mm_gemmlowp->prepare(gemm_pack) : _mm_gemm->prepare(gemm_pack);
References arm_compute::ACL_DST, arm_compute::ACL_SRC, arm_compute::ACL_SRC_1, ITensorPack::add_const_tensor(), ARM_COMPUTE_ERROR, ARM_COMPUTE_LOG_INFO_WITH_FUNCNAME_ACL, Window::DimW, 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().
◆ run()
Run the kernels contained in the function.
- Parameters
-
[in] | tensors | Vector that contains the tensors to operate on. |
Reimplemented from INEOperator.
Definition at line 797 of file CpuGemmConv2d.cpp.
803 auto gemm_input_to_use =
src;
805 CpuAuxTensorHandler im2col_output(
offset_int_vec(Im2ColOutput), _im2col_output, tensors,
false);
806 CpuAuxTensorHandler gemm_output(
offset_int_vec(GemmOutput), _gemm_output, tensors,
false);
808 bool out_has_padding = _skip_col2im && (
dst->info()->padding().bottom != 0 ||
dst->info()->padding().top != 0);
814 unsigned int hint_dim_iterations = _im2col_kernel->window().num_iterations(hint_dim);
815 unsigned int x_dim_iterations = _im2col_kernel->window().num_iterations(x_dim);
816 if (hint_dim_iterations <
NEScheduler::get().num_threads() && x_dim_iterations > hint_dim_iterations)
822 gemm_input_to_use = im2col_output.get();
826 const ITensor *out_to_use = out_has_padding ? gemm_output.get() :
dst;
829 gemm3d.allocator()->soft_init(_gemm_output_3d);
830 gemm3d.allocator()->import_memory(out_to_use->buffer());
831 auto gemm_output_to_use = gemm_output.get();
835 gemm_output_to_use = &gemm3d;
837 if (_skip_col2im && !out_has_padding)
839 gemm_output_to_use =
dst;
842 ITensorPack gemm_pack = tensors;
849 const bool use_reinterpreted_wei = (_run_wt && _wt_method == WeightTransformMethod::ReinterpretThenTranspose);
850 CpuAuxTensorHandler reinterpreted_wei(
851 _weights_reshaped, *weights,
853 !use_reinterpreted_wei);
855 const bool use_reshaped_wei = (_run_wt && (_wt_method == WeightTransformMethod::ReshapeThenTranspose ||
856 _wt_method == WeightTransformMethod::FusedReshapeAndTranspose));
857 CpuAuxTensorHandler reshaped_wei(
offset_int_vec(WeightsReshaped), _weights_reshaped, tensors,
858 false , !use_reshaped_wei ,
862 if (use_reinterpreted_wei)
866 else if (use_reshaped_wei)
872 _is_quantized ? _mm_gemmlowp->run(gemm_pack) : _mm_gemm->run(gemm_pack);
888 else if (out_has_padding)
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(), ARM_COMPUTE_ERROR_ON_NULLPTR, 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 arm_compute::WIDTH.
◆ validate()
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 |
Static function to check if given info will lead to a valid configuration.
Similar to CpuGemmConvolution::configure()
- Returns
- a status
Definition at line 646 of file CpuGemmConv2d.cpp.
679 const unsigned int kernel_width = weights->dimension(
idx_width);
680 const unsigned int kernel_height = weights->dimension(
idx_height);
682 TensorInfo im2col_reshaped_info{};
683 TensorInfo info_gemm{};
684 TensorInfo tmp_info{};
685 TensorInfo weights_reshaped_info{};
686 const ITensorInfo *gemm_input_to_use =
src;
687 const ITensorInfo *gemm_output_to_use =
dst;
688 const ITensorInfo *weights_to_use = weights;
690 const bool append_bias =
false;
695 unsigned int conv_w = 0;
696 unsigned int conv_h = 0;
702 const CpuGemmConv2d::SkipInfo skip_info =
704 const bool skip_im2col = skip_info.skip_im2col, skip_col2im = skip_info.skip_col2im;
710 if (biases !=
nullptr)
728 unsigned int mat_weights_cols = weights->dimension(idx_kernels);
729 unsigned int mat_weights_rows =
730 weights->dimension(
idx_width) * weights->dimension(
idx_height) * weights->dimension(idx_channel);
733 initialize_reshaped_weight_info(*weights, weights_reshaped_info);
736 weights_to_use = &weights_reshaped_info;
741 int input_pad_right = 0;
747 (weights->dimension(idx_channel) + input_pad_right);
752 TensorShape shape_im2col =
src->tensor_shape();
753 shape_im2col.set(0, mat_weights_rows);
754 shape_im2col.set(1, conv_w * conv_h);
755 shape_im2col.set(2, 1);
757 im2col_reshaped_info = TensorInfo(shape_im2col, 1,
data_type);
758 im2col_reshaped_info.set_quantization_info(
src->quantization_info());
762 gemm_input_to_use = &im2col_reshaped_info;
769 TensorShape shape_gemm = gemm_input_to_use->tensor_shape();
770 shape_gemm.set(0, mat_weights_cols);
771 shape_gemm.set(1, conv_w * conv_h);
772 info_gemm = TensorInfo(shape_gemm, 1, output_data_type);
776 info_gemm = TensorInfo(
dst->tensor_shape(), 1, output_data_type);
778 info_gemm.set_quantization_info(
dst->quantization_info()).set_data_layout(
src->data_layout());
779 gemm_output_to_use = &info_gemm;
784 enable_fast_math, skip_col2im ? conv_h : 0, skip_im2col, fixed_format,
References arm_compute::test::validation::act_info, 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::test::validation::conv_info, arm_compute::cpu::data_layout, arm_compute::test::validation::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::test::validation::idx_height, arm_compute::test::validation::idx_width, arm_compute::is_data_type_quantized_asymmetric(), arm_compute::is_fixed_format(), arm_compute::NCHW, ITensorInfo::num_dimensions(), arm_compute::test::validation::num_groups, arm_compute::QASYMM8, arm_compute::QASYMM8_SIGNED, arm_compute::QSYMM8_PER_CHANNEL, arm_compute::S32, arm_compute::scaled_dimensions(), TensorShape::set(), arm_compute::test::validation::src, ITensorInfo::tensor_shape(), arm_compute::UNSPECIFIED, CpuCol2ImKernel::validate(), CpuIm2ColKernel::validate(), arm_compute::test::validation::weights_info, and arm_compute::WIDTH.
Referenced by CpuGemmConv2d::configure(), CpuConv2d::validate(), and NEGEMMConvolutionLayer::validate().
◆ workspace()
The documentation for this class was generated from the following files:
@ NCHW
Num samples, channels, height, width.
@ QSYMM8_PER_CHANNEL
quantized, symmetric per channel fixed-point 8-bit number
#define ARM_COMPUTE_LOG_INFO_WITH_FUNCNAME_ACL(msg)
SimpleTensor< float > src
@ BFLOAT16
16-bit brain floating-point number
DataLayout
[DataLayout enum definition]
@ NHWC
Num samples, height, width, channels.
@ QASYMM8
quantized, asymmetric fixed-point 8-bit number unsigned
virtual void schedule_op(ICPPKernel *kernel, const Hints &hints, const Window &window, ITensorPack &tensors)=0
Runs the kernel in the same thread as the caller synchronously.
bool extend_padding(const PaddingSize &padding) override
Update the offset to the first element, the strides and the total size.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
std::pair< unsigned int, unsigned int > scaled_dimensions(int width, int height, int kernel_width, int kernel_height, const PadStrideInfo &pad_stride_info, const Size2D &dilation=Size2D(1U, 1U))
Returns expected width and height of output scaled tensor depending on dimensions rounding mode.
size_t dimension(size_t index) const override
Return the size of the requested dimension.
ITensorInfo & set_data_type(DataType data_type) override
Set the data type to the specified value.
static Status validate(const ITensorInfo *src, const ITensorInfo *dst, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias, const Size2D &dilation=Size2D(1U, 1U), unsigned int num_groups=1, unsigned int input_pad_right=0)
Static function to check if given info will lead to a valid configuration.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
constexpr auto data_layout
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
int block_by(const WeightFormat wf)
ITensorInfo & set_quantization_info(const QuantizationInfo &quantization_info) override
Set the quantization settings (scale and offset) of the tensor.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
size_t total_size() const override
Returns the total size of the tensor in bytes.
static IScheduler & get()
Access the scheduler singleton.
@ QASYMM8_SIGNED
quantized, asymmetric fixed-point 8-bit number signed
static constexpr size_t DimW
Alias for dimension 3 also known as W dimension.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(...)
bool is_fixed_format(const WeightFormat &wf)
virtual ITensorInfo & set_is_resizable(bool is_resizable)=0
Set the flag whether the tensor size can be changed.
static Status validate(const ITensorInfo *src, const ITensorInfo *dst, const Size2D &convolved_dims)
Static function to check if given info will lead to a valid configuration.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
size_t get_data_layout_dimension_index(const DataLayout &data_layout, const DataLayoutDimension &data_layout_dimension)
Get the index of the given dimension.
int offset_int_vec(int offset)
const unsigned int num_groups
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
@ F16
16-bit floating-point number
@ S32
signed 32-bit number
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
virtual ITensorInfo & set_data_layout(const DataLayout &data_layout)=0
Set the data layout of the tensor.
@ F32
32-bit floating-point number
void prepare(ITensorPack &tensors) override
Prepare the function for executing.
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
#define ARM_COMPUTE_LOG_PARAMS(...)
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.
DataType
Available data types.
const TensorShape & tensor_shape() const override
Size for each dimension of the tensor.
static Status has_opt_impl(arm_compute::WeightFormat &weight_format, const ITensorInfo *a, const ITensorInfo *b, const ITensorInfo *c, const ITensorInfo *d, const GEMMInfo &gemm_info=GEMMInfo())
Indicates whether or not there is an optimal assembly implementation that can be used to process the ...