RunGraph
Description
Runs the graph of a specified ID and returns the execution result. This API is synchronous.
This API is used to compile, load, and run graphs.
Prototype
Status RunGraph(uint32_t graph_id, const std::vector<Tensor>& inputs, std::vector<Tensor>& outputs);
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
graph_id |
Input |
ID of the graph to be executed. |
|
inputs |
Input |
Input tensors of the computational graph, which are memory allocated on the host. When std::vector<Tensor> inputs are used and user inputs enter a data queue, memory must be allocated and copied for each input. A large input size or quantity may result in a performance bottleneck. |
|
outputs |
Output |
Output tensors of the computational graph. You do not need to allocate the memory manually. After the execution is complete, GE allocates and initializes the memory. |
Returns
Restrictions
The inputs correspond to the data node in the graph. The index attribute of the data node indicates the location of the data in the inputs list. Ensure that the corresponding data can be obtained from inputs based on the index attribute of the data node. Otherwise, an error is returned. If there is no data node in the graph, the inputs option can be left empty. The outputs are consistent with the specified output nodes and output ports, with the amount and ordering preserved.