aclmdlBundleLoadFromFile
Applicability
|
Product |
Supported |
|---|---|
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
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 must be used with other APIs to dynamically update variables. The process of calling the key APIs is as follows:
- Build and save the model based on graph build APIs. The model contains multiple graphs, such as the inference graph, variable initialization graph, and variable update graph.
In this section, aclgrphBundleBuildModel is called to build the model, and aclgrphBundleSaveModel is called to save the model. For details about the APIs, see "aclgrphBundleBuildModel" and "aclgrphBundleSaveModel" in Graph Mode Development Guide.
- 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)
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
modelPath |
Input |
Pointer to the model file path, which contains the file name. The user who runs the app must have enough permission to access the directory. The model file is built using the graph build API. Call aclgrphBundleBuildModel to build the model, and call aclgrphBundleSaveModel to save the model. |
|
bundleId |
Output |
Returns the bundle ID after the model is successfully loaded. The bundle ID is used for model identification in subsequent operations. |
Returns
0 on success; else, failure. For details, see aclError.