ONE - On-device Neural Engine
|
Class to build a tensor using specific generator. More...
#include <Object.h>
Public Types | |
using | Generator = std::function< T(const Shape &shape, const Index &index)> |
Function to generate tensor element. | |
Public Member Functions | |
Object (const Shape &shape, const Generator &fn) | |
Construct a new Object object. | |
const Shape & | shape (void) const |
Get reference of shape. | |
T | at (const Index &index) const override |
Get and element of tensor. | |
Public Member Functions inherited from nnfw::misc::tensor::Reader< T > | |
virtual | ~Reader ()=default |
Destroy the Reader object. | |
Class to build a tensor using specific generator.
T | Type of tensor element |
using nnfw::misc::tensor::Object< T >::Generator = std::function<T(const Shape &shape, const Index &index)> |
|
inline |
Construct a new Object
object.
[in] | shape | Tensor shape |
[in] | fn | Function to generate tensor elements |
Definition at line 60 of file Object.h.
References nnfw::misc::tensor::NonIncreasingStride::at(), nnfw::misc::tensor::Shape::dim(), nnfw::misc::tensor::NonIncreasingStride::init(), nnfw::misc::tensor::iterate(), nnfw::misc::tensor::NonIncreasingStride::offset(), nnfw::misc::tensor::Shape::rank(), and nnfw::misc::tensor::Object< T >::shape().
|
inlineoverridevirtual |
Get and element of tensor.
[in] | index | Index of a tensor element |
Implements nnfw::misc::tensor::Reader< T >.
Definition at line 95 of file Object.h.
References nnfw::misc::tensor::NonIncreasingStride::offset().
|
inline |
Get reference of shape.
Definition at line 87 of file Object.h.
Referenced by RandomDataGenerator.RandomDataGenerator::_gen_float32(), RandomDataGenerator.RandomDataGenerator::_gen_int16(), RandomDataGenerator.RandomDataGenerator::_gen_uint8(), and nnfw::misc::tensor::Object< T >::Object().