Compute Library
 21.11
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 44 of file CLPermute.cpp.

References CLPermute::~CLPermute().

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

◆ ~CLPermute()

~CLPermute ( )
default

Destructor.

Referenced by CLPermute::CLPermute().

◆ 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 51 of file CLPermute.cpp.

References CLKernelLibrary::get().

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

52 {
53  configure(CLKernelLibrary::get().get_compile_context(), input, output, perm);
54 }
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:51

◆ 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 56 of file CLPermute.cpp.

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

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

◆ 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 73 of file CLPermute.cpp.

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

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

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 }
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,
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 68 of file CLPermute.cpp.

References ClPermute::validate().

Referenced by arm_compute::test::validation::DATA_TEST_CASE(), CLDepthwiseConvolutionLayer::validate(), CLGenerateProposalsLayer::validate(), and CLGEMMDeconvolutionLayer::validate().

69 {
70  return opencl::ClPermute::validate(input, output, perm);
71 }
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.
Definition: ClPermute.cpp:43

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