aclmdlSetConfigOpt
Applicability
Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Description
Set the value of an attribute in the configuration object for loading a model, including the model execution priority, model file directory or memory address, and memory size.
- Call aclmdlCreateConfigHandle to create a configuration object for loading a model.
- (Optional) Call aclmdlSetExternalWeightAddress to configure device memory for storing external weights.
- Call aclmdlSetConfigOpt multiple times to set the value of each attribute in the configuration object.
- Call aclmdlLoadWithConfig to specify the configuration information for model loading and load your model.
- After the model is successfully loaded, call aclmdlDestroyConfigHandle to destroy the configuration object.
Prototype
aclError aclmdlSetConfigOpt(aclmdlConfigHandle *handle, aclmdlConfigAttr attr, const void *attrValue, size_t valueSize)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
handle |
Output |
Pointer to the configuration object for loading a model. Call aclmdlCreateConfigHandle to create an object in advance. |
attr |
Input |
Attribute to set. |
attrValue |
Input |
Pointer to the attr value to set. If the attribute value itself is a pointer, pass the address of the pointer. |
valueSize |
Input |
Data length of attrValue. You can use the sizeof(*attrValue) function in the C/C++ standard library to query the data length. |
Returns
0 on success; else, failure. For details, see aclError.
See Also
For model loading by using aclmdlSetConfigOpt and aclmdlLoadWithConfig, the caller needs to set the attributes in the configuration object passed to the API call to decide how the model will be loaded and who will manage the memory.
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.