Compute Library
 21.02
NEStridedSlice Class Reference

Basic function to run NEStridedSliceKernel. More...

#include <NEStridedSlice.h>

Collaboration diagram for NEStridedSlice:
[legend]

Public Member Functions

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

Detailed Description

Basic function to run NEStridedSliceKernel.

Definition at line 80 of file NEStridedSlice.h.

Constructor & Destructor Documentation

◆ NEStridedSlice() [1/3]

Default Constructor.

Definition at line 58 of file NEStridedSlice.cpp.

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

59  : _impl(std::make_unique<Impl>())
60 {
61 }

◆ ~NEStridedSlice()

~NEStridedSlice ( )
default

Default Destructor.

Referenced by NEStridedSlice::NEStridedSlice().

◆ NEStridedSlice() [2/3]

NEStridedSlice ( const NEStridedSlice )
delete

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

◆ NEStridedSlice() [3/3]

NEStridedSlice ( NEStridedSlice &&  )
default

Default move constructor.

Member Function Documentation

◆ configure()

void configure ( const ITensor input,
ITensor output,
const Coordinates starts,
const Coordinates ends,
const BiStrides strides,
int32_t  begin_mask = 0,
int32_t  end_mask = 0,
int32_t  shrink_axis_mask = 0 
)

Configure kernel.

Note
Supported tensor rank: up to 4
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).
[in]stridesThe strides of the dimensions of the input tensor to be sliced. The length must be of rank(input).
[in]begin_mask(Optional) If the ith bit of begin_mask is set, starts[i] is ignored and the fullest possible range in that dimension is used instead.
[in]end_mask(Optional) If the ith bit of end_mask is set, ends[i] is ignored and the fullest possible range in that dimension is used instead.
[in]shrink_axis_mask(Optional) If the ith bit of shrink_axis_mask is set, it implies that the ith specification shrinks the dimensionality by 1. A slice of size 1 starting from starts[i] in the dimension must be preserved.

Definition at line 66 of file NEStridedSlice.cpp.

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

69 {
70  _impl->src = input;
71  _impl->dst = output;
72  _impl->op = std::make_unique<experimental::NEStridedSlice>();
73  _impl->op->configure(input->info(), output->info(), starts, ends, strides, begin_mask, end_mask, shrink_axis_mask);
74 }

◆ operator=() [1/2]

NEStridedSlice& operator= ( const NEStridedSlice )
delete

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

Referenced by NEStridedSlice::NEStridedSlice().

◆ operator=() [2/2]

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

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

77 {
78  ITensorPack pack;
79  pack.add_tensor(TensorType::ACL_SRC, _impl->src);
80  pack.add_tensor(TensorType::ACL_DST, _impl->dst);
81  _impl->op->run(pack);
82 }

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo output,
const Coordinates starts,
const Coordinates ends,
const BiStrides strides,
int32_t  begin_mask = 0,
int32_t  end_mask = 0,
int32_t  shrink_axis_mask = 0 
)
static

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

Note
Supported tensor rank: up to 4
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).
[in]stridesThe strides of the dimensions of the input tensor to be sliced. The length must be of rank(input).
[in]begin_mask(Optional) If the ith bit of begin_mask is set, starts[i] is ignored and the fullest possible range in that dimension is used instead.
[in]end_mask(Optional) If the ith bit of end_mask is set, ends[i] is ignored and the fullest possible range in that dimension is used instead.
[in]shrink_axis_mask(Optional) If the ith bit of shrink_axis_mask is set, it implies that the ith specification shrinks the dimensionality by 1. A slice of size 1 starting from starts[i] in the dimension must be preserved.

Definition at line 84 of file NEStridedSlice.cpp.

References NEStridedSlice::validate().

Referenced by NEUnstack::validate().

87 {
88  return experimental::NEStridedSlice::validate(input, output, starts, ends, strides, begin_mask, end_mask, shrink_axis_mask);
89 }
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const Coordinates &starts, const Coordinates &ends, const BiStrides &strides, int32_t begin_mask=0, int32_t end_mask=0, int32_t shrink_axis_mask=0)
Static function to check if given info will lead to a valid configuration of NEStridedSlice.

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