ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert::ir::TypeInfo Class Reference

#include <TypeInfo.h>

Public Member Functions

 TypeInfo ()=delete
 
 TypeInfo (DataType type)
 
 TypeInfo (DataType type, float scale, int32_t zero_point)
 
DataType type () const
 
float scale () const
 
const std::vector< float > & scales () const
 
int32_t zero_point () const
 
const std::vector< int32_t > & zero_points () const
 
const ir::Sparsitysparsity () const
 
void quantization (float scale, int32_t zero_point)
 
void quantization (std::vector< float > &&scales, std::vector< int32_t > &&zero_points)
 
void sparsity (std::shared_ptr< ir::Sparsity > sparsity)
 
void type (const DataType type)
 

Detailed Description

Definition at line 39 of file TypeInfo.h.

Constructor & Destructor Documentation

◆ TypeInfo() [1/3]

onert::ir::TypeInfo::TypeInfo ( )
delete

◆ TypeInfo() [2/3]

onert::ir::TypeInfo::TypeInfo ( DataType  type)
inlineexplicit

Definition at line 44 of file TypeInfo.h.

44: _type{type}, _sparsity{nullptr} {}
DataType type() const
Definition TypeInfo.h:52

◆ TypeInfo() [3/3]

onert::ir::TypeInfo::TypeInfo ( DataType  type,
float  scale,
int32_t  zero_point 
)
inline

Definition at line 46 of file TypeInfo.h.

46 : _type{type}, _sparsity{nullptr}
47 {
49 }
void quantization(float scale, int32_t zero_point)
Definition TypeInfo.h:62
float scale() const
Definition TypeInfo.h:53
int32_t zero_point() const
Definition TypeInfo.h:55

References quantization(), scale(), and zero_point().

Member Function Documentation

◆ quantization() [1/2]

void onert::ir::TypeInfo::quantization ( float  scale,
int32_t  zero_point 
)
inline

Definition at line 62 of file TypeInfo.h.

63 {
64 _quant.scales.resize(1);
65 _quant.scales[0] = scale;
66 _quant.zero_points.resize(1);
67 _quant.zero_points[0] = zero_point;
68 }
std::vector< float > scales
Definition TypeInfo.h:35
std::vector< int32_t > zero_points
Definition TypeInfo.h:36

References scale(), onert::ir::Quantization::scales, zero_point(), and onert::ir::Quantization::zero_points.

Referenced by onert::loader::BaseLoader< LoaderDomain >::loadQuantization(), and TypeInfo().

◆ quantization() [2/2]

void onert::ir::TypeInfo::quantization ( std::vector< float > &&  scales,
std::vector< int32_t > &&  zero_points 
)
inline

Definition at line 69 of file TypeInfo.h.

70 {
71 _quant.scales = scales;
72 _quant.zero_points = zero_points;
73 }
const std::vector< float > & scales() const
Definition TypeInfo.h:54
const std::vector< int32_t > & zero_points() const
Definition TypeInfo.h:60

References onert::ir::Quantization::scales, scales(), onert::ir::Quantization::zero_points, and zero_points().

◆ scale()

float onert::ir::TypeInfo::scale ( ) const
inline

◆ scales()

const std::vector< float > & onert::ir::TypeInfo::scales ( ) const
inline

Definition at line 54 of file TypeInfo.h.

54{ return _quant.scales; }

References onert::ir::Quantization::scales.

Referenced by onert::backend::IPortableTensor::data_scales(), and quantization().

◆ sparsity() [1/2]

const ir::Sparsity * onert::ir::TypeInfo::sparsity ( ) const
inline

Definition at line 61 of file TypeInfo.h.

61{ return _sparsity.get(); }

Referenced by onert::loader::BaseLoader< LoaderDomain >::loadSparsity(), and onert::backend::IPortableTensor::sparsity().

◆ sparsity() [2/2]

void onert::ir::TypeInfo::sparsity ( std::shared_ptr< ir::Sparsity sparsity)
inline

Definition at line 74 of file TypeInfo.h.

74{ _sparsity = sparsity; }
const ir::Sparsity * sparsity() const
Definition TypeInfo.h:61

References sparsity().

Referenced by sparsity().

◆ type() [1/2]

◆ type() [2/2]

void onert::ir::TypeInfo::type ( const DataType  type)
inline

Definition at line 77 of file TypeInfo.h.

77{ _type = type; }

References type().

Referenced by type().

◆ zero_point()

int32_t onert::ir::TypeInfo::zero_point ( ) const
inline

◆ zero_points()

const std::vector< int32_t > & onert::ir::TypeInfo::zero_points ( ) const
inline

Definition at line 60 of file TypeInfo.h.

60{ return _quant.zero_points; }

References onert::ir::Quantization::zero_points.

Referenced by onert::backend::IPortableTensor::data_zero_points(), and quantization().


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