ONE - On-device Neural Engine
Loading...
Searching...
No Matches
mpqsolver::core::Dumper Class Referencefinal

#include <Dumper.h>

Public Member Functions

 Dumper ()=default
 
 Dumper (const std::string &dir_path)
 
void setModelPath (const std::string &model_path)
 sets model path for further usage
 
void dumpMPQConfiguration (const LayerParams &layers, const std::string &def_dtype, const std::string &def_granularity, int step) const
 dumps mpq configuration
 
void dumpFinalMPQ (const LayerParams &layers, const std::string &def_dtype, const std::string &def_granularity) const
 dumps final mpq configuration
 
void dumpQuantized (luci::Module *module, uint32_t step) const
 dumps quantized module
 
void prepareForErrorDumping () const
 create file for error dumping
 
void dumpQ8Error (float error) const
 append error of Q8 quantization
 
void dumpQ16Error (float error) const
 append error of Q16 quantization
 
void dumpMPQError (float error, uint32_t step) const
 append error of mpq quantization
 
void dumpMPQError (float error) const
 dump final error
 

Detailed Description

Definition at line 33 of file Dumper.h.

Constructor & Destructor Documentation

◆ Dumper() [1/2]

mpqsolver::core::Dumper::Dumper ( )
default

◆ Dumper() [2/2]

Dumper::Dumper ( const std::string &  dir_path)

Definition at line 41 of file Dumper.cpp.

41: _dir_path(dir_path) {}

Member Function Documentation

◆ dumpFinalMPQ()

void Dumper::dumpFinalMPQ ( const LayerParams layers,
const std::string &  def_dtype,
const std::string &  def_granularity 
) const

dumps final mpq configuration

Parameters
layersspecific quantization parameters
def_dtypedefault quantization data type
def_granularitydefault granularity

Definition at line 90 of file Dumper.cpp.

92{
93 prepareDirectory(_dir_path);
94 std::string path = _dir_path + "/FinalConfiguration" + ".mpq.json";
95 dumpMPQConfiguration(layers, def_dtype, def_granularity, path);
96}
void dumpMPQConfiguration(const LayerParams &layers, const std::string &def_dtype, const std::string &def_granularity, int step) const
dumps mpq configuration
Definition Dumper.cpp:82

References dumpMPQConfiguration().

Referenced by mpqsolver::core::DumpingHooks::onEndSolver().

◆ dumpMPQConfiguration()

void Dumper::dumpMPQConfiguration ( const LayerParams layers,
const std::string &  def_dtype,
const std::string &  def_granularity,
int  step 
) const

dumps mpq configuration

Parameters
layersspecific quantization parameters
def_dtypedefault quantization data type
def_granularitydefault granularity
stepid of mpq configuration

Definition at line 82 of file Dumper.cpp.

84{
85 prepareDirectory(_dir_path);
86 std::string path = _dir_path + "/Configuration_" + std::to_string(step) + ".mpq.json";
87 dumpMPQConfiguration(layers, def_dtype, def_granularity, path);
88}

References dumpMPQConfiguration().

Referenced by dumpFinalMPQ(), dumpMPQConfiguration(), and mpqsolver::core::DumpingHooks::onEndIteration().

◆ dumpMPQError() [1/2]

void Dumper::dumpMPQError ( float  error) const

dump final error

Parameters
errorfinal error of quantization

Definition at line 157 of file Dumper.cpp.

158{
159 std::string path = getErrorPath();
160 dumpError(error, "FINAL", path);
161}

◆ dumpMPQError() [2/2]

void Dumper::dumpMPQError ( float  error,
uint32_t  step 
) const

append error of mpq quantization

Parameters
errorerror of quantization
stepid of error

Definition at line 151 of file Dumper.cpp.

152{
153 std::string path = getErrorPath();
154 dumpError(error, std::to_string(step), path);
155}

Referenced by mpqsolver::core::DumpingHooks::onEndIteration(), and mpqsolver::core::DumpingHooks::onEndSolver().

◆ dumpQ16Error()

void Dumper::dumpQ16Error ( float  error) const

append error of Q16 quantization

Definition at line 145 of file Dumper.cpp.

146{
147 std::string path = getErrorPath();
148 dumpError(error, "Q16", path);
149}

Referenced by mpqsolver::core::DumpingHooks::onBeginSolver().

◆ dumpQ8Error()

void Dumper::dumpQ8Error ( float  error) const

append error of Q8 quantization

Definition at line 139 of file Dumper.cpp.

140{
141 std::string path = getErrorPath();
142 dumpError(error, "Q8", path);
143}

Referenced by mpqsolver::core::DumpingHooks::onBeginSolver().

◆ dumpQuantized()

void Dumper::dumpQuantized ( luci::Module module,
uint32_t  step 
) const

dumps quantized module

Parameters
layersspecific quantization parameters
stepid of quantized module

Definition at line 116 of file Dumper.cpp.

117{
118 std::string path = _dir_path + "/quantized_" + std::to_string(step) + ".mpq.circle";
119 saveCircle(module, path);
120}

Referenced by mpqsolver::core::DumpingHooks::onQuantized().

◆ prepareForErrorDumping()

void Dumper::prepareForErrorDumping ( ) const

create file for error dumping

Definition at line 130 of file Dumper.cpp.

131{
132 prepareDirectory(_dir_path);
133 std::string path = getErrorPath();
134 std::ofstream file;
135 file.open(path); // create empty
136 file.close();
137}

Referenced by mpqsolver::core::DumpingHooks::onBeginSolver().

◆ setModelPath()

void Dumper::setModelPath ( const std::string &  model_path)

sets model path for further usage

Definition at line 43 of file Dumper.cpp.

Referenced by mpqsolver::core::DumpingHooks::onBeginSolver().


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