Lines Matching refs:model

21  * @brief provide the model reasoning related interfaces of MindSpore Lite.

28 * @file model.h
30 * @brief provide model-related interfaces that can be used for model creation, model reasoning, and more.
70 * @brief Create a model object.
78 * @brief Destroy the model object.
80 * @param model Model object handle address.
83 OH_AI_API void OH_AI_ModelDestroy(OH_AI_ModelHandle *model);
86 * @brief Build the model from model file buffer so that it can run on a device.
88 * @param model Model object handle.
89 * @param model_data Define the buffer read from a model file.
90 * @param data_size Define bytes number of model file buffer.
91 * @param model_type Define The type of model file.
96 OH_AI_API OH_AI_Status OH_AI_ModelBuild(OH_AI_ModelHandle model, const void *model_data, size_t data_size,
100 * @brief Load and build the model from model path so that it can run on a device.
102 * @param model Model object handle.
103 * @param model_path Define the model file path.
104 * @param model_type Define The type of model file.
109 OH_AI_API OH_AI_Status OH_AI_ModelBuildFromFile(OH_AI_ModelHandle model, const char *model_path,
115 * @param model Model object handle.
122 OH_AI_API OH_AI_Status OH_AI_ModelResize(OH_AI_ModelHandle model, const OH_AI_TensorHandleArray inputs,
126 * @brief Inference model.
128 * @param model Model object handle.
136 OH_AI_API OH_AI_Status OH_AI_ModelPredict(OH_AI_ModelHandle model, const OH_AI_TensorHandleArray inputs,
141 * @brief Obtains all input tensor handles of the model.
143 * @param model Model object handle.
147 OH_AI_API OH_AI_TensorHandleArray OH_AI_ModelGetInputs(const OH_AI_ModelHandle model);
150 * @brief Obtains all output tensor handles of the model.
152 * @param model Model object handle.
156 OH_AI_API OH_AI_TensorHandleArray OH_AI_ModelGetOutputs(const OH_AI_ModelHandle model);
159 * @brief Obtains the input tensor handle of the model by name.
161 * @param model Model object handle.
166 OH_AI_API OH_AI_TensorHandle OH_AI_ModelGetInputByTensorName(const OH_AI_ModelHandle model, const char *tensor_name);
169 * @brief Obtains the output tensor handle of the model by name.
171 * @param model Model object handle.
176 OH_AI_API OH_AI_TensorHandle OH_AI_ModelGetOutputByTensorName(const OH_AI_ModelHandle model, const char *tensor_name);
233 * @brief Build the train model from model buffer so that it can run on a device. Only valid for Lite Train.
235 * @param model Model object handle.
236 * @param model_data Define the buffer read from a model file.
237 * @param data_size Define bytes number of model file buffer.
238 * @param model_type Define The type of model file.
244 OH_AI_API OH_AI_Status OH_AI_TrainModelBuild(OH_AI_ModelHandle model, const void *model_data, size_t data_size,
249 * @brief Build the train model from model file buffer so that it can run on a device. Only valid for Lite Train.
251 * @param model Model object handle.
252 * @param model_path Define the model path.
253 * @param model_type Define The type of model file.
259 OH_AI_API OH_AI_Status OH_AI_TrainModelBuildFromFile(OH_AI_ModelHandle model, const char *model_path,
265 * @brief Train model by step. Only valid for Lite Train.
267 * @param model Model object handle.
273 OH_AI_API OH_AI_Status OH_AI_RunStep(OH_AI_ModelHandle model, const OH_AI_KernelCallBack before,
283 OH_AI_API OH_AI_Status OH_AI_ModelSetLearningRate(OH_AI_ModelHandle model, float learning_rate);
288 * @param model Model object handle.
292 OH_AI_API float OH_AI_ModelGetLearningRate(OH_AI_ModelHandle model);
295 * @brief Obtains all weights tensors of the model. Only valid for Lite Train.
297 * @param model Model object handle.
301 OH_AI_API OH_AI_TensorHandleArray OH_AI_ModelGetWeights(OH_AI_ModelHandle model);
304 * @brief update weights tensors of the model. Only valid for Lite Train.
310 OH_AI_API OH_AI_Status OH_AI_ModelUpdateWeights(OH_AI_ModelHandle model, const OH_AI_TensorHandleArray new_weights);
313 * @brief Get the model running mode.
315 * @param model Model object handle.
319 OH_AI_API bool OH_AI_ModelGetTrainMode(OH_AI_ModelHandle model);
322 * @brief Set the model running mode. Only valid for Lite Train.
324 * @param model Model object handle.
325 * @param train True means model runs in Train Mode, otherwise Eval Mode.
329 OH_AI_API OH_AI_Status OH_AI_ModelSetTrainMode(OH_AI_ModelHandle model, bool train);
334 * @param model Model object handle.
341 OH_AI_API OH_AI_Status OH_AI_ModelSetupVirtualBatch(OH_AI_ModelHandle model, int virtual_batch_multiplier, float lr,
345 * @brief Export training model from file. Only valid for Lite Train.
347 * @param model The model data.
348 * @param model_type The model file type.
349 * @param model_file The exported model file.
351 * @param export_inference_only Whether to export a reasoning only model.
352 * @param output_tensor_name The set the name of the output tensor of the exported reasoning model, default as
353 * empty, and export the complete reasoning model.
358 OH_AI_API OH_AI_Status OH_AI_ExportModel(OH_AI_ModelHandle model, OH_AI_ModelType model_type, const char *model_file,
363 * @brief Export training model from buffer. Only valid for Lite Train.
365 * @param model The model data.
366 * @param model_type The model file type.
367 * @param model_data The exported model buffer.
368 * @param data_size The exported model buffer size.
370 * @param export_inference_only Whether to export a reasoning only model.
371 * @param output_tensor_name The set the name of the output tensor of the exported reasoning model, default as
372 * empty, and export the complete reasoning model.
377 OH_AI_API OH_AI_Status OH_AI_ExportModelBuffer(OH_AI_ModelHandle model, OH_AI_ModelType model_type, void *model_data,
382 * @brief Export model's weights, which can be used in micro only. Only valid for Lite Train.
384 * @param model The model data.
385 * @param model_type The model file type.
387 * @param is_inference Whether to export weights from a reasoning model. Currently, only support this is `true`.
394 OH_AI_API OH_AI_Status OH_AI_ExportWeightsCollaborateWithMicro(OH_AI_ModelHandle model, OH_AI_ModelType model_type,