38 : _memory_group(
std::move(memory_manager)), _output_stage_kernel(), _conv_kernel(), _input_border_handler(), _activationlayer_function(), _accumulator(), _has_bias(false),
39 _is_activationlayer_enabled(false), _dim_split(
Window::DimZ), _is_padding_required()
46 _output_stage_kernel = std::make_unique<kernels::CpuDirectConv2dOutputStageKernel>();
47 _conv_kernel = std::make_unique<kernels::CpuDirectConv2dKernel>();
48 _input_border_handler = std::make_unique<NEFillBorderKernel>();
51 if(_accumulator.
buffer() !=
nullptr)
59 _has_bias = (bias !=
nullptr);
61 _conv_kernel->configure(src, weights, dst, conv_info);
64 _output_stage_kernel->configure(dst, bias);
66 _is_padding_required = !_conv_kernel->border_size().empty();
68 if(_is_padding_required)
75 _is_activationlayer_enabled = act_info.
enabled();
76 if(_is_activationlayer_enabled)
78 _activationlayer_function = std::make_unique<CpuActivation>();
79 _activationlayer_function->configure(dst, dst, act_info);
90 TensorInfo accumulator(dst->
clone()->set_is_resizable(
true).reset_padding().set_data_type(data_type));
99 "Biases size and number of input feature maps should match");
122 if(_is_padding_required)
138 if(_is_activationlayer_enabled)
143 _activationlayer_function->run(pack);
CpuDirectConv2d(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
virtual size_t num_dimensions() const =0
The number of dimensions of the tensor (rank)
Class describing the value of a pixel for any image format.
static Status validate(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *bias, 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.
bool enabled() const
Check if initialised.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
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.
void configure(ITensorInfo *src, ITensorInfo *weights, const ITensorInfo *bias, ITensorInfo *dst, const PadStrideInfo &conv_info, const ActivationLayerInfo &act_info=ActivationLayerInfo())
Set the input, weights, biases and output tensors.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Store the tensor's metadata.
Activation Layer Information class.
static Status validate(const ITensorInfo *src, const ITensorInfo *bias=nullptr, const ITensorInfo *dst=nullptr, const DirectConvolutionLayerOutputStageKernelInfo &info=DirectConvolutionLayerOutputStageKernelInfo())
Static function to check if given info will lead to a valid configuration.
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
TensorAllocator * allocator()
Return a pointer to the tensor's allocator.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
virtual std::unique_ptr< T > clone() const =0
Provide a clone of the current object of class T.
Padding and stride information class.
void free() override
Free allocated CPU memory.
Num samples, channels, height, width.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
ITensor * get_tensor(int id)
Get tensor of a given id from the pac.
Memory group resources scope handling class.
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const ActivationLayerInfo &act_info)
Static function to check if given info will lead to a valid configuration.
static Status validate(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *dst, const PadStrideInfo &conv_info)
Static function to check if given info will lead to a valid configuration.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
uint8_t * buffer() const override
Interface to be implemented by the child class to return a pointer to CPU memory. ...
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
Store the tensor's metadata.
DataType
Available data types.
void run(ITensorPack &tensors) override
Run the kernels contained in the function.
Describe a multidimensional execution window.
void add_tensor(int id, ITensor *tensor)
Add tensor to the pack.
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.
static IScheduler & get()
Access the scheduler singleton.