aclmdlQuerySizeFromMem
Applicable Products
Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Function Usage
Obtains the weight memory size and workspace size required for model execution based on the model data in the memory.
If the memory is managed by the user, before the allocation, you need to call this API to query the sizes of the workspace and weight memory required for model execution to avoid memory waste. If the model input data has dynamic shapes, you cannot call this API to query the memory sizes. In this case, you cannot manage memory during model loading. You can call aclmdlLoadFromFile or aclmdlLoadFromMem to allow the system to manage the memory.
Prototype
1 | aclError aclmdlQuerySizeFromMem(const void *model, size_t modelSize, size_t *workSize, size_t *weightSize) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
model |
Input |
Pointer to the model data. |
modelSize |
Input |
Model data length, in bytes. |
workSize |
Output |
Pointer to the workspace size required for model execution, in bytes. The workspace memory is device memory, which needs to be allocated and freed by the user. |
weightSize |
Output |
Pointer to the weight memory size required for model execution, in bytes. The workspace memory is device memory, which needs to be allocated and freed by the user. |
Returns
0 on success; else, failure. For details, see aclError.