Compute Library
 24.07
NEConv3D Class Reference

Basic function to simulate a 3d convolution. More...

#include <NEConv3D.h>

Collaboration diagram for NEConv3D:
[legend]

Public Member Functions

 NEConv3D ()
 Constructor. More...
 
 NEConv3D (const NEConv3D &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEConv3Doperator= (const NEConv3D &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEConv3D (NEConv3D &&)=default
 Default move constructor. More...
 
NEConv3Doperator= (NEConv3D &&)=default
 Prevent instances of this class from being moved (As this class contains non movable objects) More...
 
 ~NEConv3D ()
 Default destructor. More...
 
void configure (ITensor *input, const ITensor *weights, const ITensor *biases, ITensor *output, const Conv3dInfo &conv_info)
 Set the input and output 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 *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const Conv3dInfo &conv_info)
 Static function to check if given info will lead to a valid configuration. More...
 

Detailed Description

Basic function to simulate a 3d convolution.

This function calls one of the following functions:

  1. cpu::CpuDirectConv3d

Definition at line 43 of file NEConv3D.h.

Constructor & Destructor Documentation

◆ NEConv3D() [1/3]

NEConv3D ( )

Constructor.

Definition at line 43 of file NEConv3D.cpp.

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

◆ NEConv3D() [2/3]

NEConv3D ( const NEConv3D )
delete

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

◆ NEConv3D() [3/3]

NEConv3D ( NEConv3D &&  )
default

Default move constructor.

◆ ~NEConv3D()

~NEConv3D ( )
default

Default destructor.

Member Function Documentation

◆ configure()

void configure ( ITensor input,
const ITensor weights,
const ITensor biases,
ITensor output,
const Conv3dInfo conv_info 
)

Set the input and output 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]inputSource tensor. 4 lower dimensions represent a single input [IFM, width, height, depth], while every optional dimension from 5 and above represent a batch of inputs.
[in]weightsWeights tensor. Weights are 5D tensor with dimensions [OFM, IFM, kernel_x, kernel_y, kernel_z].
[in]biasesBiases tensor. Shared biases supported. Biases are 1D tensor with dimensions [OFM].
[out]outputDestination tensor. 4 lower dimensions represent a single output [OFM, width, height, depth], while the rest represent batch of outputs.
[in]conv_infoContains padding, stride, acitvation information described in Conv3dInfo.

Definition at line 49 of file NEConv3D.cpp.

51 {
52  // Perform validate step
53  ARM_COMPUTE_ERROR_ON_NULLPTR(input, weights, output);
55  input->info(), weights->info(), ((biases != nullptr) ? biases->info() : nullptr), output->info(), conv_info));
56  ARM_COMPUTE_LOG_PARAMS(input, weights, biases, output, conv_info);
57 
58  auto f = std::make_unique<cpu::CpuDirectConv3d>();
59  f->configure(input->info(), weights->info(), ((biases != nullptr) ? biases->info() : nullptr), output->info(),
60  conv_info);
61  _impl->op = std::move(f);
62 
63  if (_impl->op != nullptr)
64  {
65  _impl->run_pack = {{ACL_SRC_0, input}, {ACL_SRC_1, weights}, {ACL_SRC_2, biases}, {ACL_DST, output}};
66  }
67 }

References arm_compute::ACL_DST, arm_compute::ACL_SRC_0, arm_compute::ACL_SRC_1, arm_compute::ACL_SRC_2, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, ARM_COMPUTE_LOG_PARAMS, arm_compute::test::validation::conv_info, ITensor::info(), arm_compute::test::validation::input, and CpuDirectConv3d::validate().

◆ operator=() [1/2]

NEConv3D& operator= ( const NEConv3D )
delete

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

◆ operator=() [2/2]

NEConv3D& operator= ( NEConv3D &&  )
default

Prevent instances of this class from being moved (As this class contains non movable objects)

◆ 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 80 of file NEConv3D.cpp.

81 {
82  if (_impl->op != nullptr)
83  {
84  _impl->op->run(_impl->run_pack);
85  }
86 }

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo weights,
const ITensorInfo biases,
const ITensorInfo output,
const Conv3dInfo conv_info 
)
static

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

Similar to NEConv3D::configure()

Returns
a status

Definition at line 69 of file NEConv3D.cpp.

74 {
76 
77  return Status{};
78 }

References ARM_COMPUTE_RETURN_ON_ERROR, arm_compute::test::validation::conv_info, arm_compute::test::validation::input, and CpuDirectConv3d::validate().


The documentation for this class was generated from the following files:
arm_compute::cpu::CpuDirectConv3d::validate
static Status validate(const ITensorInfo *src0, const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst, const Conv3dInfo conv_info)
Static function to check if given info will lead to a valid configuration.
Definition: CpuDirectConv3d.cpp:76
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::ACL_SRC_2
@ ACL_SRC_2
Definition: Types.h:47
ARM_COMPUTE_RETURN_ON_ERROR
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:205
ARM_COMPUTE_ERROR_ON_NULLPTR
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:159
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::test::validation::conv_info
conv_info
Definition: DirectConvolutionLayer.cpp:547
ARM_COMPUTE_LOG_PARAMS
#define ARM_COMPUTE_LOG_PARAMS(...)
Definition: Log.h:35
arm_compute::test::validation::input
auto input
Definition: LSTMLayerQuantized.cpp:486