ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert::trix_loader::TrixMetaReader Class Reference

A tvn metadata reader. More...

Public Member Functions

 TrixMetaReader ()=default
 
 ~TrixMetaReader ()
 
void init (const char *path)
 
data_layout input_seg_layout (uint32_t n) const
 
data_layout output_seg_layout (uint32_t n) const
 
data_type input_seg_quant_type (uint32_t n) const
 
data_type output_seg_quant_type (uint32_t n) const
 
float input_seg_quant_scale (uint32_t n) const
 
float output_seg_quant_scale (uint32_t n) const
 
int32_t input_seg_quant_zp (uint32_t n)
 
int32_t output_seg_quant_zp (uint32_t n)
 
uint32_t input_seg_num () const
 
uint32_t output_seg_num () const
 
uint32_t input_seg_dims (uint32_t n, uint32_t axis) const
 
uint32_t output_seg_dims (uint32_t n, uint32_t axis) const
 

Detailed Description

A tvn metadata reader.

Definition at line 33 of file TrixLoader.cc.

Constructor & Destructor Documentation

◆ TrixMetaReader()

onert::trix_loader::TrixMetaReader::TrixMetaReader ( )
default

◆ ~TrixMetaReader()

onert::trix_loader::TrixMetaReader::~TrixMetaReader ( )
inline

Definition at line 37 of file TrixLoader.cc.

37{ free(_meta); }

Member Function Documentation

◆ init()

void onert::trix_loader::TrixMetaReader::init ( const char *  path)

Definition at line 63 of file TrixLoader.cc.

64{
65 assert(path);
66 _meta = getNPUmodel_metadata(path, false);
67 if (_meta == nullptr)
68 {
69 throw std::runtime_error("Failed to get TRIX model metadata");
70 }
71 if (NPUBIN_VERSION(_meta->magiccode) != 3)
72 {
73 throw std::runtime_error("TRIX model metadata version mismatched.");
74 }
75}

Referenced by onert::trix_loader::TrixLoader::loadFromFile().

◆ input_seg_dims()

uint32_t onert::trix_loader::TrixMetaReader::input_seg_dims ( uint32_t  n,
uint32_t  axis 
) const
inline

Definition at line 50 of file TrixLoader.cc.

51 {
52 return _meta->input_seg_dims[n][axis];
53 }

◆ input_seg_layout()

data_layout onert::trix_loader::TrixMetaReader::input_seg_layout ( uint32_t  n) const
inline

Definition at line 40 of file TrixLoader.cc.

40{ return _meta->input_seg_layout[n]; }

◆ input_seg_num()

uint32_t onert::trix_loader::TrixMetaReader::input_seg_num ( ) const
inline

Definition at line 48 of file TrixLoader.cc.

48{ return _meta->input_seg_num; }

◆ input_seg_quant_scale()

float onert::trix_loader::TrixMetaReader::input_seg_quant_scale ( uint32_t  n) const
inline

Definition at line 44 of file TrixLoader.cc.

44{ return _meta->input_seg_quant_s[n]; }

◆ input_seg_quant_type()

data_type onert::trix_loader::TrixMetaReader::input_seg_quant_type ( uint32_t  n) const
inline

Definition at line 42 of file TrixLoader.cc.

42{ return _meta->input_seg_quant_type[n]; }

◆ input_seg_quant_zp()

int32_t onert::trix_loader::TrixMetaReader::input_seg_quant_zp ( uint32_t  n)
inline

Definition at line 46 of file TrixLoader.cc.

46{ return _meta->input_seg_quant_z[n]; }

◆ output_seg_dims()

uint32_t onert::trix_loader::TrixMetaReader::output_seg_dims ( uint32_t  n,
uint32_t  axis 
) const
inline

Definition at line 54 of file TrixLoader.cc.

55 {
56 return _meta->output_seg_dims[n][axis];
57 }

◆ output_seg_layout()

data_layout onert::trix_loader::TrixMetaReader::output_seg_layout ( uint32_t  n) const
inline

Definition at line 41 of file TrixLoader.cc.

41{ return _meta->output_seg_layout[n]; }

◆ output_seg_num()

uint32_t onert::trix_loader::TrixMetaReader::output_seg_num ( ) const
inline

Definition at line 49 of file TrixLoader.cc.

49{ return _meta->output_seg_num; }

◆ output_seg_quant_scale()

float onert::trix_loader::TrixMetaReader::output_seg_quant_scale ( uint32_t  n) const
inline

Definition at line 45 of file TrixLoader.cc.

45{ return _meta->output_seg_quant_s[n]; }

◆ output_seg_quant_type()

data_type onert::trix_loader::TrixMetaReader::output_seg_quant_type ( uint32_t  n) const
inline

Definition at line 43 of file TrixLoader.cc.

43{ return _meta->output_seg_quant_type[n]; }

◆ output_seg_quant_zp()

int32_t onert::trix_loader::TrixMetaReader::output_seg_quant_zp ( uint32_t  n)
inline

Definition at line 47 of file TrixLoader.cc.

47{ return _meta->output_seg_quant_z[n]; }

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