Function: load_from_file
Applicability
|
Product |
Supported (√/x) |
|---|---|
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
Function Usage
Loads an offline model (offline model adapted to the Ascend AI Processor) from a file. The memory is managed by the system.
Returns the model ID after the model is loaded. The model ID is used for model identification in subsequent operations.
Prototype
- C Prototype
1aclError aclmdlLoadFromFile(const char *modelPath, uint32_t *modelId)
- Python Function
1model_id, ret = acl.mdl.load_from_file(model_path)
Parameter Description
Return Value Description
|
Return Value |
Description |
|---|---|
|
model_id |
Int, pointer address of the model ID generated after the system loads the model. |
|
ret |
Int, error code: 0 on success; else, failure. |
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.
- The operations of loading, executing, and unloading a model must be performed in the same context. For details about how to create a context, see acl.rt.set_device and acl.rt.create_context.