Compute Library
 20.11
NESlice Class Reference

Basic function to perform tensor slicing. More...

#include <NESlice.h>

Collaboration diagram for NESlice:
[legend]

Public Member Functions

 NESlice ()
 Default Constructor. More...
 
 ~NESlice ()
 Default Destructor. More...
 
 NESlice (const NESlice &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NESlice (NESlice &&)
 Default move constructor. More...
 
NESliceoperator= (const NESlice &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NESliceoperator= (NESlice &&)
 Default move assignment operator. More...
 
void configure (const ITensor *input, ITensor *output, const Coordinates &starts, const Coordinates &ends)
 Configure 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 Coordinates &starts, const Coordinates &ends)
 Static function to check if given info will lead to a valid configuration of NESlice. More...
 

Detailed Description

Basic function to perform tensor slicing.

Definition at line 74 of file NESlice.h.

Constructor & Destructor Documentation

◆ NESlice() [1/3]

NESlice ( )

Default Constructor.

Definition at line 74 of file NESlice.cpp.

75  : _impl(support::cpp14::make_unique<Impl>())
76 {
77 }

◆ ~NESlice()

~NESlice ( )
default

Default Destructor.

◆ NESlice() [2/3]

NESlice ( const NESlice )
delete

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

◆ NESlice() [3/3]

NESlice ( NESlice &&  )
default

Default move constructor.

Member Function Documentation

◆ configure()

void configure ( const ITensor input,
ITensor output,
const Coordinates starts,
const Coordinates ends 
)

Configure kernel.

Note
Supported tensor rank: up to 4
Start indices must be non-negative. 0 <= starts[i]
End coordinates can be negative, which represents the number of elements before the end of that dimension.
End indices are not inclusive unless negative.
Parameters
[in]inputSource tensor. Data type supported: All
[out]outputDestination tensor. Data type supported: Same as input
[in]startsThe starts of the dimensions of the input tensor to be sliced. The length must be of rank(input).
[in]endsThe ends of the dimensions of the input tensor to be sliced. The length must be of rank(input).

Definition at line 87 of file NESlice.cpp.

88 {
89  _impl->src = input;
90  _impl->dst = output;
91  _impl->op = arm_compute::support::cpp14::make_unique<experimental::NESlice>();
92  _impl->op->configure(input->info(), output->info(), starts, ends);
93 }

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

Referenced by NEFFTConvolutionLayer::configure(), and NELSTMLayerQuantized::configure().

◆ operator=() [1/2]

NESlice& operator= ( const NESlice )
delete

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

◆ operator=() [2/2]

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

96 {
97  ITensorPack pack;
98  pack.add_tensor(TensorType::ACL_SRC, _impl->src);
99  pack.add_tensor(TensorType::ACL_DST, _impl->dst);
100  _impl->op->run(pack);
101 }

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

Referenced by NEFFTConvolutionLayer::run(), and NELSTMLayerQuantized::run().

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo output,
const Coordinates starts,
const Coordinates ends 
)
static

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

Note
Supported tensor rank: up to 4
Start indices must be non-negative. 0 <= starts[i]
End coordinates can be negative, which represents the number of elements before the end of that dimension.
End indices are not inclusive unless negative.
Parameters
[in]inputSource tensor info. Data type supported: All
[in]outputDestination tensor info. Data type supported: Same as input
[in]startsThe starts of the dimensions of the input tensor to be sliced. The length must be of rank(input).
[in]endsThe ends of the dimensions of the input tensor to be sliced. The length must be of rank(input).
Returns
A status

Definition at line 82 of file NESlice.cpp.

83 {
84  return experimental::NESlice::validate(input, output, starts, ends);
85 }
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const Coordinates &starts, const Coordinates &ends)
Static function to check if given info will lead to a valid configuration of NESlice.
Definition: NESlice.cpp:50

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

Referenced by NELSTMLayerQuantized::validate().


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