Compute Library
 21.05
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
 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
 Default move assignment operator. More...
 
void configure (const ITensor *input, ITensor *output, const PermutationVector &perm)
 Configure the permute function. 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.

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

◆ ~NEPermute()

~NEPermute ( )
default

Default Destructor.

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

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
[out]outputThe output tensor. Data types supported: Same as input
[in]permPermutation vector

Definition at line 45 of file NEPermute.cpp.

46 {
48 
49  _impl->src = input;
50  _impl->dst = output;
51  _impl->op = std::make_unique<cpu::CpuPermute>();
52  _impl->op->configure(input->info(), output->info(), perm);
53 }
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:157

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

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

◆ operator=() [1/2]

NEPermute& operator= ( const NEPermute )
delete

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

◆ operator=() [2/2]

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

64 {
65  ITensorPack pack;
66  pack.add_tensor(TensorType::ACL_SRC, _impl->src);
67  pack.add_tensor(TensorType::ACL_DST, _impl->dst);
68  _impl->op->run(pack);
69 }

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

Referenced by NEGEMMConv2d::prepare(), NEFFTConvolutionLayer::prepare(), NEInstanceNormalizationLayer::run(), NEFFTConvolutionLayer::run(), and NEGenerateProposalsLayer::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 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 55 of file NEPermute.cpp.

56 {
59 
60  return Status{};
61 }
#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:159
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

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

Referenced by NEGenerateProposalsLayer::validate().


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