23.11
|
Go to the documentation of this file.
42 struct CLConvolutionLayer::Impl
44 MemoryGroup memory_group{};
45 std::shared_ptr<IMemoryManager> memory_manager{};
46 std::unique_ptr<opencl::IClOperator> op{
nullptr};
47 ITensorPack run_pack{};
48 ITensorPack prep_pack{};
49 WorkspaceData<CLTensor> workspace{};
51 std::unique_ptr<IFunction> func{
nullptr};
56 _impl->memory_manager = std::move(memory_manager);
69 bool enable_fast_math,
85 bool enable_fast_math,
105 auto f = std::make_unique<opencl::ClConv2d>();
106 f->configure(compile_context,
input->info(), weights->
info(),
108 _impl->op = std::move(f);
113 auto f = std::make_unique<CLFFTConvolutionLayer>(_impl->memory_manager);
115 _impl->func = std::move(f);
125 _impl->memory_group =
MemoryGroup(std::move(_impl->memory_manager));
126 _impl->aux_mem_req = _impl->op->workspace();
130 manage_workspace<CLTensor>(_impl->aux_mem_req, _impl->memory_group, _impl->run_pack, _impl->prep_pack);
142 bool enable_fast_math,
148 "Grouping (num_groups != 1) with NHWC data layout is not supported");
187 bool enable_fast_math)
205 _impl->op->run(_impl->run_pack);
213 _impl->func->prepare();
217 _impl->op->prepare(_impl->prep_pack);
@ NCHW
Num samples, channels, height, width.
std::vector< MemoryInfo > MemoryRequirements
Convolution Layer Weights Information class.
@ FFT
Convolution using FFT.
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.
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.
CLConvolutionLayer(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Default constructor.
@ INDIRECT
Indirect convolution.
Interface for OpenCL tensor.
#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.
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.
void prepare() override
Prepare the function for executing.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
Manages all the OpenCL kernels compilation and caching, provides accessors for the OpenCL Context.
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(...)
void run() override
Run the kernels contained in the function.
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)
void release_temporaries(const experimental::MemoryRequirements &mem_reqs, WorkspaceData< TensorType > &workspace)
Utility function to release tensors with lifetime marked as Prepare.
~CLConvolutionLayer()
Default Destructor.
@ WINOGRAD
Convolution using Winograd.
@ GEMM
Convolution using GEMM.
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.
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.
@ DIRECT
Direct convolution.
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.
GPUTarget target() const
Get the target GPU.
GPUTarget
Available GPU Targets.
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.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
Store the tensor's metadata.
virtual bool are_values_constant() const =0
Flag indicating whether the values of the tensor are constant, meaning that they can change on kernel...
#define ARM_COMPUTE_LOG_PARAMS(...)