Compute Library
 24.07
CLConv3D Class Reference

Basic function to compute the convolution3d layer. More...

#include <CLConv3D.h>

Collaboration diagram for CLConv3D:
[legend]

Public Member Functions

 CLConv3D ()
 Construtor. More...
 
 ~CLConv3D ()
 Destructor. More...
 
 CLConv3D (const CLConv3D &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 CLConv3D (CLConv3D &&)=default
 Default move constructor. More...
 
CLConv3Doperator= (const CLConv3D &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
CLConv3Doperator= (CLConv3D &&)=default
 Default move assignment operator. More...
 
void configure (const CLCompileContext &compile_context, const ICLTensor *src, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *dst, const Conv3dInfo &conv3d_info)
 Set the src and dst tensors. More...
 
void configure (const ICLTensor *src, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *dst, const Conv3dInfo &conv3d_info)
 Set the src and dst tensors. More...
 
void run () override
 Run the kernels contained in the function. More...
 
- Public Member Functions inherited from IFunction
virtual ~IFunction ()=default
 Destructor. More...
 
virtual void prepare ()
 Prepare the function for executing. More...
 

Static Public Member Functions

static Status validate (const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *dst, const Conv3dInfo &conv3d_info)
 Static function to check if given info will lead to a valid configuration of CLConv3D. More...
 

Detailed Description

Basic function to compute the convolution3d layer.

This function calls the following OpenCL kernels/functions:

  1. opencl::ClDirectConv3d

Definition at line 43 of file CLConv3D.h.

Constructor & Destructor Documentation

◆ CLConv3D() [1/3]

CLConv3D ( )

Construtor.

Definition at line 43 of file CLConv3D.cpp.

43  : _impl(std::make_unique<Impl>())
44 {
45 }

◆ ~CLConv3D()

~CLConv3D ( )
default

Destructor.

◆ CLConv3D() [2/3]

CLConv3D ( const CLConv3D )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ CLConv3D() [3/3]

CLConv3D ( CLConv3D &&  )
default

Default move constructor.

Member Function Documentation

◆ configure() [1/2]

void configure ( const CLCompileContext compile_context,
const ICLTensor src,
const ICLTensor weights,
const ICLTensor biases,
ICLTensor dst,
const Conv3dInfo conv3d_info 
)

Set the src and dst tensors.

Valid data layouts:

  • NDHWC

Valid data type configurations:

src0 src1 src2 dst
F16 F16 F16 F16
F32 F32 F32 F32
QASYMM8 QASYMM8 S32 QASYMM8
QASYMM8_SIGNED QASYMM8_SIGNED S32 QASYMM8_SIGNED
Parameters
[in]compile_contextThe compile context to be used.
[in]srcSource tensor. 4 lower dimensions represent a single src [IFM, width, height, depth], while every optional dimension from 5 and above represent a batch of srcs.
[in]weightsWeights tensor. Weights are 5D tensor with dimensions [OFM, IFM, kernel_w, kernel_h, kernel_d].
[in]biasesBiases tensor. Shared biases supported. Biases are 1D tensor with dimensions [OFM].
[out]dstDestination tensor. 4 lower dimensions represent a single dst [OFM, width, height, depth], while the rest represent batch of dsts.
[in]conv3d_infoContains strides, padding, rounding, activation, dilation and fast math information. Activation and fast math are currently unused.

Definition at line 58 of file CLConv3D.cpp.

64 {
67  src->info(), weights->info(), ((biases != nullptr) ? biases->info() : nullptr), dst->info(), conv3d_info));
68 
69  _impl->src = src;
70  _impl->weights = weights;
71  _impl->biases = biases;
72  _impl->dst = dst;
73 
74  _impl->op = std::make_unique<opencl::ClDirectConv3d>();
75  _impl->op->configure(compile_context, _impl->src->info(), _impl->weights->info(),
76  _impl->biases ? _impl->biases->info() : nullptr, _impl->dst->info(), conv3d_info);
77 }

References ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, arm_compute::test::validation::dst, ITensor::info(), arm_compute::test::validation::src, and CLConv3D::validate().

Referenced by CLConv3D::configure().

◆ configure() [2/2]

void configure ( const ICLTensor src,
const ICLTensor weights,
const ICLTensor biases,
ICLTensor dst,
const Conv3dInfo conv3d_info 
)

