ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
arm_compute::CLOneHot Class Reference

#include <CLOneHot.h>

Collaboration diagram for arm_compute::CLOneHot:

Public Member Functions

 CLOneHot ()
 
 CLOneHot (const CLOneHot &)=delete
 
 CLOneHot (CLOneHot &&)=default
 
CLOneHotoperator= (const CLOneHot &)=delete
 
CLOneHotoperator= (CLOneHot &&)=default
 
void configure (const ICLTensor *indices, const ICLTensor *on_value, const ICLTensor *off_value, ICLTensor *output, int depth, int axis=-1)
 
void configure (const ICLTensor *indices, const ICLTensor *on_value, ICLTensor *output, PixelValue off_value, int depth, int axis=-1)
 
void run () override
 

Static Public Member Functions

static Status validate (const ITensorInfo *indices, const ITensorInfo *on_value, const ITensorInfo *off_value, const ITensorInfo *output, int depth, int axis=-1)
 

Detailed Description

Basic function to run CLOneHotKernel

Definition at line 51 of file CLOneHot.h.

Constructor & Destructor Documentation

◆ CLOneHot() [1/3]

arm_compute::CLOneHot::CLOneHot ( )

Constructor

Definition at line 47 of file CLOneHot.cpp.

47: _memset_kernel(), _onehot_kernel(), _has_to_memset(false) {}

◆ CLOneHot() [2/3]

arm_compute::CLOneHot::CLOneHot ( const CLOneHot )
delete

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

◆ CLOneHot() [3/3]

arm_compute::CLOneHot::CLOneHot ( CLOneHot &&  )
default

Default move constructor

Member Function Documentation

◆ configure() [1/2]

void arm_compute::CLOneHot::configure ( const ICLTensor *  indices,
const ICLTensor *  on_value,
const ICLTensor *  off_value,
ICLTensor *  output,
int  depth,
int  axis = -1 
)

Initialise the kernel's inputs and outputs

Parameters
[in]indicesIndices tensor. Supported tensor rank: up to 3. Must be one of the following types: U32/S32
[in]on_valueOn value tensor. Supported tensor rank: only 1. Data type supported: U8/S8/U16/S16/F16/U32/S32/F32
[in]off_valueOff value tensor. Supported tensor rank: only 1. Data type supported: Same as on_value
[out]outputDestination tensor. Data type supported: Same as on_value
[in]depthThe depth of the one hot dimension.
[in]axis(Optional) The axis to fill. Negative values wrap around. Defaults to -1. value must be in range [-indices.rank , indices.rank)

Definition at line 48 of file CLOneHot.cpp.

50{
51 _onehot_kernel.configure(indices, on_value, off_value, output, depth, axis);
52}
void configure(const ICLTensor *indices, const ICLTensor *on_value, const ICLTensor *off_value, ICLTensor *output, int depth, int axis=-1)

References arm_compute::CLOneHotKernel::configure().

◆ configure() [2/2]

void arm_compute::CLOneHot::configure ( const ICLTensor *  indices,
const ICLTensor *  on_value,
ICLTensor *  output,
PixelValue  off_value,
int  depth,
int  axis = -1 
)

Initialise the kernel's inputs and outputs with off_value being constant

Parameters
[in]indicesIndices tensor. Supported tensor rank: up to 3. Must be one of the following types: U32/S32
[in]on_valueOn value tensor. Supported tensor rank: only 1. Data type supported: U8/S8/U16/S16/F16/U32/S32/F32
[out]outputDestination tensor. Data type supported: Same as on_value
[in]off_valueThe PixelValue for off value. Data type supported: Same as on_value
[in]depthThe depth of the one hot dimension.
[in]axis(Optional) The axis to fill. Negative values wrap around. Defaults to -1. value must be in range [-indices.rank , indices.rank)

Definition at line 53 of file CLOneHot.cpp.

55{
56 _has_to_memset = true;
57 _memset_kernel.configure(output, off_value);
58 _onehot_kernel.configure(indices, on_value, output, depth, axis);
59}
void configure(ICLTensor *tensor, const PixelValue &constant_value, Window *window=nullptr)

References arm_compute::CLOneHotKernel::configure(), and arm_compute::CLMemsetKernel::configure().

◆ operator=() [1/2]

CLOneHot & arm_compute::CLOneHot::operator= ( CLOneHot &&  )
default

Default move assignment operator

References validate().

◆ operator=() [2/2]

CLOneHot & arm_compute::CLOneHot::operator= ( const CLOneHot )
delete

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

◆ run()

void arm_compute::CLOneHot::run ( )
override

Definition at line 66 of file CLOneHot.cpp.

67{
68 if (_has_to_memset)
69 {
70 CLScheduler::get().enqueue(_memset_kernel, true);
71 }
72
73 CLScheduler::get().enqueue(_onehot_kernel, false);
74}

◆ validate()

Status arm_compute::CLOneHot::validate ( const ITensorInfo *  indices,
const ITensorInfo *  on_value,
const ITensorInfo *  off_value,
const ITensorInfo *  output,
int  depth,
int  axis = -1 
)
static

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

Parameters
[in]indicesIndices tensor. Supported tensor rank: up to 3. Must be one of the following types: U32/S32
[in]on_valueOn value tensor. Supported tensor rank: only 1. Data type supported: U8/S8/U16/S16/F16/U32/S32/F32
[in]off_valueOff value tensor. Supported tensor rank: only 1. Data type supported: Same as on_value
[in]outputDestination tensor. Data type supported: Same as on_value
[in]depthThe depth of the one hot dimension.
[in]axis(Optional) The axis to fill. Negative values wrap around. Defaults to -1. value must be in range [-indices.rank , indices.rank)
Returns
a status

Definition at line 60 of file CLOneHot.cpp.

63{
64 return CLOneHotKernel::validate(indices, on_value, off_value, output, depth, axis);
65}
static Status validate(const ITensorInfo *indices, const ITensorInfo *on_value, const ITensorInfo *off_value, const ITensorInfo *output, int depth, int axis=-1)

References arm_compute::CLOneHotKernel::validate().

Referenced by operator=().


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