RunGraph

Applicability

Product

Supported or Not

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

x

Atlas inference products

Atlas training products

Header File/Library File

  • Header file: #include <ge/ge_api.h>
  • Library file: libge_runner.so

Function Usage

Runs the graph of a specified ID and returns the execution result. This API is synchronous.

This API is used to build, load, and run graphs.

Prototype

1
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 run.

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

Parameter

Type

Description

-

Status

  • SUCCESS: The running result is successful.
  • FAILED: The running result fails.

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.