23#ifndef __NNFW_MISC_TENSOR_OBJECT_H__
24#define __NNFW_MISC_TENSOR_OBJECT_H__
69 _values.at(0) = fn(_shape, 0);
74 _values.resize(_shape.
dim(0) * _stride.
at(0));
78 [
this, &fn](
const Index &index) { _values.at(_stride.
offset(index)) = fn(_shape, index); };
95 T
at(
const Index &index)
const override {
return _values.at(_stride.
offset(index)); }
102 std::vector<T> _values;
This file contains nnfw::misc::tensor::NonIncreasingStride class.
Class to represent strides where stride[N-1] >= stride[N] holds for all N < rank.
uint32_t at(uint32_t axis) const
Get an stride value for specific axis.
void init(const Shape &shape)
Initialize the stride data using Shape.
uint32_t offset(const Index &index) const
Get the 1-D offset of specified index for n-D tensor.
Class to build a tensor using specific generator.
std::function< T(const Shape &shape, const Index &index)> Generator
Function to generate tensor element.
const Shape & shape(void) const
Get reference of shape.
Object(const Shape &shape, const Generator &fn)
Construct a new Object object.
T at(const Index &index) const override
Get and element of tensor.
Class to represent shape of a tensor.
int32_t dim(uint32_t n) const
Get specific dimension.
uint32_t rank(void) const
Get the rank of this shape.
This file contains nnfw::misc::tensor::IndexIterator class and helper function and operator.
IndexIterator iterate(const Shape &shape)
Get an IndexItator object.
This file contains nnfw::misc::tensor::Index struct.
This file contains nnfw::misc::tensor::Reader struct.
This file contains nnfw::misc::tensor::Shape class.
Struct to represent index of each dimension of a tensor.
Struct to read element of tensor.