2 #ifndef _NNDEPLOY_IR_INTERPRET_H_
3 #define _NNDEPLOY_IR_INTERPRET_H_
56 const std::vector<std::string> &model_value,
57 const std::vector<ValueDesc> &input = std::vector<ValueDesc>()) = 0;
85 #ifdef ENABLE_NNDEPLOY_SAFETENSORS_CPP
87 std::shared_ptr<safetensors::safetensors_t> st_ptr);
109 const std::string &weight_file_path);
130 bool is_external_ =
false;
143 bool is_external =
false) = 0;
146 bool is_external =
false) = 0;
154 template <
typename T>
158 bool is_external =
false) {
159 return new T(model_desc, is_external);
161 virtual std::shared_ptr<Interpret> createInterpretSharedPtr(
163 bool is_external =
false) {
164 return std::make_shared<T>(model_desc, is_external);
174 std::map<base::ModelType, std::shared_ptr<InterpretCreator>> &
182 template <
typename T>
198 bool is_external =
false);
202 bool is_external =
false);
virtual Interpret * createInterpret(base::ModelType type, ir::ModelDesc *model_desc=nullptr, bool is_external=false)=0
virtual ~InterpretCreator()
virtual std::shared_ptr< Interpret > createInterpretSharedPtr(base::ModelType type, ir::ModelDesc *model_desc=nullptr, bool is_external=false)=0
base::Status saveModelToFile(const std::string &structure_file_path, const std::string &weight_file_path)
存储模型结构以及模型权重
ModelDesc * getModelDesc()
获取模型描述
virtual ~Interpret()
虚析构函数
virtual base::Status interpret(const std::vector< std::string > &model_value, const std::vector< ValueDesc > &input=std::vector< ValueDesc >())=0
解释模型
Interpret(ModelDesc *model_desc=nullptr, bool is_external=false)
解释器类的默认构造函数
base::Status dump(std::ostream &oss=std::cout)
TypeInterpretRegister(base::ModelType type)
#define NNDEPLOY_CC_API
api
std::shared_ptr< Interpret > createInterpretSharedPtr(base::ModelType type, ir::ModelDesc *model_desc=nullptr, bool is_external=false)
std::map< base::ModelType, std::shared_ptr< InterpretCreator > > & getGlobalInterpretCreatorMap()
Get the Global Interpret Creator Map object.
Interpret * createInterpret(base::ModelType type, ir::ModelDesc *model_desc=nullptr, bool is_external=false)
Create a Interpret object.