Compute Library
 21.02
NEPReluLayer Class Reference

Basic function to run cpu::kernels::CpuArithmeticKernel for PRELU. More...

#include <NEPReluLayer.h>

Collaboration diagram for NEPReluLayer:
[legend]

Public Member Functions

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

Detailed Description

Basic function to run cpu::kernels::CpuArithmeticKernel for PRELU.

Note
The function implements an activation layer with the PRELU activation function.

Definition at line 68 of file NEPReluLayer.h.

Constructor & Destructor Documentation

◆ NEPReluLayer() [1/3]

Default Constructor.

Definition at line 54 of file NEPReluLayer.cpp.

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

55  : _impl(std::make_unique<Impl>())
56 {
57 }

◆ ~NEPReluLayer()

~NEPReluLayer ( )
default

Default Destructor.

Referenced by NEPReluLayer::NEPReluLayer().

◆ NEPReluLayer() [2/3]

NEPReluLayer ( const NEPReluLayer )
delete

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

◆ NEPReluLayer() [3/3]

NEPReluLayer ( NEPReluLayer &&  )
default

Default move constructor.

Member Function Documentation

◆ configure()

void configure ( const ITensor input,
const ITensor alpha,
ITensor output 
)

Set the input and output tensor.

Parameters
[in]inputSource tensor. Data types supported: QASYMM8/QASYMM8_SIGNED/F16/F32.
[in]alphaSource alpha tensor. Data types supported: same of input.
[out]outputDestination tensor. Data type supported: same as input

Definition at line 62 of file NEPReluLayer.cpp.

References ITensor::info(), and arm_compute::test::validation::input.

63 {
64  _impl->src_0 = input;
65  _impl->src_1 = alpha;
66  _impl->dst = output;
67  _impl->op = std::make_unique<experimental::NEPRelu>();
68  _impl->op->configure(input->info(), alpha->info(), output->info());
69 }

◆ operator=() [1/2]

NEPReluLayer& operator= ( const NEPReluLayer )
delete

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

Referenced by NEPReluLayer::NEPReluLayer().

◆ operator=() [2/2]

NEPReluLayer & operator= ( NEPReluLayer &&  )
default

Default move assignment operator.

◆ run()

void run ( )
overridevirtual

Run the kernels contained in the function.

For Neon 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 71 of file NEPReluLayer.cpp.

References arm_compute::ACL_DST, arm_compute::ACL_SRC_0, arm_compute::ACL_SRC_1, and ITensorPack::add_tensor().

72 {
73  ITensorPack pack;
74  pack.add_tensor(TensorType::ACL_SRC_0, _impl->src_0);
75  pack.add_tensor(TensorType::ACL_SRC_1, _impl->src_1);
76  pack.add_tensor(TensorType::ACL_DST, _impl->dst);
77  _impl->op->run(pack);
78 }

◆ validate()

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

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

Parameters
[in]inputSource tensor info. Data types supported: QASYMM8/QASYMM8_SIGNED/F16/F32.
[in]alphaSource alpha tensor info. Data types supported: same of input.
[in]outputDestination tensor info. Data type supported: same as input
Returns
a status

Definition at line 80 of file NEPReluLayer.cpp.

References NEPRelu::validate().

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

81 {
82  return experimental::NEPRelu::validate(input, alpha, output);
83 }
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 cpu::kernels::CpuCompari...

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