23.11
|
Go to the documentation of this file.
44 struct NEConvolutionLayer::Impl
46 MemoryGroup memory_group{};
47 std::shared_ptr<IMemoryManager> memory_manager{};
48 std::unique_ptr<cpu::ICpuOperator> op{
nullptr};
49 ITensorPack run_pack{};
50 ITensorPack prep_pack{};
51 WorkspaceData<Tensor> workspace{};
53 std::unique_ptr<IFunction> func{
nullptr};
58 _impl->memory_manager = std::move(memory_manager);
71 bool enable_fast_math,
92 auto f = std::make_unique<cpu::CpuConv2d>();
93 f->configure(
input->info(), weights->
info(), ((biases !=
nullptr) ? biases->
info() :
nullptr),
95 _impl->op = std::move(f);
100 auto f = std::make_unique<NEFFTConvolutionLayer>(_impl->memory_manager);
102 _impl->func = std::move(f);
112 _impl->memory_group =
MemoryGroup(std::move(_impl->memory_manager));
113 _impl->aux_mem_req = _impl->op->workspace();
117 manage_workspace<Tensor>(_impl->aux_mem_req, _impl->memory_group, _impl->run_pack, _impl->prep_pack);
129 bool enable_fast_math,
140 "Dynamic Biases are not supported with quantized input data.");
172 bool enable_fast_math)
190 _impl->op->run(_impl->run_pack);
198 _impl->func->prepare();
202 _impl->op->prepare(_impl->prep_pack);
205 release_temporaries<Tensor>(_impl->aux_mem_req, _impl->workspace);
std::vector< MemoryInfo > MemoryRequirements
void configure(ITensor *input, const ITensor *weights, const ITensor *biases, ITensor *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)
Set the input and output tensors.
Convolution Layer Weights Information class.
@ FFT
Convolution using FFT.
~NEConvolutionLayer()
Default destructor.
void prepare() override
Prepare the function for executing.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Class for specifying the size of an image or rectangle.
Interface for CPU tensor.
Descriptor used by the 2d Convolution function.
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
ConvolutionMethod
Available ConvolutionMethod.
Activation Layer Information class.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
static ConvolutionMethod get_convolution_method(const ITensorInfo *src, const ITensorInfo *weights, const 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)
Static function to check if given info will return the convolution called by CpuConv2d.
@ WINOGRAD
Convolution using Winograd.
@ GEMM_CONV2D
Direct 2D GEMM convolution.
@ GEMM
Convolution using GEMM.
static ConvolutionMethod get_convolution_method(const ITensorInfo *input, const ITensorInfo *weights, 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)
Static function to check if given info will return the convolution called by NEConvolutionLayer.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
@ DIRECT
Direct convolution.
const unsigned int num_groups
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
Memory group resources scope handling class.
Copyright (c) 2017-2023 Arm Limited.
void run() override
Run the kernels contained in the function.
NEConvolutionLayer(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Constructor.
bool is_data_type_quantized(DataType dt)
Check if a given data type is of quantized type.
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 NEFFTConvolutionLayer.
virtual bool are_values_constant() const =0
Flag indicating whether the values of the tensor are constant, meaning that they can change on kernel...
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
#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 of CpuConv2d.
static Status validate(const ITensorInfo *input, 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 of NEConvolutionLayer.