Function: load_from_mem_with_mem
Function Usage
Loads an offline model from memory. The model workspace is managed by the user.
Returns the model ID after the model is loaded. The model ID is used for model identification in subsequent operations.
Prototype
- C Prototype
1aclError aclmdlLoadFromMemWithMem(const void *model, size_t modelSize, uint32_t *modelId, void *workPtr, size_t workSize, void *weightPtr, size_t weightSize)
- Python Function
1model_id, ret = acl.mdl.load_from_mem_with_mem(model, model_size, model_id, work_ptr, work_size, weight_ptr, weight_size)
Parameters
|
Parameter |
Description |
|---|---|
|
model |
|
|
model_size |
Int, model size, in bytes. |
|
model_id |
Int, model ID generated after the model is loaded. |
|
work_ptr |
Int, pointer address of the workspace (for storing model input and output data) required by the model on the device. The memory is managed by the user and cannot be freed during model execution. If 0 is passed for this parameter, the system manages the memory. |
|
work_size |
Int, workspace size required for model execution, in bytes. This parameter is invalid when work_ptr is set to 0. |
|
weight_ptr |
Int, pointer address of the model weight memory (for storing weight data) on the device. The memory is managed by the user and cannot be freed during model execution. If 0 is passed for weight_ptr, the system manages the memory. |
|
weight_size |
Int, weight memory size, in bytes. This parameter is invalid when weight_ptr is set to 0. |
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. |