Function: query_size
|
C Prototype |
aclError aclmdlQuerySize(const char *fileName, size_t *workSize, size_t *weightSize) |
|---|---|
|
Python Function |
work_size, weight_size, ret = acl.mdl.query_size(file_name) |
|
Function Usage |
Obtains the weight memory size and workspace size required for model execution. |
|
Input Description |
file_name: str, path of the model that needs to obtain memory information. The file name is contained in the path. The user who runs the app must have the permission to access the path. |
|
Return Value |
work_size: int, workspace size required for model execution, in bytes. weight_size: int, weight memory size required for model execution, in bytes. ret: int, error code.
|
|
Restrictions |
If the memory is managed by the user, you need to call acl.mdl.query_size to query the sizes of the workspace and weight memory required for model execution to avoid memory waste. If the shape of the input data is uncertain, you cannot call acl.mdl.query_size to query the memory size. As a result, you cannot manage the memory during model loading. Therefore, you need to call acl.mdl.load_from_file or acl.mdl.load_from_mem to allow the system to manage the memory. |
|
Reference |
For details about the API call sequence, see Loading a Model. |