AddGraphWithCopy

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.h>
  • Library file: libge_runner.so

Function Usage

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

Unlike AddGraph, if you pass a graph object to this API, a copy of the graph object is generated. The graph saved in the Session is a backup of the graph object. Any modification made to the graph does not affect the original graph in the Session. Similarly, any modification made to the graph in the Session does not affect the graph object.

Prototype

1
2
Status AddGraphWithCopy(uint32_t graph_id, const Graph &graph)
Status AddGraphWithCopy(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 Session.

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 GEInitialize.

You can choose to use a different options argument for graph configuration. See GEInitialize for the value range and restrictions of each key.

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 different backups, and the backups corresponding to two different graph IDs are not shared.