AddGraphWithCopy
Applicability
Product |
Supported or Not |
|---|---|
√ |
|
√ |
|
x |
|
√ |
|
√ |
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 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
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 |
Graph ID. |
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 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 is not initialized. SUCCESS: The graph is successfully added. FAILED: The graph fails to be added. |
Restrictions
If graphs of the same object are registered by calling this API, all graph IDs point to different backup copies, and the backup copies corresponding to two different graph IDs are not shared.