Compute Library
 22.02
NEDepthConvertLayer Class Reference

Basic function to run cpu::kernels::CpuCastKernel. More...

#include <NEDepthConvertLayer.h>

Collaboration diagram for NEDepthConvertLayer:
[legend]

Public Member Functions

 NEDepthConvertLayer ()
 Constructor. More...
 
 ~NEDepthConvertLayer ()
 Destructor. More...
 
 NEDepthConvertLayer (const NEDepthConvertLayer &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEDepthConvertLayer (NEDepthConvertLayer &&)
 Default move constructor. More...
 
NEDepthConvertLayeroperator= (const NEDepthConvertLayer &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEDepthConvertLayeroperator= (NEDepthConvertLayer &&)
 Default move assignment operator. More...
 
void configure (const ITensor *input, ITensor *output, ConvertPolicy policy, uint32_t shift=0)
 Initialize the function's source, destination. 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 *output, ConvertPolicy policy, uint32_t shift=0)
 Static function to check if given info will lead to a valid configuration of NEDepthConvertLayer. More...
 

Detailed Description

Basic function to run cpu::kernels::CpuCastKernel.

Definition at line 39 of file NEDepthConvertLayer.h.

Constructor & Destructor Documentation

◆ NEDepthConvertLayer() [1/3]

Constructor.

Definition at line 40 of file NEDepthConvertLayer.cpp.

References NEDepthConvertLayer::operator=(), and NEDepthConvertLayer::~NEDepthConvertLayer().

41  : _impl(std::make_unique<Impl>())
42 {
43 }

◆ ~NEDepthConvertLayer()

~NEDepthConvertLayer ( )
default

Destructor.

Referenced by NEDepthConvertLayer::NEDepthConvertLayer().

◆ NEDepthConvertLayer() [2/3]

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

◆ NEDepthConvertLayer() [3/3]

Default move constructor.

Member Function Documentation

◆ configure()

void configure ( const ITensor input,
ITensor output,
ConvertPolicy  policy,
uint32_t  shift = 0 
)

Initialize the function's source, destination.

Valid data layouts:

  • All

Valid data type configurations:

src dst
QASYMM8 F16, F32
U8 U16, S16, S32
U16 U8, U32
S16 U8, S32
BFLOAT16 F32
F16 QASYMM8, F32
F32 QASYMM8, F16, BFLOAT16

Input data type must be different than output data type.

Parameters
[in]inputThe input tensor to convert. Data types supported: QASYMM8/U8/U16/S16/BFLOAT16/F16/F32.
[out]outputThe output tensor. Data types supported: QASYMM8/U8/U16/S16/U32/S32/BFLOAT16/F16/F32.
[in]policyConversion policy.
[in]shift(Optional) Value for down/up conversions. Must be 0 <= shift < 8.

Definition at line 48 of file NEDepthConvertLayer.cpp.

References ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_UNUSED, and arm_compute::test::validation::input.

49 {
50  ARM_COMPUTE_UNUSED(shift);
51 
52  _impl->src = input;
53  _impl->dst = output;
54 
55  ARM_COMPUTE_ERROR_ON_NULLPTR(_impl->src, _impl->dst);
56  ARM_COMPUTE_ERROR_ON(shift != 0);
57 
58  _impl->op = std::make_unique<cpu::CpuCast>();
59  _impl->op->configure(_impl->src->info(), _impl->dst->info(), policy);
60 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:157

◆ operator=() [1/2]

NEDepthConvertLayer& operator= ( const NEDepthConvertLayer )
delete

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

Referenced by NEDepthConvertLayer::NEDepthConvertLayer().

◆ operator=() [2/2]

NEDepthConvertLayer & operator= ( NEDepthConvertLayer &&  )
default

Default move assignment operator.

◆ 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 68 of file NEDepthConvertLayer.cpp.

References arm_compute::ACL_DST, arm_compute::ACL_SRC, and arm_compute::test::validation::pack.

69 {
70  ITensorPack pack = { { ACL_SRC, _impl->src }, { ACL_DST, _impl->dst } };
71  _impl->op->run(pack);
72 }

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo output,
ConvertPolicy  policy,
uint32_t  shift = 0 
)
static

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

Parameters
[in]inputSource tensor info. Data types supported: QASYMM8/U8/U16/S16/BFLOAT16/F16/F32.
[in]outputDestination tensor info. Data type supported: QASYMM8/U8/U16/S16/U32/S32/BFLOAT16/F16/F32.
[in]policyConversion policy.
[in]shift(Optional) Value for down/up conversions. Must be 0 <= shift < 8.
Returns
a status

Definition at line 62 of file NEDepthConvertLayer.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON, and CpuCast::validate().

Referenced by arm_compute::test::validation::DATA_TEST_CASE().

63 {
64  ARM_COMPUTE_RETURN_ERROR_ON(shift != 0);
65  return cpu::CpuCast::validate(input, output, policy);
66 }
static Status validate(const ITensorInfo *src, const ITensorInfo *dst, ConvertPolicy policy)
Static function to check if given info will lead to a valid configuration.
Definition: CpuCast.cpp:42
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
Definition: Error.h:296

The documentation for this class was generated from the following files: