Compute Library
 21.02
NEReshapeLayer Class Reference

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

#include <NEReshapeLayer.h>

Collaboration diagram for NEReshapeLayer:
[legend]

Public Member Functions

 NEReshapeLayer ()
 Default Constructor. More...
 
 ~NEReshapeLayer ()
 Default Destructor. More...
 
 NEReshapeLayer (const NEReshapeLayer &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEReshapeLayer (NEReshapeLayer &&)
 Default move constructor. More...
 
NEReshapeLayeroperator= (const NEReshapeLayer &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEReshapeLayeroperator= (NEReshapeLayer &&)
 Default move assignment operator. More...
 
void configure (const ITensor *input, ITensor *output)
 Initialise the kernel's inputs and outputs. 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 NEReshapeLayer. More...
 

Detailed Description

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

Definition at line 38 of file NEReshapeLayer.h.

Constructor & Destructor Documentation

◆ NEReshapeLayer() [1/3]

Default Constructor.

Definition at line 40 of file NEReshapeLayer.cpp.

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

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

◆ ~NEReshapeLayer()

~NEReshapeLayer ( )
default

Default Destructor.

Referenced by NEReshapeLayer::NEReshapeLayer().

◆ NEReshapeLayer() [2/3]

NEReshapeLayer ( const NEReshapeLayer )
delete

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

◆ NEReshapeLayer() [3/3]

NEReshapeLayer ( NEReshapeLayer &&  )
default

Default move constructor.

Member Function Documentation

◆ configure()

void configure ( const ITensor input,
ITensor output 
)

Initialise the kernel's inputs and outputs.

Parameters
[in]inputInput tensor. Data type supported: All
[out]outputOutput tensor. Data type supported: Same as input

Definition at line 48 of file NEReshapeLayer.cpp.

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

Referenced by NEFlattenLayer::configure(), NEReduceMean::configure(), NEReductionOperation::configure(), NEGenerateProposalsLayer::configure(), and NEGEMMConvolutionLayer::configure().

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

◆ operator=() [1/2]

NEReshapeLayer& operator= ( const NEReshapeLayer )
delete

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

Referenced by NEReshapeLayer::NEReshapeLayer().

◆ operator=() [2/2]

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

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

Referenced by NEFlattenLayer::run(), NEReduceMean::run(), NEReductionOperation::run(), NEGenerateProposalsLayer::run(), and NEGEMMConvolutionLayer::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 NEReshapeLayer.

Parameters
[in]inputInput tensor info. Data type supported: All
[in]outputOutput tensor info. Data type supported: Same as input
Returns
a status

Definition at line 58 of file NEReshapeLayer.cpp.

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

Referenced by NEFlattenLayer::validate(), NEReductionOperation::validate(), and NEGenerateProposalsLayer::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 CpuReshape.
Definition: CpuReshape.cpp:39

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