2 #ifndef _NNDEPLOY_INFERENCE_INFERENCE_PARAM_H_
3 #define _NNDEPLOY_INFERENCE_INFERENCE_PARAM_H_
41 virtual base::Status set(const std::
string& key, base::Any& any);
49 virtual base::Status get(const std::
string& key, base::Any& any);
55 bool getIsPath() const;
56 void setIsPath(
bool is_path);
57 const std::vector<std::
string>& getModelValue() const;
58 void setModelValue(const std::vector<std::
string>& model_value);
59 void setModelValue(const std::
string& model_value,
int i = -1);
60 int getInputNum() const;
61 void setInputNum(
int input_num);
62 const std::vector<std::
string>& getInputName() const;
63 void setInputName(const std::vector<std::
string>& input_name);
64 void setInputName(const std::
string& input_name,
int i = -1);
65 const std::vector<std::vector<
int>>& getInputShape() const;
66 void setInputShape(const std::vector<std::vector<
int>>& input_shape);
67 void setInputShape(const std::vector<
int>& input_shape,
int i = -1);
68 int getOutputNum() const;
69 void setOutputNum(
int output_num);
70 const std::vector<std::
string>& getOutputName() const;
71 void setOutputName(const std::vector<std::
string>& output_name);
72 void setOutputName(const std::
string& output_name,
int i = -1);
75 const std::
string& getLicense() const;
76 void setLicense(const std::
string& license);
77 base::DeviceType getDeviceType() const;
78 void setDeviceType(base::DeviceType type);
79 int getNumThread() const;
80 void setNumThread(
int num_thread);
81 int getGpuTuneKernel() const;
82 void setGpuTuneKernel(
int gpu_tune_kernel);
89 bool getIsDynamicShape() const;
90 void setIsDynamicShape(
bool is_dynamic_shape);
92 void setMinShape(const base::
ShapeMap& min_shape);
94 void setOptShape(const base::
ShapeMap& opt_shape);
96 void setMaxShape(const base::
ShapeMap& max_shape);
97 const std::vector<std::
string>& getCachePath() const;
98 void setCachePath(const std::vector<std::
string>& cache_path);
99 const std::vector<std::
string>& getLibraryPath() const;
100 void setLibraryPath(const std::vector<std::
string>& library_path);
101 void setLibraryPath(const std::
string& library_path,
int i = -1);
105 bool is_path_ = true;
106 std::vector<std::
string> model_value_;
107 std::vector<std::
string> external_model_data_;
109 std::vector<std::
string> input_name_;
110 std::vector<std::vector<
int>> input_shape_;
112 std::vector<std::
string> output_name_;
115 std::
string license_;
116 base::DeviceType device_type_;
118 int gpu_tune_kernel_ = 1;
124 bool is_dynamic_shape_ = false;
128 std::vector<std::
string> cache_path_ = {
""};
129 std::vector<std::string> library_path_ = {
""};
134 rapidjson::Document::AllocatorType& allocator);
156 template <
typename T>
161 virtual std::shared_ptr<InferenceParam> createInferenceParam(
163 return std::make_shared<T>(type);
174 std::map<base::InferenceType, std::shared_ptr<InferenceParamCreator>>&
182 template <
typename T>
InferenceParamCreator is the base class of all inference param creator.
virtual ~InferenceParamCreator()
virtual std::shared_ptr< InferenceParam > createInferenceParam(base::InferenceType type)=0
InferenceParam is the base class of all inference param.
virtual ~InferenceParam()
InferenceParam & operator=(const InferenceParam ¶m)=default
InferenceParam(base::InferenceType type)
virtual base::Status deserialize(rapidjson::Value &json)
InferenceParam(const InferenceParam ¶m)=default
virtual base::Status serialize(rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator)
TypeInferenceParamCreator is the template class of all inference param.
TypeInferenceParamRegister is the template class of all inference.
TypeInferenceParamRegister(base::InferenceType type)
#define NNDEPLOY_CC_API
api
@ kInferenceTypeNotSupport
std::map< std::string, std::vector< int > > ShapeMap
PrecisionType getPrecisionType(DataType data_type)
@ kParallelTypeSequential
@ kShareMemoryTypeNoShare
std::map< base::InferenceType, std::shared_ptr< InferenceParamCreator > > & getGlobalInferenceParamCreatorMap()
Get the Global Inference Param Creator Map object.
std::shared_ptr< InferenceParam > createInferenceParam(base::InferenceType type)
Create a Inference Param object.
#define PARAM_COPY_TO(param_type)
#define PARAM_COPY(param_type)