40 struct CLConvolutionLayer::Impl
42 MemoryGroup memory_group{};
43 std::shared_ptr<IMemoryManager> memory_manager{};
44 std::unique_ptr<opencl::IClOperator> op{
nullptr };
45 ITensorPack run_pack{};
46 ITensorPack prep_pack{};
47 WorkspaceData<CLTensor> workspace{};
49 std::unique_ptr<IFunction> func{
nullptr };
53 : _impl(
std::make_unique<Impl>())
55 _impl->memory_manager = std::move(memory_manager);
63 configure(
CLKernelLibrary::get().get_compile_context(), input, weights, biases, output, conv_info, weights_info, dilation, act_info, enable_fast_math, num_groups);
74 const Conv2dInfo conv2d_info =
Conv2dInfo(conv_info, dilation, act_info, enable_fast_math, num_groups);
83 auto f = std::make_unique<opencl::ClConv2d>();
84 f->configure(compile_context, input->
info(), weights->
info(), ((biases !=
nullptr) ? biases->
info() :
nullptr), output->
info(), conv2d_info,
weights_info);
85 _impl->op = std::move(f);
90 auto f = std::make_unique<CLFFTConvolutionLayer>(_impl->memory_manager);
91 f->configure(compile_context, input, weights, biases, output, conv_info, act_info, enable_fast_math);
92 _impl->func = std::move(f);
102 _impl->memory_group =
MemoryGroup(std::move(_impl->memory_manager));
103 _impl->aux_mem_req = _impl->op->workspace();
106 _impl->workspace = manage_workspace<CLTensor>(_impl->aux_mem_req, _impl->memory_group, _impl->run_pack, _impl->prep_pack);
117 const Conv2dInfo conv2d_info =
Conv2dInfo(conv_info, dilation, act_info, enable_fast_math, num_groups);
161 _impl->op->run(_impl->run_pack);
169 _impl->func->prepare();
173 _impl->op->prepare(_impl->prep_pack);
void run() override
Run the kernels contained in the function.
CLConvolutionLayer(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Default constructor.
void configure(ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *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.
static CLScheduler & get()
Access the scheduler singleton.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
GPUTarget target() const
Get the target GPU.
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
~CLConvolutionLayer()
Default Destructor.
void prepare() override
Prepare the function for executing.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
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 CLFFTConvolutionLayer.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Manages all the OpenCL kernels compilation and caching, provides accessors for the OpenCL Context...
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 CLConvolutionLayer.
ConvolutionMethod
Available ConvolutionMethod.
Activation Layer Information class.
Copyright (c) 2017-2021 Arm Limited.
std::vector< MemoryInfo > MemoryRequirements
Convolution Layer Weights Information class.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
const unsigned int num_groups
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
Padding and stride information class.
void release_temporaries(const experimental::MemoryRequirements &mem_reqs, WorkspaceData< TensorType > &workspace)
Utility function to release tensors with lifetime marked as Prepare.
Descriptor used by the Convolution function.
Num samples, channels, height, width.
Convolution using Winograd.
Memory group resources scope handling class.
Interface for OpenCL tensor.
static ConvolutionMethod get_convolution_method(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *dst, const Conv2dInfo &conv2d_info, const WeightsInfo &weights_info, const GPUTarget gpu_target)
Static function to check if given info will return the convolution called by ClConv2d.
GPUTarget
Available GPU Targets.
Class for specifying the size of an image or rectangle.
static ConvolutionMethod get_convolution_method(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *output, const PadStrideInfo &conv_info, const WeightsInfo &weights_info, const ActivationLayerInfo &act_info, const GPUTarget gpu_target, const Size2D &dilation=Size2D(1U, 1U), bool enable_fast_math=false)
Static function to check if given info will return the convolution called by CLConvolutionLayer.
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
static Status validate(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *dst, const Conv2dInfo &conv2d_info, const WeightsInfo &weights_info=WeightsInfo())
Static function to check if given info will lead to a valid configuration of ClConv2d.
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.