Function: load_with_config

C Prototype

aclError aclmdlLoadWithConfig(const aclmdlConfigHandle *handle, uint32_t *modelId)

Python Function

model_id, ret = acl.mdl.load_with_config(config_handle)

Function Usage

Loads a model based on the given configuration.

Input Description

config_handle: int, configuration object for model loading. Call acl.mdl.create_config_handle to create an object in advance, which must be consistent with config_handle output by the acl.mdl.set_config_opt call.

Return Value

model_id: int, model ID generated after the model is loaded.

ret: int, error code.

Restrictions

Before loading the model file, check whether the memory space is sufficient based on the file size. If the memory space is insufficient, the application will be abnormal.

This API needs to work with the following APIs to load models:
  1. Call acl.mdl.create_config_handle to create a configuration object for loading a model.
  2. Call acl.mdl.set_config_opt for multiple times to set the value of each attribute in the configuration object.
  3. Call acl.mdl.load_with_config to specify the configuration information for model loading and load your model.
  4. After the model is successfully loaded, call acl.mdl.destroy_config_handle to destroy the configuration object.

API

acl.mdl.set_config_opt and acl.mdl.load_with_config, however, are more complicated. The caller needs to set the attributes in the configuration object passed to the API call to decide how the model will be loaded and who will manage the memory.

By choosing from the following pyACL APIs, you can directly determine whether to load a model from a file or from memory and whether the memory is managed by the system or the user.