Set the src and dst tensors.

Similar to CLConv3D::configure() but using the default compile context

Definition at line 49 of file CLConv3D.cpp.

54 {
55  configure(CLKernelLibrary::get().get_compile_context(), src, weights, biases, dst, conv3d_info);
56 }

References CLConv3D::configure(), arm_compute::test::validation::dst, CLKernelLibrary::get(), and arm_compute::test::validation::src.

◆ operator=() [1/2]

CLConv3D& operator= ( CLConv3D &&  )
default

Default move assignment operator.

◆ operator=() [2/2]

CLConv3D& operator= ( const CLConv3D )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ run()

void run ( )
overridevirtual

Run the kernels contained in the function.

For CPU kernels:

  • Multi-threading is used for the kernels which are parallelisable.
  • By default std::thread::hardware_concurrency() threads are used.
Note
CPPScheduler::set_num_threads() can be used to manually set the number of threads

For OpenCL kernels:

  • All the kernels are enqueued on the queue associated with CLScheduler.
  • The queue is then flushed.
Note
The function will not block until the kernels are executed. It is the user's responsibility to wait.
Will call prepare() on first run if hasn't been done

Implements IFunction.

Definition at line 88 of file CLConv3D.cpp.

89 {
90  ITensorPack pack;
92  pack.add_tensor(TensorType::ACL_SRC_1, _impl->weights);
93  pack.add_tensor(TensorType::ACL_SRC_2, _impl->biases);
94  pack.add_tensor(TensorType::ACL_DST, _impl->dst);
95  _impl->op->run(pack);
96 }

References arm_compute::ACL_DST, arm_compute::ACL_SRC_0, arm_compute::ACL_SRC_1, arm_compute::ACL_SRC_2, ITensorPack::add_tensor(), and arm_compute::test::validation::pack.

◆ validate()

Status validate ( const ITensorInfo src,
const ITensorInfo weights,
const ITensorInfo biases,
const ITensorInfo dst,
const Conv3dInfo conv3d_info 
)
static

Static function to check if given info will lead to a valid configuration of CLConv3D.

Similar to CLConv3D::configure()

Returns
a status

Definition at line 79 of file CLConv3D.cpp.

84 {
85  return opencl::ClDirectConv3d::validate(src, weights, biases, dst, conv3d_info);
86 }

References arm_compute::test::validation::dst, arm_compute::test::validation::src, and ClDirectConv3d::validate().

Referenced by CLConv3D::configure().


The documentation for this class was generated from the following files:
arm_compute::test::validation::src
SimpleTensor< float > src
Definition: DFT.cpp:155
arm_compute::test::validation::dst
auto dst
Definition: DFT.cpp:170
arm_compute::ITensorPack::add_tensor
void add_tensor(int id, ITensor *tensor)
Add tensor to the pack.
Definition: ITensorPack.cpp:38
arm_compute::opencl::ClDirectConv3d::validate
static Status validate(const ITensorInfo *src0, const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst, const Conv3dInfo &conv3d_info)
Static function to check if given info will lead to a valid configuration.
Definition: ClDirectConv3d.cpp:49
arm_compute::ACL_SRC_0
@ ACL_SRC_0
Definition: Types.h:45
arm_compute::ACL_SRC_1
@ ACL_SRC_1
Definition: Types.h:46
arm_compute::CLKernelLibrary::get
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
Definition: CLKernelLibrary.cpp:41
arm_compute::ACL_SRC_2
@ ACL_SRC_2
Definition: Types.h:47
ARM_COMPUTE_ERROR_ON_NULLPTR
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:159
arm_compute::CLConv3D::validate
static Status validate(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *dst, const Conv3dInfo &conv3d_info)
Static function to check if given info will lead to a valid configuration of CLConv3D.
Definition: CLConv3D.cpp:79
ARM_COMPUTE_ERROR_THROW_ON
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:455
arm_compute::ACL_DST
@ ACL_DST
Definition: Types.h:55
arm_compute::CLConv3D::configure
void configure(const CLCompileContext &compile_context, const ICLTensor *src, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *dst, const Conv3dInfo &conv3d_info)
Set the src and dst tensors.
Definition: CLConv3D.cpp:58
arm_compute::test::validation::pack
ITensorPack pack
Definition: Im2Col.cpp:204