Function: query_size_from_mem

Applicability

Product

Supported (√/x)

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas training products

Atlas inference products

Atlas 200I/500 A2 inference products

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)
    

Parameter Description

Parameter

Description

model

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

model_size

Int, model size in bytes.

Return Value Description

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 on success; else, failure.

Restrictions

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