Function: load_with_config
Function Usage
Loads a model based on the given configuration.
Prototype
- C Prototype
1aclError aclmdlLoadWithConfig(const aclmdlConfigHandle *handle, uint32_t *modelId)
- Python Function
1model_id, ret = acl.mdl.load_with_config(config_handle)
Parameters
Parameter |
Description |
|---|---|
config_handle |
Int, configuration object for model loading. Call acl.mdl.create_config_handle to create the object in advance. The object must be the same as that of config_handle in acl.mdl.set_config_opt. |
Returns
Return Value |
Description |
|---|---|
model_id |
Int, model ID generated after the model is loaded. |
ret |
Int, error code. 0 indicates success, and other values indicate failure. |
Restrictions
Before loading, check whether the memory space is sufficient based on the file size. If the memory space is insufficient, the application will be abnormal.
- Call acl.mdl.create_config_handle to create a configuration object for model loading.
- Call acl.mdl.set_config_opt for multiple times to set the value of each attribute in the configuration object.
- Call acl.mdl.load_with_config to specify the configuration information for model loading and load your model.
- Call acl.mdl.destroy_config_handle for destruction after the model is successfully loaded.
Reference
When the acl.mdl.set_config_opt and acl.mdl.load_with_config APIs are used, the attributes in the configuration object are used to determine whether the model is loaded from the file or memory and whether the memory is managed by the system or user.
By choosing from the following APIs, you can directly determine whether to load a model from a file or from memory and whether the memory is managed by the system or the user.