AddGraph

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

x

Atlas inference product

Atlas training product

Header File/Library File

  • Header file: #include <ge/ge_api_v2.h>
  • Library file: libge_runner_v2.so

Function Usage

Adds a graph to a GeSession, in which a unique graph ID is generated.

Prototype

1
2
Status AddGraph(uint32_t graph_id, const Graph &graph)
Status AddGraph(uint32_t graph_id, const Graph &graph, const std::map<AscendString, AscendString> &options)

Parameters

Parameter

Input/Output

Description

graph_id

Input

ID of the graph.

graph

Input

Graph to be loaded to the GeSession.

options

Input

A key-value mapping table, for the graph configuration. key indicates the parameter type, and value indicates the parameter value, both of type string.

Generally, this parameter can be left blank, indicating using the same options configuration passed to GEInitializeV2.

This parameter is available for configuring the current graph separately. For its keys and values, see the parameters of the graph level in Options.

Returns

Parameter

Type

Description

-

Status

GE_CLI_GE_NOT_INITIALIZED: GE not initialized.

SUCCESS: Graph added successfully.

FAILED: Failed to add the graph.

Restrictions

  • If graphs of the same object are registered by calling this API, all graph IDs point to one graph object, causing disorder.
  • Do not use the same graph ID to add different graph objects. In this case, only the graph object added at the first time is retained, and the subsequent graph objects fail to be added.
  • When this API is used, GeSession directly modifies the added graph object. To protect the original graph object from any impact after AddGraph is used, call the AddGraphClone API, which copies a graph object in the Session and modifies only the copy of the graph object.