Compute Library
 21.02
NEPermute Class Reference

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

#include <NEPermute.h>

Collaboration diagram for NEPermute:
[legend]

Public Member Functions

 NEPermute ()
 Default Constructor. More...
 
 ~NEPermute ()
 Default Destructor. More...
 
 NEPermute (const NEPermute &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEPermute (NEPermute &&)
 Default move constructor. More...
 
NEPermuteoperator= (const NEPermute &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEPermuteoperator= (NEPermute &&)
 Default move assignment operator. More...
 
void configure (const ITensor *input, ITensor *output, const PermutationVector &perm)
 Configure the permute Neon kernel. 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 NEPermute. More...
 

Detailed Description

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

Definition at line 40 of file NEPermute.h.

Constructor & Destructor Documentation

◆ NEPermute() [1/3]

NEPermute ( )

Default Constructor.

Definition at line 38 of file NEPermute.cpp.

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

39  : _impl(std::make_unique<Impl>())
40 {
41 }

◆ ~NEPermute()

~NEPermute ( )
default

Default Destructor.

Referenced by NEPermute::NEPermute().

◆ NEPermute() [2/3]

NEPermute ( const NEPermute )
delete

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

◆ NEPermute() [3/3]

NEPermute ( NEPermute &&  )
default

Default move constructor.

Member Function Documentation

◆ configure()

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

Configure the permute Neon kernel.

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

Definition at line 49 of file NEPermute.cpp.

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

Referenced by NEInstanceNormalizationLayer::configure(), NEGEMMConv2d::configure(), NEGenerateProposalsLayer::configure(), and NEFFTConvolutionLayer::configure().

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

◆ operator=() [1/2]

NEPermute& operator= ( const NEPermute )
delete

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

Referenced by NEPermute::NEPermute().

◆ operator=() [2/2]

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

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

Referenced by NEGEMMConv2d::prepare(), NEFFTConvolutionLayer::prepare(), NEInstanceNormalizationLayer::run(), NEGenerateProposalsLayer::run(), and NEFFTConvolutionLayer::run().

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

◆ 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 NEPermute.

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
Returns
a status

Definition at line 59 of file NEPermute.cpp.

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

Referenced by NEGenerateProposalsLayer::validate().

60 {
63 
64  return Status{};
65 }
#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, const PermutationVector &perm)
Static function to check if given info will lead to a valid configuration of CpuPermute.
Definition: CpuPermute.cpp:39

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