save_model
Applicable Products
All processors
Function Usage
Serializes an offline model to a file.
Prototype
1 | save_model(output_file: str, model: ModelBuffer) -> None |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
output_file |
Input |
Name of the offline model file. The generated offline model file is automatically suffixed with .om. If the name of the .om file contains a specific OS and architecture, the model file can be used only in an operating environment with the OS and architecture. |
model |
Input |
Buffer of the offline model. |
Returns
None
Restrictions
- If output_file is not a string, TypeError is thrown.
- If model is not of the ModelBuffer type, TypeError is thrown.
- If the saving fails, RuntimeError is thrown.
- If the name of the generated .om model file contains the OS and architecture, but the OS and architecture are inconsistent with those of the model operating environment, this API must be used together with OPTION_HOST_ENV_OS and OPTION_HOST_ENV_CPU to set the OS type and architecture of the model operating environment. For details about the parameters, see aclgrphBuildModel Configuration Parameters.
Parent topic: Offline_compile APIs