aclgrphSaveModel

Applicability

Product

Supported or Not

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Header File/Library File

  • Header file: #include <ge/ge_ir_build.h>
  • Library file: libge_compiler.so

Function Usage

Serializes an offline model to a file.

Prototype

APIs taking string arguments will be deprecated in future releases. Use APIs taking non-string arguments instead.

1
2
graphStatus aclgrphSaveModel(const std::string &output_file, const ModelBufferData &model)
graphStatus aclgrphSaveModel(const char_t *output_file, const ModelBufferData &model)

Parameters

Parameter

Input/Output

Description

model

Input

Buffer of the offline model. For details, see ModelBufferData.

1
2
3
4
5
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(0): success.

Other values: failure. For details, see ge::graphStatus.

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.