Compute Library
 21.02
NECopy Class Reference

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

#include <NECopy.h>

Collaboration diagram for NECopy:
[legend]

Public Member Functions

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

Detailed Description

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

Definition at line 39 of file NECopy.h.

Constructor & Destructor Documentation

◆ NECopy() [1/3]

NECopy ( )

Default Constructor.

Definition at line 40 of file NECopy.cpp.

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

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

◆ ~NECopy()

~NECopy ( )
default

Default Destructor.

Referenced by NECopy::NECopy().

◆ NECopy() [2/3]

NECopy ( const NECopy )
delete

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

◆ NECopy() [3/3]

NECopy ( NECopy &&  )
default

Default move constructor.

Member Function Documentation

◆ configure()

void configure ( ITensor input,
ITensor output 
)

Initialise the function's source and destination.

Parameters
[in]inputSource tensor. Data types supported: All
[out]outputOutput tensor. Data types supported: Same as input.

Definition at line 48 of file NECopy.cpp.

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

Referenced by NERNNLayer::configure(), NEPadLayer::configure(), NELSTMLayer::configure(), and NEQLSTMLayer::configure().

49 {
51 
52  _impl->src = input;
53  _impl->dst = output;
54  _impl->op = std::make_unique<cpu::CpuCopy>();
55  _impl->op->configure(input->info(), output->info());
56 }
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:161

◆ operator=() [1/2]

NECopy& operator= ( const NECopy )
delete

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

Referenced by NECopy::NECopy().

◆ operator=() [2/2]

NECopy & operator= ( NECopy &&  )
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 66 of file NECopy.cpp.

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

Referenced by NERNNLayer::run(), NEPadLayer::run(), NELSTMLayer::run(), and NEQLSTMLayer::run().

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

◆ validate()

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

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

Parameters
[in]inputSource tensor. Data types supported: All
[in]outputOutput tensor. Data types supported: Same as input.
Returns
a status

Definition at line 58 of file NECopy.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR, ARM_COMPUTE_RETURN_ON_ERROR, and CpuCopy::validate().

Referenced by arm_compute::test::validation::DATA_TEST_CASE(), NELSTMLayer::validate(), and NEQLSTMLayer::validate().

59 {
62 
63  return Status{};
64 }
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
Definition: Validate.h:163
static Status validate(const ITensorInfo *src, const ITensorInfo *dst)
Static function to check if given info will lead to a valid configuration of CpuCopy.
Definition: CpuCopy.cpp:39

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