ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nnfw::misc::vector::Object< T > Class Template Referencefinal

Class to have information of the operand for vector. More...

#include <Object.h>

Collaboration diagram for nnfw::misc::vector::Object< T >:

Public Types

using Generator = std::function< T(int32_t size, int32_t offset)>
 

Public Member Functions

 Object (int32_t size, const Generator &gen)
 Construct Object object with size of vector and set value used by Generator.
 
int32_t size (void) const
 Get size of vector.
 
at (uint32_t nth) const override
 Get the value used by index.
 
- Public Member Functions inherited from nnfw::misc::vector::Reader< T >
virtual ~Reader ()=default
 Destruct Reader object using default destructor.
 

Detailed Description

template<typename T>
class nnfw::misc::vector::Object< T >

Class to have information of the operand for vector.

Definition at line 41 of file Object.h.

Member Typedef Documentation

◆ Generator

template<typename T >
using nnfw::misc::vector::Object< T >::Generator = std::function<T(int32_t size, int32_t offset)>

Definition at line 44 of file Object.h.

Constructor & Destructor Documentation

◆ Object()

template<typename T >
nnfw::misc::vector::Object< T >::Object ( int32_t  size,
const Generator gen 
)
inline

Construct Object object with size of vector and set value used by Generator.

Parameters
[in]sizeThe size of vector
[in]genA function to set values of operand tensor

Definition at line 52 of file Object.h.

52 : _size{size}
53 {
54 _value.resize(_size);
55
56 for (int32_t offset = 0; offset < size; ++offset)
57 {
58 _value.at(offset) = gen(size, offset);
59 }
60 }
int32_t size(void) const
Get size of vector.
Definition Object.h:67
__global uchar * offset(const Image *img, int x, int y)
Definition helpers.h:540

References offset(), and nnfw::misc::vector::Object< T >::size().

Member Function Documentation

◆ at()

template<typename T >
T nnfw::misc::vector::Object< T >::at ( uint32_t  nth) const
inlineoverridevirtual

Get the value used by index.

Parameters
[in]nthThe vector index
Returns
The value at the offset

Implements nnfw::misc::vector::Reader< T >.

Definition at line 75 of file Object.h.

75{ return _value.at(nth); }

◆ size()

template<typename T >
int32_t nnfw::misc::vector::Object< T >::size ( void  ) const
inline

Get size of vector.

Returns
Size of vector

Definition at line 67 of file Object.h.

67{ return _size; }

Referenced by nnfw::misc::vector::Object< T >::Object().


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