ONE - On-device Neural Engine
|
#include <Tensor.h>
Public Member Functions | |
Tensor (DataType element_type, Shape shape, AffineQuantization quantization, std::string name) | |
DataType | element_type () const |
const Shape & | shape () const |
float | scale () const |
int32_t | zero_point () const |
const std::vector< float > & | scales () const |
const std::vector< int32_t > & | zero_points () const |
int32_t | quantized_dimension () const |
template<typename T > | |
const T * | data () const |
template<typename T > | |
T * | data () |
const std::string & | name () const |
void | readData (void *data_ptr, size_t data_size) const |
void | writeData (const void *data_ptr, size_t data_size) |
void | resize (const Shape &new_shape) |
void | set_data_buffer (uint8_t *buffer) |
bool | is_observable () const |
void | set_observable (bool value) |
bool | is_allocatable () const |
void | set_allocatable (bool value) |
bool | is_data_allocated () const |
int32_t | get_offset () const |
void | set_offset (int32_t offset) |
Static Public Member Functions | |
static float | scale (const circle::Tensor *circle_tensor) |
static int32_t | zero_point (const circle::Tensor *circle_tensor) |
static const std::vector< float > | scales (const circle::Tensor *circle_tensor) |
static const std::vector< int32_t > | zero_points (const circle::Tensor *circle_tensor) |
static int32_t | quantized_dimension (const circle::Tensor *circle_tensor) |
static bool | is_constant_tensor (const luci_interpreter::CircleReader *reader, const circle::Tensor *circle_tensor) |
static DataType | element_type (const circle::Tensor *circle_tensor) |
static VectorWrapper< int32_t > | tensor_shape (const circle::Tensor *circle_tensor) |
static int | num_dims (const circle::Tensor *circle_tensor) |
static int32_t | dim (const circle::Tensor *circle_tensor, int i) |
static int32_t | num_elements (const circle::Tensor *circle_tensor) |
Tensor::Tensor | ( | DataType | element_type, |
Shape | shape, | ||
AffineQuantization | quantization, | ||
std::string | name | ||
) |
Definition at line 25 of file Tensor.cpp.
|
inline |
|
inline |
Definition at line 127 of file Tensor.h.
Referenced by luci_interpreter::kernels::BatchToSpaceND::configure(), luci_interpreter::kernels::SpaceToBatchND::configure(), luci_interpreter::kernels::ExpandDims::execute(), luci_interpreter::kernels::If::execute(), luci_interpreter::kernels::MirrorPad::execute(), luci_interpreter::kernels::Reshape::execute(), and luci_interpreter::kernels::Squeeze::execute().
|
inlinestatic |
Definition at line 225 of file Tensor.h.
References luci::wrap().
Referenced by num_elements().
|
inline |
Definition at line 105 of file Tensor.h.
Referenced by luci_interpreter::build_kernel_CircleBatchMatMul(), luci_interpreter::build_kernel_CircleFullyConnected(), luci_interpreter::build_kernel_CircleSVDF(), luci_interpreter::build_kernel_CircleTransposeConv(), luci_interpreter::build_kernel_CircleUnidirectionalSequenceLSTM(), luci_interpreter::kernels::Concatenation::configure(), luci_interpreter::kernels::Pack::configure(), luci_interpreter::kernels::Unpack::configure(), luci_interpreter::kernels::FullyConnected::execute(), luci_interpreter::kernels::MirrorPad::execute(), luci_interpreter::kernels::SelectV2::execute(), readData(), record_hessian::HessianComputer::recordHessian(), luci_interpreter::kernels::TransposeRowsColumns(), and writeData().
|
inlinestatic |
Definition at line 208 of file Tensor.h.
References luci::luci_datatype().
|
inline |
|
inline |
|
inlinestatic |
Definition at line 202 of file Tensor.h.
References luci::CircleReader::buffers(), and luci::VectorWrapper< T >::data().
|
inline |
|
inline |
|
inline |
|
inlinestatic |
Definition at line 218 of file Tensor.h.
References luci::wrap().
|
inlinestatic |
Definition at line 235 of file Tensor.h.
References dim(), and luci::wrap().
Referenced by readData(), and writeData().
|
inline |
Definition at line 125 of file Tensor.h.
References luci_interpreter::AffineQuantization::quantized_dimension.
|
inlinestatic |
void Tensor::readData | ( | void * | data_ptr, |
size_t | data_size | ||
) | const |
Definition at line 32 of file Tensor.cpp.
References element_type(), luci_interpreter::getDataTypeSize(), luci_interpreter::Shape::num_elements(), num_elements(), and shape().
void Tensor::resize | ( | const Shape & | new_shape | ) |
Definition at line 56 of file Tensor.cpp.
Referenced by luci_interpreter::kernels::Abs::configure(), luci_interpreter::kernels::Add::configure(), luci_interpreter::kernels::ArgMax::configure(), luci_interpreter::kernels::AveragePool2D::configure(), luci_interpreter::kernels::BatchMatMul::configure(), luci_interpreter::kernels::BatchToSpaceND::configure(), luci_interpreter::kernels::BroadcastTo::configure(), luci_interpreter::kernels::Cast::configure(), luci_interpreter::kernels::Concatenation::configure(), luci_interpreter::kernels::Conv2D::configure(), luci_interpreter::kernels::Cos::configure(), luci_interpreter::kernels::CumSum::configure(), luci_interpreter::kernels::DepthToSpace::configure(), luci_interpreter::kernels::DepthwiseConv2D::configure(), luci_interpreter::kernels::Dequantize::configure(), luci_interpreter::kernels::Div::configure(), luci_interpreter::kernels::Elu::configure(), luci_interpreter::kernels::Equal::configure(), luci_interpreter::kernels::Exp::configure(), luci_interpreter::kernels::ExpandDims::configure(), luci_interpreter::kernels::Floor::configure(), luci_interpreter::kernels::FloorDiv::configure(), luci_interpreter::kernels::FloorMod::configure(), luci_interpreter::kernels::FullyConnected::configure(), luci_interpreter::kernels::Gather::configure(), luci_interpreter::kernels::Gelu::configure(), luci_interpreter::kernels::Greater::configure(), luci_interpreter::kernels::GreaterEqual::configure(), luci_interpreter::kernels::GRU::configure(), luci_interpreter::kernels::HardSwish::configure(), luci_interpreter::kernels::InstanceNorm::configure(), luci_interpreter::kernels::L2Normalize::configure(), luci_interpreter::kernels::L2Pool2D::configure(), luci_interpreter::kernels::LeakyRelu::configure(), luci_interpreter::kernels::Less::configure(), luci_interpreter::kernels::LessEqual::configure(), luci_interpreter::kernels::LocalResponseNormalization::configure(), luci_interpreter::kernels::Log::configure(), luci_interpreter::kernels::LogicalAnd::configure(), luci_interpreter::kernels::LogicalNot::configure(), luci_interpreter::kernels::LogicalOr::configure(), luci_interpreter::kernels::Logistic::configure(), luci_interpreter::kernels::LogSoftmax::configure(), luci_interpreter::kernels::Maximum::configure(), luci_interpreter::kernels::MaxPool2D::configure(), luci_interpreter::kernels::Mean::configure(), luci_interpreter::kernels::Minimum::configure(), luci_interpreter::kernels::MirrorPad::configure(), luci_interpreter::kernels::Mul::configure(), luci_interpreter::kernels::Neg::configure(), luci_interpreter::kernels::NotEqual::configure(), luci_interpreter::kernels::OneHot::configure(), luci_interpreter::kernels::Pack::configure(), luci_interpreter::kernels::Pad::configure(), luci_interpreter::kernels::PadV2::configure(), luci_interpreter::kernels::Pow::configure(), luci_interpreter::kernels::PRelu::configure(), luci_interpreter::kernels::Quantize::configure(), luci_interpreter::kernels::ReduceMax::configure(), luci_interpreter::kernels::ReduceProd::configure(), luci_interpreter::kernels::Relu::configure(), luci_interpreter::kernels::Relu0To1::configure(), luci_interpreter::kernels::Relu6::configure(), luci_interpreter::kernels::Reshape::configure(), luci_interpreter::kernels::ResizeBilinear::configure(), luci_interpreter::kernels::ResizeNearestNeighbor::configure(), luci_interpreter::kernels::ReverseV2::configure(), luci_interpreter::kernels::RmsNorm::configure(), luci_interpreter::kernels::RoPE::configure(), luci_interpreter::kernels::Rsqrt::configure(), luci_interpreter::kernels::Select::configure(), luci_interpreter::kernels::SelectV2::configure(), luci_interpreter::kernels::ShapeKernel::configure(), luci_interpreter::kernels::Sin::configure(), luci_interpreter::kernels::Slice::configure(), luci_interpreter::kernels::Softmax::configure(), luci_interpreter::kernels::SpaceToBatchND::configure(), luci_interpreter::kernels::SpaceToDepth::configure(), luci_interpreter::kernels::Split::configure(), luci_interpreter::kernels::Sqrt::configure(), luci_interpreter::kernels::Square::configure(), luci_interpreter::kernels::SquaredDifference::configure(), luci_interpreter::kernels::Squeeze::configure(), luci_interpreter::kernels::StridedSlice::configure(), luci_interpreter::kernels::Sub::configure(), luci_interpreter::kernels::Sum::configure(), luci_interpreter::kernels::SVDF::configure(), luci_interpreter::kernels::Tanh::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(), and luci_interpreter::kernels::If::execute().
|
inline |
Definition at line 109 of file Tensor.h.
References luci_interpreter::AffineQuantization::scale.
Referenced by luci_interpreter::kernels::LeakyRelu::configure(), luci_interpreter::kernels::Pack::configure(), luci_interpreter::kernels::PRelu::configure(), luci_interpreter::kernels::Relu::configure(), luci_interpreter::kernels::Relu0To1::configure(), luci_interpreter::kernels::Relu6::configure(), luci_interpreter::kernels::Dequantize::execute(), and luci_interpreter::kernels::Quantize::execute().
|
inlinestatic |
|
inline |
Definition at line 121 of file Tensor.h.
References luci_interpreter::AffineQuantization::scale.
Referenced by scales().
|
inlinestatic |
Definition at line 161 of file Tensor.h.
References scales().
|
inline |
|
inline |
|
inline |
Definition at line 164 of file Tensor.h.
Referenced by luci_interpreter::build_kernel_CircleBatchMatMul(), luci_interpreter::build_kernel_CircleConv2D(), luci_interpreter::build_kernel_CircleMean(), luci_interpreter::build_kernel_CircleReduceMax(), luci_interpreter::build_kernel_CircleReduceProd(), luci_interpreter::build_kernel_CircleSum(), luci_interpreter::build_kernel_CircleSVDF(), and luci_interpreter::build_kernel_CircleUnidirectionalSequenceLSTM().
|
inline |
|
inline |
Definition at line 107 of file Tensor.h.
Referenced by RandomDataGenerator.RandomDataGenerator::_gen_float32(), RandomDataGenerator.RandomDataGenerator::_gen_int16(), RandomDataGenerator.RandomDataGenerator::_gen_uint8(), luci_interpreter::build_kernel_CircleFullyConnected(), luci_interpreter::kernels::ArgMax::configure(), luci_interpreter::kernels::AveragePool2D::configure(), luci_interpreter::kernels::BatchToSpaceND::configure(), luci_interpreter::kernels::BroadcastTo::configure(), luci_interpreter::kernels::Cast::configure(), luci_interpreter::kernels::Concatenation::configure(), luci_interpreter::kernels::Conv2D::configure(), luci_interpreter::kernels::DepthToSpace::configure(), luci_interpreter::kernels::DepthwiseConv2D::configure(), luci_interpreter::kernels::ExpandDims::configure(), luci_interpreter::kernels::Fill::configure(), luci_interpreter::kernels::FullyConnected::configure(), luci_interpreter::kernels::Gather::configure(), luci_interpreter::kernels::L2Pool2D::configure(), luci_interpreter::kernels::MaxPool2D::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::ResizeBilinear::configure(), luci_interpreter::kernels::ResizeNearestNeighbor::configure(), luci_interpreter::kernels::RmsNorm::configure(), luci_interpreter::kernels::Select::configure(), luci_interpreter::kernels::SelectV2::configure(), luci_interpreter::kernels::ShapeKernel::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::StridedSlice::configure(), luci_interpreter::kernels::Sum::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_pal::eval_integer_8x8_16_lstm(), luci_interpreter::kernels::lstm::EvalFloat(), luci_interpreter::kernels::ExpandDims::execute(), luci_interpreter::kernels::If::execute(), luci_interpreter::kernels::MirrorPad::execute(), luci_interpreter::kernels::Pad::execute(), luci_interpreter::kernels::PadV2::execute(), luci_interpreter::kernels::Reshape::execute(), luci_interpreter::kernels::StridedSlice::execute(), luci_interpreter::kernels::Transpose::execute(), readData(), and writeData().
|
inlinestatic |
Definition at line 213 of file Tensor.h.
References luci::wrap().
void Tensor::writeData | ( | const void * | data_ptr, |
size_t | data_size | ||
) |
Definition at line 44 of file Tensor.cpp.
References element_type(), luci_interpreter::getDataTypeSize(), luci_interpreter::Shape::num_elements(), num_elements(), and shape().
|
inline |
Definition at line 115 of file Tensor.h.
References luci_interpreter::AffineQuantization::zero_point.
Referenced by luci_interpreter::kernels::Pack::configure(), luci_interpreter::kernels::Dequantize::execute(), luci_interpreter::kernels::Pad::execute(), luci_interpreter::kernels::Quantize::execute(), and luci_interpreter::kernels::SpaceToBatchND::execute().
|
inlinestatic |
|
inline |
Definition at line 123 of file Tensor.h.
References luci_interpreter::AffineQuantization::zero_point.
Referenced by luci_interpreter::kernels::Conv2D::configure(), luci_interpreter::kernels::DepthwiseConv2D::configure(), luci_interpreter::kernels::PRelu::configure(), and zero_points().
|
inlinestatic |
Definition at line 175 of file Tensor.h.
References zero_points().