aclmdlBundleLoadFromFile
Description
If variables need to be dynamically updated during model execution, this API can be called to load offline model data (offline model adapted to the Ascend AI Processor) from a file. The memory is managed by the system.
This API needs to be used with other APIs to dynamically update variables. The process of calling the key APIs is as follows:
- Compile and save the model in Ascend Graph mode. The model contains multiple graphs, such as the inference graph, variable initialization graph, and variable update graph.
The aclgrphBundleBuildModel API is called to build the model, and the aclgrphBundleSaveModel API is called to save the model. For details about the APIs, see aclgrphBundleBuildModel and aclgrphBundleSaveModel .
- Call aclmdlBundleLoadFromFile or aclmdlBundleLoadFromMem to load the model.
- Call aclmdlBundleGetModelId to obtain the IDs of the graphs.
- Call the model execution APIs (for example, aclmdlExecute) to execute each graph based on the IDs of those graphs.
If variable update is involved, call aclmdlSetDatasetTensorDesc to set the tensor description of the graph before updating the variable update graph. After you have executed the variable update graph, execute the inference graph again.
- After the inference is complete, call aclmdlBundleUnload to unload the model.
Prototype
aclError aclmdlBundleLoadFromFile(const char *modelPath, uint32_t *bundleId)
Command-Line Options
Returns
The value 0 indicates success, and other values indicate failure. For details, see aclError.