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

#include <Tensor.h>

Public Member Functions

 RuntimeShape (const RuntimeShape &other)
 
int flatSize () const
 
int32_t * dimsData ()
 
const int32_t * dimsData () const
 
 RuntimeShape ()
 
 RuntimeShape (int dimensions_count)
 
 RuntimeShape (int dimensions_count, const int32_t *dims_data)
 
 RuntimeShape (int new_shape_size, const RuntimeShape &shape, int pad_value)
 
 RuntimeShape (int shape_size, int32_t value)
 
bool operator== (const RuntimeShape &comp) const
 
int32_t dimensionsCount () const
 
int32_t dims (int i) const
 
void setDim (int i, int32_t val)
 
void resize (int dimensions_count)
 

Static Public Member Functions

static RuntimeShape extendedShape (int new_shape_size, const RuntimeShape &shape)
 

Detailed Description

Definition at line 35 of file Tensor.h.

Constructor & Destructor Documentation

◆ RuntimeShape() [1/6]

luci_interpreter::RuntimeShape::RuntimeShape ( const RuntimeShape other)
inline

Definition at line 38 of file Tensor.h.

38 : _size(other.dimensionsCount())
39 {
40 std::memcpy(dimsData(), other.dimsData(), sizeof(int32_t) * _size);
41 }

References dimsData().

◆ RuntimeShape() [2/6]

luci_interpreter::RuntimeShape::RuntimeShape ( )
inline

Definition at line 59 of file Tensor.h.

59: _size(0) {}

Referenced by extendedShape().

◆ RuntimeShape() [3/6]

luci_interpreter::RuntimeShape::RuntimeShape ( int  dimensions_count)
inlineexplicit

Definition at line 61 of file Tensor.h.

61 : _size(dimensions_count)
62 {
63 assert(dimensions_count <= kMaxSmallSize);
64 assert(dimensions_count >= 0);
65 }

◆ RuntimeShape() [4/6]

luci_interpreter::RuntimeShape::RuntimeShape ( int  dimensions_count,
const int32_t *  dims_data 
)
inline

Definition at line 67 of file Tensor.h.

67 : _size(0)
68 {
69 resize(dimensions_count);
70 int32_t *dst_dims = dimsData();
71 std::memcpy(dst_dims, dims_data, dimensions_count * sizeof(int32_t));
72 }
void resize(int dimensions_count)
Definition Tensor.h:121

References dimsData(), and resize().

◆ RuntimeShape() [5/6]

luci_interpreter::RuntimeShape::RuntimeShape ( int  new_shape_size,
const RuntimeShape shape,
int  pad_value 
)
inline

Definition at line 74 of file Tensor.h.

74 : _size(0)
75 {
76 resize(new_shape_size);
77 const int size_increase = new_shape_size - shape.dimensionsCount();
78 for (int i = 0; i < size_increase; ++i)
79 {
80 setDim(i, pad_value);
81 }
82 std::memcpy(dimsData() + size_increase, shape.dimsData(),
83 sizeof(int32_t) * shape.dimensionsCount());
84 }
void setDim(int i, int32_t val)
Definition Tensor.h:114

References dimensionsCount(), dimsData(), resize(), and setDim().

◆ RuntimeShape() [6/6]

luci_interpreter::RuntimeShape::RuntimeShape ( int  shape_size,
int32_t  value 
)
inline

Definition at line 86 of file Tensor.h.

86 : _size(0)
87 {
88 resize(shape_size);
89 for (int i = 0; i < shape_size; ++i)
90 {
91 setDim(i, value);
92 }
93 }

References resize(), and setDim().

Member Function Documentation

◆ dimensionsCount()

int32_t luci_interpreter::RuntimeShape::dimensionsCount ( ) const
inline

◆ dims()

int32_t luci_interpreter::RuntimeShape::dims ( int  i) const
inline

Definition at line 108 of file Tensor.h.

