Function: query_size_from_mem

Function Usage

Obtains the weight memory size and workspace size required for model execution based on the model data in the memory.

Prototype

  • C Prototype
    1
    aclError aclmdlQuerySizeFromMem(const void *model, size_t modelSize, size_t *workSize, size_t *weightSize)
    
  • Python Function
    1
    work_size, weight_size, ret = acl.mdl.query_size_from_mem(model, model_size)
    

Parameters

Parameter

Description

model

Int, pointer address of the model data whose memory information needs to be obtained.

model_size

Int, model size, in bytes.

Returns

Return Value

Description

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. 0 indicates success, and other values indicate failure.

Restrictions

The workspace and weight memory are all device memory, which need to be allocated and freed by the user.