异步执行指定id对应的Graph图,输出执行结果。
Status RunGraphAsync(uint32_t graph_id, const std::vector<ge::Tensor> &inputs, RunAsyncCallback callback)
Status RunGraphAsync(uint32_t graph_id, const ContinuousTensorList &inputs, RunAsyncCallback callback)
参数名 |
输入/输出 |
描述 |
||
---|---|---|---|---|
graphId |
输入 |
子图对应的id。 |
||
inputs |
输入 |
当前子图对应的输入数据。
|
||
callback |
输出 |
当前子图对应的回调函数。
|
参数名 |
类型 |
描述 |
---|---|---|
- |
Status |
GE_CLI_GE_NOT_INITIALIZED:GE未初始化。 SUCCESS:异步执行图成功。 FAILED:异步执行图失败。 |
无。
Atlas 推理系列产品(Ascend 310P处理器),支持
Atlas 训练系列产品,支持
Atlas A2训练系列产品,支持
Atlas 200/300/500 推理产品,不支持
Atlas 200/500 A2推理产品,不支持
此函数与RunGraph均为执行指定id对应的图,并输出结果,区别于RunGraph的是,该接口:
使用示例:
1 2 3 4 5 6 7 8 9 |
void CallBack(Status result,std::vector<ge::Tensor> &out_tensor) { if(result == ge::SUCCESS) { // 读取out_tensor数据, 用户根据需求处理数据; for(auto &tensor : out_tensor) { auto data = tensor.data; int64_t length = tensor.length; } } } |