For details about the API call sequence for model unloading, see API Call Sequence.
After model inference is complete, unload the model by using the aclmdlUnload call, destroy the model description of the aclmdlDesc type, and free the workspace and weight memory for model execution.
//1. Unload the model.
aclError ret = aclmdlUnload(modelId_);
//2. Destroy the model description.
if (modelDesc_ != nullptr) {
(void)aclmdlDestroyDesc(modelDesc_);
modelDesc_ = nullptr;
}
//3. Free the workspace for model execution.
if (modelWorkPtr_ != nullptr) {
(void)aclrtFree(modelWorkPtr_);
modelWorkPtr_ = nullptr;
modelWorkSize_ = 0;
}
//4. Free the weight memory for model execution.
if (modelWeightPtr_ != nullptr) {
(void)aclrtFree(modelWeightPtr_);
modelWeightPtr_ = nullptr;
modelWeightSize_ = 0;
}