Compute Library
 21.05
CLReshapeLayer Class Reference

Basic function to run opencl::kernels::ClReshapeKernel. More...

#include <CLReshapeLayer.h>

Collaboration diagram for CLReshapeLayer:
[legend]

Public Member Functions

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

Detailed Description

Basic function to run opencl::kernels::ClReshapeKernel.

Definition at line 38 of file CLReshapeLayer.h.

Constructor & Destructor Documentation

◆ CLReshapeLayer() [1/3]

Default Constructor.

Definition at line 43 of file CLReshapeLayer.cpp.

44  : _impl(std::make_unique<Impl>())
45 {
46 }

◆ ~CLReshapeLayer()

~CLReshapeLayer ( )
default

Default Destructor.

◆ CLReshapeLayer() [2/3]

CLReshapeLayer ( const CLReshapeLayer )
delete

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

◆ CLReshapeLayer() [3/3]

CLReshapeLayer ( CLReshapeLayer &&  )
default

Default move constructor.

Member Function Documentation

◆ configure() [1/2]

void configure ( const ICLTensor input,
ICLTensor output 
)

Initialise the kernel's inputs and outputs.

Valid data layouts:

  • All

Valid data type configurations:

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

Definition at line 52 of file CLReshapeLayer.cpp.

53 {
54  configure(CLKernelLibrary::get().get_compile_context(), input, output);
55 }
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
void configure(const ICLTensor *input, ICLTensor *output)
Initialise the kernel's inputs and outputs.

References CLKernelLibrary::get(), and arm_compute::test::validation::input.

Referenced by CLFlattenLayer::configure(), CLReduceMean::configure(), CLReductionOperation::configure(), CLArgMinMaxLayer::configure(), CLGenerateProposalsLayer::configure(), and CLGEMMDeconvolutionLayer::configure().

◆ configure() [2/2]

void configure ( const CLCompileContext compile_context,
const ICLTensor input,
ICLTensor output 
)

Initialise the kernel's inputs and outputs.

Parameters
[in]compile_contextThe compile context to be used.
[in]inputFirst tensor input. Data type supported: All
[out]outputOutput tensor. Data type supported: Same as input

Definition at line 57 of file CLReshapeLayer.cpp.

58 {
59  _impl->src = input;
60  _impl->dst = output;
61  _impl->op = std::make_unique<opencl::ClReshape>();
62  _impl->op->configure(compile_context, input->info(), output->info());
63 }

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

◆ operator=() [1/2]

CLReshapeLayer& operator= ( const CLReshapeLayer )
delete

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

◆ operator=() [2/2]

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

74 {
75  ITensorPack pack;
76  pack.add_tensor(TensorType::ACL_SRC, _impl->src);
77  pack.add_tensor(TensorType::ACL_DST, _impl->dst);
78  _impl->op->run(pack);
79 }

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

Referenced by CLGEMMDeconvolutionLayer::prepare(), CLFlattenLayer::run(), CLReduceMean::run(), CLArgMinMaxLayer::run(), CLReductionOperation::run(), and CLGenerateProposalsLayer::run().

◆ validate()

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

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

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

Definition at line 65 of file CLReshapeLayer.cpp.

66 {
69 
70  return Status{};
71 }
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
static Status validate(const ITensorInfo *input, const ITensorInfo *output)
Static function to check if given info will lead to a valid configuration of kernels::ClReshapeKernel...
Definition: ClReshape.cpp:40
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
Definition: Validate.h:159

References ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR, ARM_COMPUTE_RETURN_ON_ERROR, arm_compute::test::validation::input, and ClReshape::validate().

Referenced by CLFlattenLayer::validate(), CLArgMinMaxLayer::validate(), CLReductionOperation::validate(), CLGEMMDeconvolutionLayer::validate(), and CLGenerateProposalsLayer::validate().


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