AddGraph
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
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 |
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. This parameter is available for configuring the current graph separately. For its keys and values, see the parameters of the graph level in Options. |
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 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, 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 the Session and modifies only the copy of the graph object.