ONE - On-device Neural Engine
Loading...
Searching...
No Matches
circle_eval_diff::Tensor Struct Referencefinal

#include <Tensor.h>

Collaboration diagram for circle_eval_diff::Tensor:

Public Member Functions

template<loco::DataType DT>
uint32_t size (void) const
 
template<loco::DataType DT>
void size (uint32_t size)
 
template<loco::DataType DT>
const loco::DataTypeImpl< DT >::Type & at (uint32_t n) const
 
template<loco::DataType DT>
loco::DataTypeImpl< DT >::Type & at (uint32_t n)
 
uint8_t * buffer (void)
 
uint32_t byte_size (void) const
 
- Public Member Functions inherited from circle_eval_diff::TensorShape
uint32_t rank (void) const
 
void rank (uint32_t value)
 
const loco::Dimensiondim (uint32_t axis) const
 
loco::Dimensiondim (uint32_t axis)
 
void shape (std::initializer_list< uint32_t > dims)
 
- Public Member Functions inherited from circle_eval_diff::TensorDataType
const loco::DataTypedtype (void) const
 
void dtype (const loco::DataType &dtype)
 

Detailed Description

Definition at line 66 of file Tensor.h.

Member Function Documentation

◆ at() [1/2]

template<loco::DataType DT>
loco::DataTypeImpl< DT >::Type & Tensor::at ( uint32_t  n)

Definition at line 65 of file Tensor.cpp.

66{
67 assert(dtype() == DT);
68 THROW_UNLESS(n < size<DT>(), "Access to out of buffer boundary.");
69 return *(reinterpret_cast<typename loco::DataTypeImpl<DT>::Type *>(_data.data()) + n);
70}
#define THROW_UNLESS(COND, MSG)
const loco::DataType & dtype(void) const
Definition Tensor.h:31
C++ scalar type corresponding to each DataType.

References circle_eval_diff::TensorDataType::dtype(), and THROW_UNLESS.

◆ at() [2/2]

template<loco::DataType DT>
const loco::DataTypeImpl< DT >::Type & Tensor::at ( uint32_t  n) const

Definition at line 58 of file Tensor.cpp.

59{
60 assert(dtype() == DT);
61 THROW_UNLESS(n < size<DT>(), "Access to out of buffer boundary.");
62 return *(reinterpret_cast<const typename loco::DataTypeImpl<DT>::Type *>(_data.data()) + n);
63}

References circle_eval_diff::TensorDataType::dtype(), and THROW_UNLESS.

◆ buffer()

uint8_t * circle_eval_diff::Tensor::buffer ( void  )
inline

Definition at line 73 of file Tensor.h.

73{ return _data.data(); }

◆ byte_size()

uint32_t circle_eval_diff::Tensor::byte_size ( void  ) const
inline

Definition at line 74 of file Tensor.h.

74{ return _data.size(); }

◆ size() [1/2]

template<loco::DataType DT>
void Tensor::size ( uint32_t  size)

Definition at line 51 of file Tensor.cpp.

52{
53 assert(dtype() == DT);
54 _data.resize(l * sizeof(typename loco::DataTypeImpl<DT>::Type));
55}

References circle_eval_diff::TensorDataType::dtype().

◆ size() [2/2]

template<loco::DataType DT>
uint32_t Tensor::size ( void  ) const

Definition at line 44 of file Tensor.cpp.

45{
46 assert(dtype() == DT);
47 assert(_data.size() % sizeof(typename loco::DataTypeImpl<DT>::Type) == 0);
48 return _data.size() / sizeof(typename loco::DataTypeImpl<DT>::Type);
49}

References circle_eval_diff::TensorDataType::dtype().


The documentation for this struct was generated from the following files: