Compute Library
 21.08
CLTranspose Class Reference

Basic function to execute an opencl::kernels::ClTransposeKernel. More...

#include <CLTranspose.h>

Collaboration diagram for CLTranspose:
[legend]

Public Member Functions

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

Detailed Description

Basic function to execute an opencl::kernels::ClTransposeKernel.

Definition at line 39 of file CLTranspose.h.

Constructor & Destructor Documentation

◆ CLTranspose() [1/3]

Constructor.

Definition at line 41 of file CLTranspose.cpp.

References CLTranspose::~CLTranspose().

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

◆ ~CLTranspose()

~CLTranspose ( )
default

Destructor.

Referenced by CLTranspose::CLTranspose().

◆ CLTranspose() [2/3]

CLTranspose ( const CLTranspose )
delete

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

◆ CLTranspose() [3/3]

CLTranspose ( CLTranspose &&  )
default

Default move constructor.

Member Function Documentation

◆ configure() [1/2]

void configure ( const ICLTensor input,
ICLTensor output 
)

Initialise the kernel's inputs and output.

Valid data layouts:

  • All

Valid data type configurations:

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

Definition at line 47 of file CLTranspose.cpp.

References CLKernelLibrary::get().

Referenced by CLGEMMDeconvolutionLayer::configure(), CLLSTMLayerQuantized::configure(), and CLQLSTMLayer::configure().

48 {
49  configure(CLKernelLibrary::get().get_compile_context(), input, output);
50 }
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
void configure(const ICLTensor *input, ICLTensor *output)
Initialise the kernel&#39;s inputs and output.
Definition: CLTranspose.cpp:47

◆ configure() [2/2]

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

Initialise the kernel's inputs and output.

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

Definition at line 52 of file CLTranspose.cpp.

References ARM_COMPUTE_ERROR_ON_NULLPTR, and arm_compute::test::validation::input.

53 {
55  _impl->src = input;
56  _impl->dst = output;
57  _impl->op = std::make_unique<opencl::ClTranspose>();
58  _impl->op->configure(compile_context, _impl->src->info(), _impl->dst->info());
59 }
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:157

◆ operator=() [1/2]

CLTranspose& operator= ( const CLTranspose )
delete

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

◆ operator=() [2/2]

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

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

Referenced by CLGEMMDeconvolutionLayer::prepare(), CLLSTMLayerQuantized::prepare(), and CLQLSTMLayer::prepare().

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 }
void add_tensor(int id, ITensor *tensor)
Add tensor to the pack.
Definition: ITensorPack.cpp:39

◆ validate()

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

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

Parameters
[in]inputThe input tensor. Data types supported: All.
[in]outputThe output tensor. Data types supported: Same as input
Returns
a status

Definition at line 61 of file CLTranspose.cpp.

References ClTranspose::validate().

Referenced by arm_compute::test::validation::DATA_TEST_CASE(), CLGEMMDeconvolutionLayer::validate(), CLLSTMLayerQuantized::validate(), and CLQLSTMLayer::validate().

62 {
63  return opencl::ClTranspose::validate(input, output);
64 }
static Status validate(const ITensorInfo *src, const ITensorInfo *dst)
Static function to check if given info will lead to a valid configuration.
Definition: ClTranspose.cpp:40

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