ONE - On-device Neural Engine
Loading...
Searching...
No Matches
mir::Tensor< T > Class Template Referencefinal

#include <Tensor.h>

Public Member Functions

 Tensor (const TensorVariant &t)
 
at (const Index &id) const
 
T & at (const Index &id)
 
atOffset (int32_t offset) const
 
T & atOffset (int32_t offset)
 
ExternalRegion< T > getRegion (const Index &idx)
 
const ShapegetShape () const
 

Detailed Description

template<typename T>
class mir::Tensor< T >

Definition at line 26 of file Tensor.h.

Constructor & Destructor Documentation

◆ Tensor()

template<typename T >
mir::Tensor< T >::Tensor ( const TensorVariant t)
inlineexplicit

Definition at line 29 of file Tensor.h.

29: _proxy(t) {}

Member Function Documentation

◆ at() [1/2]

template<typename T >
T & mir::Tensor< T >::at ( const Index id)
inline

Definition at line 33 of file Tensor.h.

33{ return *reinterpret_cast<T *>(this->_proxy.at(id)); }
char * at(const Index &idx) const

References mir::TensorVariant::at().

◆ at() [2/2]

template<typename T >
T mir::Tensor< T >::at ( const Index id) const
inline

Definition at line 31 of file Tensor.h.

31{ return *reinterpret_cast<T *>(this->_proxy.at(id)); }

References mir::TensorVariant::at().

Referenced by mir_caffe::CaffeOpCreator::convertBatchNorm(), mir_onnx::convertBatchNormalizationV9(), mir_tflite::TFLiteOpCreator::convertPad(), mir_caffe2::Caffe2OpCreator::convertReshape(), mir_onnx::convertReshapeV5(), mir_tflite::TFLiteOpCreator::convertResizeNearestNeighbor(), mir_caffe2::Caffe2OpCreator::convertSpatialBN(), mir_interpreter::Dequantize(), mir_interpreter::Quantize(), mir_interpreter::AvgPool2DImpl< uint8_t >::run(), mir_interpreter::AvgPool2DImpl< T >::run(), mir_interpreter::DepthwiseConv2DImpl< T >::run(), mir_interpreter::DepthwiseConv2DImpl< uint8_t >::run(), mir_interpreter::ELUImpl< T >::run(), mir_interpreter::LeakyReLUImpl< T >::run(), mir_interpreter::CappedReLUImpl< T >::run(), mir_interpreter::CappedReLUImpl< uint8_t >::run(), mir_interpreter::SoftmaxImpl< T >::run(), mir_interpreter::AbsImpl< T >::run(), mir_interpreter::ReLUImpl< T >::run(), mir_interpreter::SigmoidImpl< T >::run(), mir_interpreter::SqrtImpl< T >::run(), mir_interpreter::TanhImpl< T >::run(), mir_interpreter::MaxPool2DImpl< uint8_t >::run(), mir_interpreter::MaxPool2DImpl< T >::run(), mir_interpreter::PadImpl< T >::run(), mir_interpreter::ReduceMeanImpl< T >::run(), mir_interpreter::FullyConnectedImpl< T >::run(), mir_interpreter::Conv2DImpl< uint8_t >::run(), mir_interpreter::AddImpl< T >::run(), mir_interpreter::AddImpl< uint8_t >::run(), mir_interpreter::DivImpl< T >::run(), mir_interpreter::EqualImpl< T >::run(), mir_interpreter::GreaterImpl< T >::run(), mir_interpreter::LessImpl< T >::run(), mir_interpreter::MaxImpl< T >::run(), mir_interpreter::MulImpl< T >::run(), mir_interpreter::SubImpl< T >::run(), and mir_interpreter::FillImpl< T >::run().

◆ atOffset() [1/2]

template<typename T >
T & mir::Tensor< T >::atOffset ( int32_t  offset)
inline

Definition at line 37 of file Tensor.h.

37{ return *reinterpret_cast<T *>(this->_proxy.atOffset(offset)); }
char * atOffset(int32_t offset) const
__global uchar * offset(const Image *img, int x, int y)
Definition helpers.h:540

References mir::TensorVariant::atOffset(), and offset().

◆ atOffset() [2/2]

template<typename T >
T mir::Tensor< T >::atOffset ( int32_t  offset) const
inline

Definition at line 35 of file Tensor.h.

35{ return *reinterpret_cast<T *>(this->_proxy.atOffset(offset)); }

References mir::TensorVariant::atOffset(), and offset().

Referenced by mir_interpreter::GatherImpl< T, IndicesT >::run().

◆ getRegion()

template<typename T >
ExternalRegion< T > mir::Tensor< T >::getRegion ( const Index idx)
inline

Definition at line 39 of file Tensor.h.

40 {
41 // Only last dimension is safe to process continiously
42 auto last_dim = getShape().rank() - 1;
43 auto base = reinterpret_cast<T *>(_proxy.at(idx));
44 auto length = getShape().dim(last_dim) - idx.at(last_dim);
45 return ExternalRegion<T>(base, length);
46 }
int32_t & dim(int32_t axis) noexcept
Definition Shape.h:47
int32_t rank() const
Definition Shape.h:43
const Shape & getShape() const
Definition Tensor.h:48

References mir::TensorVariant::at(), mir::Index::at(), mir::Shape::dim(), mir::Tensor< T >::getShape(), and mir::Shape::rank().

◆ getShape()


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