Compute Library
 21.05
CLPermute Class Reference

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

#include <CLPermute.h>

Collaboration diagram for CLPermute:
[legend]

Public Member Functions

 CLPermute ()
 Constructor. More...
 
 ~CLPermute ()
 Destructor. More...
 
 CLPermute (const CLPermute &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 CLPermute (CLPermute &&)=default
 Default move constructor. More...
 
CLPermuteoperator= (const CLPermute &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
CLPermuteoperator= (CLPermute &&)=default
 Default move assignment operator. More...
 
void configure (const ICLTensor *input, ICLTensor *output, const PermutationVector &perm)
 Set the input and output tensors. More...
 
void configure (const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output, const PermutationVector &perm)
 Set the input and output tensors. 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, const PermutationVector &perm)
 Static function to check if given info will lead to a valid configuration of CLPermute. More...
 

Detailed Description

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

Definition at line 39 of file CLPermute.h.

Constructor & Destructor Documentation

◆ CLPermute() [1/3]

CLPermute ( )

Constructor.

Definition at line 42 of file CLPermute.cpp.

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

◆ ~CLPermute()

~CLPermute ( )
default

Destructor.

◆ CLPermute() [2/3]

CLPermute ( const CLPermute )
delete

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

◆ CLPermute() [3/3]

CLPermute ( CLPermute &&  )
default

Default move constructor.

Member Function Documentation

◆ configure() [1/2]

void configure ( const ICLTensor input,
ICLTensor output,
const PermutationVector perm 
)

Set the input and output tensors.

Valid data layouts:

  • NHWC
  • NCHW

Valid data type configurations:

src dst
All All
Note
Arbitrary permutation vectors are supported with rank not greater than 4
Parameters
[in]inputThe input tensor to permute. Data types supported: All.
[in]outputThe output tensor. Data types supported: Same as input
[in]permPermutation vector

Definition at line 49 of file CLPermute.cpp.

50 {
51  configure(CLKernelLibrary::get().get_compile_context(), input, output, perm);
52 }
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
void configure(const ICLTensor *input, ICLTensor *output, const PermutationVector &perm)
Set the input and output tensors.
Definition: CLPermute.cpp:49

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

Referenced by CLFFTConvolutionLayer::configure(), CLGenerateProposalsLayer::configure(), and CLGEMMDeconvolutionLayer::configure().

◆ configure() [2/2]

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

Set the input and output tensors.

Note
Arbitrary permutation vectors are supported with rank not greater than 4
Parameters
[in]compile_contextThe compile context to be used.
[in]inputThe input tensor to permute. Data types supported: All.
[in]outputThe output tensor. Data types supported: Same as input
[in]permPermutation vector

Definition at line 54 of file CLPermute.cpp.

55 {
57 
58  _impl->src = input;
59  _impl->dst = output;
60 
61  _impl->op = std::make_unique<opencl::ClPermute>();
62  _impl->op->configure(compile_context, _impl->src->info(), _impl->dst->info(), perm);
63 }
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:157

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

◆ operator=() [1/2]

CLPermute& operator= ( const CLPermute )
delete

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

◆ operator=() [2/2]

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

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

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

Referenced by CLFFTConvolutionLayer::prepare(), CLGEMMDeconvolutionLayer::prepare(), CLFFTConvolutionLayer::run(), CLGEMMDeconvolutionLayer::run(), and CLGenerateProposalsLayer::run().

◆ validate()

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

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

Note
Arbitrary permutation vectors are supported with rank not greater than 4
Parameters
[in]inputFirst tensor input info. Data types supported: All.
[in]outputOutput tensor info. Data types supported: same as input.
[in]permPermutation vector
Returns
a status

Definition at line 65 of file CLPermute.cpp.

66 {
67  return opencl::ClPermute::validate(input, output, perm);
68 }
static Status validate(const ITensorInfo *src, const ITensorInfo *dst, const PermutationVector &perm)
Static function to check if given info will lead to a valid configuration of kernels::ClPermuteKernel...
Definition: ClPermute.cpp:40

References arm_compute::test::validation::input, and ClPermute::validate().

Referenced by CLGEMMDeconvolutionLayer::validate(), and CLGenerateProposalsLayer::validate().


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