aclgrphBuildModel

Description

  • Non-slice model as the input:

    Builds a graph into an offline model adapted to the Ascend AI Processor.

Prototype

APIs using strings will be deprecated in later versions. Use APIs supporting non-string data instead.

  • Non-slice model as the input:
    graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map<std::string, std::string> &build_options, ModelBufferData &model);
    graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map<AscendString, AscendString> &build_options, ModelBufferData &model);

Restrictions

  • For the same build arguments passed to aclgrphBuildModel and aclgrphBuildInitialize, you need to configure them once only. If the same arguments are passed repeatedly, the arguments passed to aclgrphBuildModel are used.
  • When the aclgrphBuildModel API is used to pass the options parameter in the multi-graph scenario, if the input parameter is ge::ir_option::PRECISION_MODE or ge::ir_option::PRECISION_MODE_V2, the parameter values of the multiple graphs must be the same.

Parameters

Parameter

Input/Output

Description

graph/graphs

Input

  • Non-slicing scenario: graph to be compiled.

build_options

Input

Graph-level configuration parameter.

A key-value mapping table, for the build configuration of the offline model. key indicates the options type, and value indicates the options value, both of type string.

For details, see aclgrphBuildModel Configuration Parameters.

model

Output

Buffer of the generated offline model.

struct ModelBufferData
{
  std::shared_ptr<uint8_t> data = nullptr;
  uint64_t length;
};

data points to the generated model data, and length indicates the actual model size.

Returns

Parameter

Type

Description

-

graphStatus

GRAPH_SUCCESS: success.

Other values: failure.