AddGraph
Applicability
Product |
Supported or Not |
|---|---|
√ |
|
√ |
|
x |
|
√ |
|
√ |
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 details about the supported configuration items, see the parameters of the graph level in Command-Line Options. |
Returns
Parameter |
Type |
Description |
|---|---|---|
- |
Status |
GE_CLI_GE_NOT_INITIALIZED: GE not initialized. SUCCESS: Graph added successfully. FAILED: Failed to add the graph. |
Constraints
- 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 being affected after AddGraph is used, call the AddGraphClone API described in AddGraphClone, which copies a graph object in Session and modifies only the copy of the graph object.