109 {
110 assert(i <= _size);
111 assert(i >= 0);
112 return _dims[i];
113 }

Referenced by luci_interpreter::kernels::areShapesEqual(), luci_interpreter_pal::ArgMinMax(), onert_micro::execute::pal::AveragePool(), onert_micro::execute::pal::AveragePool(), luci_interpreter_pal::AveragePool(), luci_interpreter_pal::AveragePool(), onert_micro::execute::pal::BatchToSpaceND(), luci_interpreter_pal::BatchToSpaceND(), luci_interpreter_pal::BroadcastArithmeticOp4DSlow(), luci_interpreter_pal::BroadcastBinaryOp4DSlow(), luci_interpreter_pal::BroadcastPrelu4DSlowFloat(), luci_interpreter_pal::BroadcastTISO4DSlow(), luci_interpreter_pal::Concatenation(), onert_micro::execute::pal::Concatenation(), onert_micro::import::configure_kernel_CircleDepthwiseConv2D(), onert_micro::import::configure_kernel_CircleGRU(), onert_micro::import::configure_kernel_CircleSpaceToDepth(), onert_micro::import::configure_kernel_CircleSVDF(), onert_micro::import::configure_kernel_CircleUnpack(), onert_micro::execute::pal::ConvFloat(), onert_micro::execute::pal::ConvPerChannel(), luci_interpreter_pal::copyDimsToDesc(), luci_interpreter_pal::DepthToSpace(), onert_micro::execute::pal::DepthwiseConv2D< float >(), onert_micro::execute::pal::DepthwiseConvPerChannel(), luci_interpreter::execute_kernel_CircleAdd(), onert_micro::execute::pal::Floor(), luci_interpreter_pal::Floor(), onert_micro::execute::pal::FullyConnected(), onert_micro::execute::pal::FullyConnected(), onert_micro::execute::pal::FullyConnected(), onert_micro::execute::pal::FullyConnected< int8_t >(), luci_interpreter_pal::GatherND(), onert_micro::train::pal::GRUWeightGrads(), onert_micro::execute::pal::L2Pool(), luci_interpreter_pal::L2Pool(), luci_interpreter_pal::MatchingDim(), onert_micro::execute::pal::MaxPool(), onert_micro::execute::pal::MaxPool(), luci_interpreter_pal::MaxPool(), luci_interpreter_pal::MaxPool(), luci_interpreter_pal::Mean(), luci_interpreter_pal::Negate(), luci_interpreter_pal::ResizeNearestNeighbor(), onert_micro::execute::pal::SpaceToBatchND(), luci_interpreter_pal::SpaceToBatchND(), luci_interpreter_pal::SpaceToDepth(), onert_micro::execute::pal::Split(), luci_interpreter_pal::StridedSlice(), onert_micro::execute::pal::SVDF(), luci_interpreter_pal::TransposeConv(), onert_micro::execute::pal::TransposeConv< float >(), and onert_micro::execute::pal::Unpack().

◆ dimsData() [1/2]

◆ dimsData() [2/2]

const int32_t * luci_interpreter::RuntimeShape::dimsData ( ) const
inline

Definition at line 57 of file Tensor.h.

57{ return _dims; }

◆ extendedShape()

◆ flatSize()

int luci_interpreter::RuntimeShape::flatSize ( ) const
inline

Definition at line 45 of file Tensor.h.

46 {
47 int buffer_size = 1;
48 const int *dims_data = reinterpret_cast<const int *>(dimsData());
49 for (int i = 0; i < _size; i++)
50 {
51 buffer_size *= dims_data[i];
52 }
53 return buffer_size;
54 }

References dimsData().

