AddGraph
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.
Prototype
APIs taking string arguments will be deprecated in future releases. Use APIs taking non-string arguments instead.
1 2 3 | Status AddGraph(uint32_t graph_id, const Graph &graph) Status AddGraph(uint32_t graph_id, const Graph &graph, const std::map<std::string, std::string> &options) Status AddGraph(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. 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 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 one graph object, causing disorder.
- Do not use the same graph ID to add different graph objects. Otherwise, only the first one will be added and subsequent ones will fail.
- When this API is used, Session directly modifies the added graph object. To protect the original graph object from any impact after AddGraph is used, call the AddGraphWithCopy API, which copies a graph object in Session and modifies only the copy of the graph object.