Compute Library
 21.05
NEElementwiseUnaryLayer< op > Class Template Reference

Basic function to perform unary elementwise operations. More...

#include <NEElementwiseUnaryLayer.h>

Collaboration diagram for NEElementwiseUnaryLayer< op >:
[legend]

Public Member Functions

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

Detailed Description

template<ElementWiseUnary op>
class arm_compute::NEElementwiseUnaryLayer< op >

Basic function to perform unary elementwise operations.

Definition at line 39 of file NEElementwiseUnaryLayer.h.

Constructor & Destructor Documentation

◆ NEElementwiseUnaryLayer() [1/3]

Default Constructor.

Definition at line 41 of file NEElementwiseUnaryLayer.cpp.

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

◆ ~NEElementwiseUnaryLayer()

Default Destructor.

◆ NEElementwiseUnaryLayer() [2/3]

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

◆ NEElementwiseUnaryLayer() [3/3]

Default move constructor.

Member Function Documentation

◆ configure()

void configure ( const ITensor input,
ITensor output 
)

Initialize the function.

Valid data layouts:

  • All

Valid data type configurations:

src dst
F16 F16
F32 F32
S32 S32
Parameters
[in]inputInput tensor. Data types supported: F16/F32, F16/F32/S32 for NEG/ABS operations.
[out]outputOutput tensor. Data types supported: Same as input.

Definition at line 53 of file NEElementwiseUnaryLayer.cpp.

54 {
55  _impl->src = input;
56  _impl->dst = output;
57  _impl->cpu_op = std::make_unique<OperatorType>();
58  _impl->cpu_op->configure(op, *_impl->src->info(), *_impl->dst->info());
59 }

References arm_compute::test::validation::input.

◆ operator=() [1/2]

NEElementwiseUnaryLayer& operator= ( const NEElementwiseUnaryLayer< op > &  )
delete

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

◆ operator=() [2/2]

NEElementwiseUnaryLayer< op > & operator= ( NEElementwiseUnaryLayer< op > &&  )
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 NEElementwiseUnaryLayer.cpp.

69 {
70  ITensorPack pack;
71  pack.add_tensor(TensorType::ACL_SRC, _impl->src);
72  pack.add_tensor(TensorType::ACL_DST, _impl->dst);
73  _impl->cpu_op->run(pack);
74 }

References arm_compute::ACL_DST, arm_compute::ACL_SRC, and ITensorPack::add_tensor().

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo output 
)
static

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

Parameters
[in]inputInput tensor info. Data types supported: F16/F32, F16/F32/S32 for NEG/ABS operations.
[in]outputOutput tensor info. Data types supported: Same as input.
Returns
a status

Definition at line 62 of file NEElementwiseUnaryLayer.cpp.

63 {
64  return OperatorType::validate(op, *input, *output);
65 }
static Status validate(const ITensorInfo *input, const ITensorInfo *alpha, const ITensorInfo *output)
Static function to check if given info will lead to a valid configuration of arm_compute::opencl::ker...
Definition: ClPRelu.cpp:39

References arm_compute::test::validation::input, and ClPRelu::validate().


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