ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci_interpreter::Shape Class Reference

#include <Tensor.h>

Public Member Functions

 Shape (int rank)
 
 Shape (std::initializer_list< int32_t > dims)
 
int num_dims () const
 
int32_t dim (int i) const
 
int32_t & dim (int i)
 
int32_t num_elements () const
 
int64_t large_num_elements () const
 
bool operator== (const Shape &other) const
 
bool operator!= (const Shape &other) const
 

Detailed Description

Definition at line 32 of file Tensor.h.

Constructor & Destructor Documentation

◆ Shape() [1/2]

luci_interpreter::Shape::Shape ( int  rank)
inlineexplicit

Definition at line 35 of file Tensor.h.

35: _dims(rank, 0) {}

◆ Shape() [2/2]

luci_interpreter::Shape::Shape ( std::initializer_list< int32_t >  dims)
inline

Definition at line 37 of file Tensor.h.

37: _dims(dims.begin(), dims.end()) {}

Member Function Documentation

◆ dim() [1/2]

int32_t & luci_interpreter::Shape::dim ( int  i)
inline

Definition at line 47 of file Tensor.h.

48 {
49 assert(i >= 0 && i < static_cast<int>(_dims.size()));
50 return _dims[i];
51 }

◆ dim() [2/2]

int32_t luci_interpreter::Shape::dim ( int  i) const
inline

Definition at line 41 of file Tensor.h.

42 {
43 assert(i >= 0 && i < static_cast<int>(_dims.size()));
44 return _dims[i];
45 }

Referenced by luci_interpreter::kernels::calcOffset(), luci_interpreter::kernels::calculateShapeForBroadcast(), luci_interpreter::kernels::ArgMax::configure(), luci_interpreter::kernels::AveragePool2D::configure(), luci_interpreter::kernels::BatchToSpaceND::configure(), luci_interpreter::kernels::Concatenation::configure(), luci_interpreter::kernels::Conv2D::configure(), luci_interpreter::kernels::DepthToSpace::configure(), luci_interpreter::kernels::DepthwiseConv2D::configure(), luci_interpreter::kernels::FullyConnected::configure(), luci_interpreter::kernels::Gather::configure(), luci_interpreter::kernels::L2Pool2D::configure(), luci_interpreter::kernels::MaxPool2D::configure(), luci_interpreter::kernels::MirrorPad::configure(), luci_interpreter::kernels::Pack::configure(), luci_interpreter::kernels::Pad::configure(), luci_interpreter::kernels::PadV2::configure(), luci_interpreter::kernels::ResizeBilinear::configure(), luci_interpreter::kernels::ResizeNearestNeighbor::configure(), luci_interpreter::kernels::Select::configure(), luci_interpreter::kernels::SpaceToBatchND::configure(), luci_interpreter::kernels::SpaceToDepth::configure(), luci_interpreter::kernels::Split::configure(), luci_interpreter::kernels::SplitV::configure(), luci_interpreter::kernels::Squeeze::configure(), luci_interpreter::kernels::SVDF::configure(), luci_interpreter::kernels::Tile::configure(), luci_interpreter::kernels::Transpose::configure(), luci_interpreter::kernels::TransposeConv::configure(), luci_interpreter::kernels::UnidirectionalSequenceLSTM::configure(), luci_interpreter::kernels::Unpack::configure(), luci_interpreter::kernels::testing::dequantizeTensorData(), luci_interpreter_pal::eval_integer_8x8_16_lstm(), luci_interpreter::kernels::lstm::EvalFloat(), luci_interpreter::kernels::MirrorPad::execute(), luci_interpreter::kernels::Transpose::execute(), luci_interpreter::kernels::getTensorShape(), large_num_elements(), luci_interpreter::kernels::testing::makeInputTensor(), and num_elements().

◆ large_num_elements()

int64_t luci_interpreter::Shape::large_num_elements ( ) const
inline

Definition at line 64 of file Tensor.h.

65 {
66 int64_t result = 1;
67 for (const int32_t dim : _dims)
68 {
69 result *= dim;
70 }
71 return result;
72 }
int32_t dim(int i) const
Definition Tensor.h:41
result
Definition infer.py:103

References dim().

◆ num_dims()

int luci_interpreter::Shape::num_dims ( ) const
inline

Definition at line 39 of file Tensor.h.

39{ return _dims.size(); }

Referenced by luci_interpreter::kernels::calculateShapeForBroadcast(), luci_interpreter::kernels::ArgMax::configure(), luci_interpreter::kernels::BatchToSpaceND::configure(), luci_interpreter::kernels::BroadcastTo::configure(), luci_interpreter::kernels::Concatenation::configure(), luci_interpreter::kernels::Conv2D::configure(), luci_interpreter::kernels::DepthwiseConv2D::configure(), luci_interpreter::kernels::ExpandDims::configure(), luci_interpreter::kernels::FullyConnected::configure(), luci_interpreter::kernels::Gather::configure(), luci_interpreter::kernels::Mean::configure(), luci_interpreter::kernels::MirrorPad::configure(), luci_interpreter::kernels::OneHot::configure(), luci_interpreter::kernels::Pack::configure(), luci_interpreter::kernels::Pad::configure(), luci_interpreter::kernels::PadV2::configure(), luci_interpreter::kernels::PRelu::configure(), luci_interpreter::kernels::ReduceMax::configure(), luci_interpreter::kernels::ReduceProd::configure(), luci_interpreter::kernels::RmsNorm::configure(), luci_interpreter::kernels::Select::configure(), luci_interpreter::kernels::SpaceToBatchND::configure(), luci_interpreter::kernels::Split::configure(), luci_interpreter::kernels::SplitV::configure(), luci_interpreter::kernels::Squeeze::configure(), luci_interpreter::kernels::StridedSlice::configure(), luci_interpreter::kernels::Sum::configure(), luci_interpreter::kernels::SVDF::configure(), luci_interpreter::kernels::Transpose::configure(), luci_interpreter::kernels::UnidirectionalSequenceLSTM::configure(), luci_interpreter::kernels::Unpack::configure(), luci_interpreter::kernels::testing::dequantizeTensorData(), luci_interpreter::kernels::lstm::EvalFloat(), luci_interpreter::kernels::MirrorPad::execute(), luci_interpreter::kernels::Pad::execute(), luci_interpreter::kernels::PadV2::execute(), luci_interpreter::kernels::StridedSlice::execute(), luci_interpreter::kernels::getTensorShape(), and luci_interpreter::kernels::testing::makeInputTensor().

◆ num_elements()

◆ operator!=()

bool luci_interpreter::Shape::operator!= ( const Shape other) const
inline

Definition at line 76 of file Tensor.h.

76{ return !operator==(other); }
bool operator==(const Shape &other) const
Definition Tensor.h:74

References operator==().

◆ operator==()

bool luci_interpreter::Shape::operator== ( const Shape other) const
inline

Definition at line 74 of file Tensor.h.

74{ return _dims == other._dims; }

Referenced by operator!=().


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