aclgrphSaveModel
Description
Serializes an offline model to a file.
Prototype
APIs using strings will be deprecated in later versions. Use APIs supporting non-string data instead.
graphStatus aclgrphSaveModel(const std::string &output_file, const ModelBufferData &model); graphStatus aclgrphSaveModel(const char_t *output_file, const ModelBufferData &model);
Restrictions
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 aclgrphBuildInitialize Configuration Parameters.
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
model |
Input |
Buffer of the offline model. struct ModelBufferData
{
std::shared_ptr<uint8_t> data = nullptr;
uint32_t length;
};
data points to the generated model data, and length indicates the actual model size. |
output_file |
Input |
File name. The name of the generated offline model file automatically ends with .om, for example, ir_build_sample.om or ir_build_sample_linux_x86_64.om. If the name of an .om file contains the OS and architecture, the file can be used only in the operating environment with the OS and architecture. |
Returns
Parameter |
Type |
Description |
|---|---|---|
- |
graphStatus |
GRAPH_SUCCESS on success; else, failure. |