aclmdlLoadFromFileWithQ

Description

Loads an offline model adapted to the Ascend AI Processor from a file. The inputs and outputs of a model are stored in queues. This API is synchronous.

Returns the model ID after the model is loaded. The model ID is used for model identification in subsequent operations.

Restrictions

Prototype

aclError aclmdlLoadFromFileWithQ(const char *modelPath, uint32_t *modelId, const uint32_t *inputQ, size_t inputQNum, const uint32_t *outputQ, size_t outputQNum)

Parameters

Parameter

Input/Output

Description

modelPath

Input

Pointer to the offline model file path, which contains the file name. The user who runs the app must have the permission to access the directory.

The .om file is an offline model adapted to the Ascend AI Processor.

NOTE:

For details about how to obtain the .om file, see Building a Model.

When you use ATC to generate an OM file whose size is limited, set --external_weight to 1, indicating that the weight of the Const/Constant node on the original network is saved in a separate file in the weight directory. Ensure that the weight directory is at the same level as the OM file so that AscendCL can automatically search for the weight file in the weight directory when you call this API to load the OM file. Otherwise, the weight file may fail to be loaded.

modelId

Output

Pointer to the model ID.

The model ID will be returned after a model is loaded to the system.

inputQ

Input

Pointer to the queue ID. Each model input corresponds to a queue ID.

inputQNum

Input

Number of input queues.

outputQ

Input

Pointer to the queue ID. Each model output corresponds to a queue ID.

outputQNum

Input

Number of output queues.

Returns

0 on success; else, failure.

Related APIs

AscendCL also provides the aclmdlSetConfigOpt and aclmdlLoadWithConfig APIs for model loading. 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.