Function: bundle_load_from_mem

Applicable Products

Product

Supported (√/x)

Ascend 950PR / Ascend 950DT

√

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

Loads offline model data from memory if variables need to be dynamically updated during model execution. The model workspace is managed by the system.

This API needs to be used with other APIs to dynamically update variables. For details, see acl.mdl.bundle_load_from_file.

Prototype

  • C Prototype
    1
    aclError aclmdlBundleLoadFromMem(const void *model,  size_t modelSize, uint32_t *bundleId)
    
  • Python Function
    1
    bundle_id, ret = acl.mdl.bundle_load_from_mem(model, model_size)
    

Parameter Description

Parameter

Description

model

Int, pointer address for storing model data.

The model file is built in graph mode. Call aclgrphBundleBuildModel to compile the model, call aclgrphBundleSaveModel to save the model, and then read the saved the .om model file to the memory. For details about the graph APIs, see Graph Mode Development Guide.

Allocate memory on the host or device based on where the application runs. For details about the memory allocation APIs, see Memory Management.

model_size

Int, size of the model data in the memory, in bytes.

Return Value Description

Return Value

Description

bundle_id

Int. After the system successfully loads the model, bundle_id is returned as the flag for identifying the model in subsequent operations.

ret

Int, error code: 0 on success; else, failure.