Function: bundle_load_from_mem

Applicable Products

  • Ascend 950PR&950DT products: Supported
  • Atlas A3 products: Supported
  • Atlas A2 products: Supported
  • Atlas 200I/500 A2 inference products: Supported
  • Atlas inference products: Supported
  • Atlas training products: Supported

Function

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

    aclError aclmdlBundleLoadFromMem(const void *model, size_t modelSize, uint32_t *bundleId)
    
  • Python Function

    bundle_id, ret = acl.mdl.bundle_load_from_mem(model, model_size)
    

Parameters

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 Development.
model_size Int, size of the model data in the memory, in bytes.

Return Values

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.

Constraints

In Ascend EP form, allocate memory on the host for the model parameter.

In Ascend RC form, allocate memory on the device for the model parameter.

In Ctrl CPU form, allocate memory on the device for the model parameter.