Loads an offline model from memory. The model workspace is managed by the system. This API is synchronous.
Returns the model ID after the model is loaded. The model ID is used for model identification in subsequent operations.
The operations of loading, executing, and unloading a model must be performed in the same context. For details about how to create a context, see aclrtCreateContext.
aclError aclmdlLoadFromMem(const void* model, size_t modelSize, uint32_t* modelId)
Parameter |
Input/Output |
Description |
|---|---|---|
model |
Input |
Pointer to the address of the memory that stores the model. Allocate host memory or device memory based on where the app runs. For details about the memory allocation API, see Memory Management. |
modelSize |
Input |
Size of the model data in the memory, in bytes. |
modelId |
Output |
Pointer to the model ID. The model ID will be returned after a model is loaded to the system. |
0 on success; else, failure.
AscendCL also provides the aclmdlSetConfigOpt and aclmdlLoadWithConfig APIs for model loading. 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.
For the API call sequence, see API Call Sequence.