Initialization and Deinitialization

This section describes the APIs for initialization and deinitialization, their precautions, and sample code.

Principles

You must call aclInit for initialization. The configuration file is in JSON format. For details, see aclInit.

To use the default configurations, pass NULL or an empty JSON configuration file with only a pair of curly brackets {} to the aclInit call. The following is an example of passing a null pointer to the aclInit call:
1
aclError ret = aclInit(NULL);

Perform deinitialization by calling aclFinalize before the process exits.

Sample Code

You can view the complete code in Image Classification with ResNet-50 (Synchronous Inference).

Following the API calls, add exception handling branches and specify log printing of error and information levels. The following is a code snippet of key steps only, which is not ready to be built or run.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
//Initialization
//The two dots (..) indicate a path relative to the directory of the executable file.
//For example, if the executable file is stored in the out directory, the two dots (..) point to the parent directory of the out directory.
const char *aclConfigPath = "../src/acl.json";
aclError ret = aclInit(aclConfigPath);

// ......

//Deinitialization
ret = aclFinalize();
// ......