ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci::ImporterEx Class Referencefinal

#include <ImporterEx.h>

Public Member Functions

 ImporterEx ()=default
 
 ImporterEx (const GraphBuilderSource *source)
 
std::unique_ptr< ModuleimportVerifyModule (const std::string &input_path) const
 
std::unique_ptr< ModuleimportModule (const std::vector< char > &model_data) const
 

Detailed Description

Definition at line 34 of file ImporterEx.h.

Constructor & Destructor Documentation

◆ ImporterEx() [1/2]

luci::ImporterEx::ImporterEx ( )
default

◆ ImporterEx() [2/2]

luci::ImporterEx::ImporterEx ( const GraphBuilderSource source)
inlineexplicit

Definition at line 41 of file ImporterEx.h.

41 : _source{source}
42 {
43 // DO NOTHING
44 }

Member Function Documentation

◆ importModule()

std::unique_ptr< Module > luci::ImporterEx::importModule ( const std::vector< char > &  model_data) const

Definition at line 68 of file ImporterEx.cpp.

69{
70 auto data_data = reinterpret_cast<const uint8_t *>(model_data.data());
71 auto data_size = model_data.size();
72
73 Importer importer(_source);
74 return importer.importModule(data_data, data_size);
75}
model_data
Definition infer.py:82

Referenced by entry().

◆ importVerifyModule()

std::unique_ptr< Module > luci::ImporterEx::importVerifyModule ( const std::string &  input_path) const

Definition at line 36 of file ImporterEx.cpp.

37{
38 foder::FileLoader file_loader{input_path};
39 std::vector<char> model_data;
40
41 try
42 {
43 model_data = file_loader.load();
44 }
45 catch (const std::runtime_error &err)
46 {
47 std::cerr << err.what() << std::endl;
48 return nullptr;
49 }
50
51 auto data_data = reinterpret_cast<uint8_t *>(model_data.data());
52 auto data_size = model_data.size();
53
54 if (data_size < FLATBUFFERS_SIZE_MAX)
55 {
56 flatbuffers::Verifier verifier{data_data, data_size};
57 if (!circle::VerifyModelBuffer(verifier))
58 {
59 std::cerr << "ERROR: Invalid input file '" << input_path << "'" << std::endl;
60 return nullptr;
61 }
62 }
63
64 Importer importer(_source);
65 return importer.importModule(data_data, data_size);
66}
constexpr uint64_t FLATBUFFERS_SIZE_MAX

References FLATBUFFERS_SIZE_MAX.

Referenced by mpqsolver::core::H5FileDataProvider::H5FileDataProvider(), dalgona::Dalgona::initialize(), and record_minmax::RecordMinMax::initialize().


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