Referenced by luci_interpreter_pal::BroadcastTo(), onert_micro::import::configure_kernel_CircleFullyConnected(), onert_micro::import::configure_kernel_CircleReshape(), luci_interpreter::evalInteger(), luci_interpreter::execute_kernel_CircleAbs(), luci_interpreter::execute_kernel_CircleAdd(), onert_micro::execute::execute_kernel_CircleAdd(), onert_micro::execute::execute_kernel_CircleAddN(), luci_interpreter::execute_kernel_CircleCast(), luci_interpreter::execute_kernel_CircleCeil(), luci_interpreter::execute_kernel_CircleCos(), luci_interpreter::execute_kernel_CircleDequantize(), luci_interpreter::execute_kernel_CircleElu(), luci_interpreter::execute_kernel_CircleExp(), luci_interpreter::execute_kernel_CircleFloorDiv(), luci_interpreter::execute_kernel_CircleFloorMod(), luci_interpreter::execute_kernel_CircleLeakyRelu(), luci_interpreter::execute_kernel_CircleLog(), luci_interpreter::execute_kernel_CircleLogistic(), luci_interpreter::execute_kernel_CircleMaximum(), onert_micro::execute::execute_kernel_CircleMean(), luci_interpreter::execute_kernel_CircleMinimum(), onert_micro::execute::execute_kernel_CircleMul(), luci_interpreter::execute_kernel_CircleQuantize(), luci_interpreter::execute_kernel_CircleRelu(), luci_interpreter::execute_kernel_CircleRelu6(), luci_interpreter::execute_kernel_CircleRound(), luci_interpreter::execute_kernel_CircleRsqrt(), luci_interpreter::execute_kernel_CircleSin(), luci_interpreter::execute_kernel_CircleSqrt(), luci_interpreter::execute_kernel_CircleSquare(), luci_interpreter::execute_kernel_CircleSquaredDifference(), onert_micro::execute::execute_kernel_CircleSum(), luci_interpreter::execute_kernel_CircleTanh(), luci_interpreter::execute_kernel_CircleZerosLike(), onert_micro::execute::pal::Fill(), luci_interpreter_pal::Floor(), luci_interpreter_pal::GatherND(), onert_micro::execute::pal::GRU(), onert_micro::train::pal::GRUWeightGrads(), luci_interpreter_pal::lstm_internal::lstmStep(), luci_interpreter_pal::lstm_internal::mul(), luci_interpreter_pal::lstm_internal::mul(), luci_interpreter_pal::lstm_internal::mul(), luci_interpreter_pal::Negate(), luci_interpreter_pal::ProcessBroadcastShapes(), onert_micro::execute::pal::Select(), luci_interpreter_pal::Select(), luci_interpreter_pal::lstm_internal::sigmoid(), luci_interpreter_pal::lstm_internal::sigmoid(), luci_interpreter_pal::lstm_internal::tanh(), luci_interpreter_pal::lstm_internal::tanh(), luci_interpreter_pal::TransposeConv(), and onert_micro::execute::pal::TransposeConv< float >().

◆ operator==()

bool luci_interpreter::RuntimeShape::operator== ( const RuntimeShape comp) const
inline

Definition at line 100 of file Tensor.h.

101 {
102 return this->_size == comp._size &&
103 std::memcmp(dimsData(), comp.dimsData(), _size * sizeof(int32_t)) == 0;
104 }

References dimsData().

◆ resize()

void luci_interpreter::RuntimeShape::resize ( int  dimensions_count)
inline

Definition at line 121 of file Tensor.h.

122 {
123 assert(dimensions_count <= kMaxSmallSize);
124 assert(dimensions_count >= 0);
125 _size = dimensions_count;
126 }

Referenced by luci_interpreter::kernels::SplitV::configure(), mir_onnx::convertConvV1(), luci_interpreter::kernels::getTensorRuntimeShape(), RuntimeShape(), RuntimeShape(), RuntimeShape(), and nnkit::support::moco::tf::Backend::setInputOutputFromGraph().

◆ setDim()

void luci_interpreter::RuntimeShape::setDim ( int  i,
int32_t  val 
)
inline

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