AddGraphWithCopy
Description
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 to the graph does not affect the original graph in the Session. Similarly, any modification to the graph in the Session does not affect the graph object.
Prototype
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 to run. |
graph |
Input |
Graph to be loaded to the Session. |
options |
Input |
A key-value mapping table, for the graph configuration. key indicates the options type, and value indicates the options value, both of type string. Generally, this parameter can be left empty, indicating using the same options configuration passed to the GEInitialize call. 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 is not initialized. SUCCESS: The graph is successfully added. FAILED: The graph fails to be added. |
Restrictions
If a graph of the same session is registered repeatedly by using this API, different graphIds are generated with each API call. However, all graphIds point to the different backup.