Compute Library
 21.02
NERange Class Reference

Basic function to run NERangeKernel. More...

#include <NERange.h>

Collaboration diagram for NERange:
[legend]

Public Member Functions

 NERange ()
 Default constructor. More...
 
 NERange (const NERange &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NERangeoperator= (const NERange &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NERange (NERange &&)=delete
 Prevent instances of this class from being moved (As this class contains non movable objects) More...
 
NERangeoperator= (NERange &&)=delete
 Prevent instances of this class from being moved (As this class contains non movable objects) More...
 
 ~NERange ()
 Default destructor. More...
 
void configure (ITensor *output, float start, float end, float step=1.f)
 Initialize the kernel's start, end, step and output tensor. 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 *output, float start, float end, float step=1.f)
 Static function to check if given info will lead to a valid configuration of NERange. More...
 

Detailed Description

Basic function to run NERangeKernel.

Note
The tensor data type for the output must be U8/S8/U16/S16/U32/S32/F16/F32.
The function performs generates a sequence with the given start, end and step.

Definition at line 43 of file NERange.h.

Constructor & Destructor Documentation

◆ NERange() [1/3]

NERange ( )

Default constructor.

Definition at line 33 of file NERange.cpp.

34  : _kernel()
35 {
36 }

◆ NERange() [2/3]

NERange ( const NERange )
delete

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

◆ NERange() [3/3]

NERange ( NERange &&  )
delete

Prevent instances of this class from being moved (As this class contains non movable objects)

◆ ~NERange()

~NERange ( )
default

Default destructor.

Member Function Documentation

◆ configure()

void configure ( ITensor output,
float  start,
float  end,
float  step = 1.f 
)

Initialize the kernel's start, end, step and output tensor.

Parameters
[out]outputOutput tensor. Data types supported: U8/S8/U16/S16/U32/S32/F16/F32.
[in]startThe starting value of the sequence.
[in]endThe ending (not including) value of the sequence.
[in]stepThe gap between each pair of values in the sequence. Default is 1.

Definition at line 38 of file NERange.cpp.

39 {
40  _kernel = std::make_unique<NERangeKernel>();
41  _kernel->configure(output, start, end, step);
42 }
void end(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:290
constexpr int step
Definition: fp32.cpp:35

◆ operator=() [1/2]

NERange& operator= ( const NERange )
delete

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

◆ operator=() [2/2]

NERange& operator= ( NERange &&  )
delete

Prevent instances of this class from being moved (As this class contains non movable objects)

◆ 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 49 of file NERange.cpp.

References Window::DimX, Scheduler::get(), and IScheduler::schedule().

50 {
51  NEScheduler::get().schedule(_kernel.get(), Window::DimX);
52 }
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
Definition: Window.h:43
virtual void schedule(ICPPKernel *kernel, const Hints &hints)=0
Runs the kernel in the same thread as the caller synchronously.
static IScheduler & get()
Access the scheduler singleton.
Definition: Scheduler.cpp:94

◆ validate()

Status validate ( const ITensorInfo output,
float  start,
float  end,
float  step = 1.f 
)
static

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

Parameters
[in]outputOutput tensor info. Data types supported: U8/S8/U16/S16/U32/S32/F16/F32.
[in]startThe starting value of the sequence.
[in]endThe ending (not including) value of the sequence.
[in]stepThe gap between each pair of values in the sequence. Default is 1.
Returns
a status

Definition at line 44 of file NERange.cpp.

References NERangeKernel::validate().

Referenced by arm_compute::test::validation::DATA_TEST_CASE().

45 {
46  return NERangeKernel::validate(output, start, end, step);
47 }
static Status validate(const ITensorInfo *output, float start, float end, float step)
Static function to check if given info will lead to a valid configuration of NERangeKernel.
void end(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:290
constexpr int step
Definition: fp32.cpp:35

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