ExecuteGraphWithStreamAsync
函数功能
异步运行指定id对应的Graph图,输出执行结果。
此函数与RunGraphWithStreamAsync均为运行指定id对应的图,并输出结果,区别于RunGraphWithStreamAsync的是,该接口:
- 该接口运行前需要完成CompileGraph及LoadGraph(异步运行Graph场景)流程。
 - inputs和outputs数据类型为gert::Tensor,该类型详细说明请参见Tensor构造函数。
 
函数原型
          1
           | 
         
          Status ExecuteGraphWithStreamAsync(uint32_t graph_id, void *stream,const std::vector<gert::Tensor> &inputs,std::vector<gert::Tensor> &outputs)  | 
        
参数说明
| 
          参数名  | 
        
          输入/输出  | 
        
          描述  | 
       
|---|---|---|
| 
          graph_id  | 
        
          输入  | 
        
          子图对应的id。  | 
       
| 
          stream  | 
        
          输入  | 
        
          指定图在哪个Stream上运行。  | 
       
| 
          inputs  | 
        
          输入  | 
        
          当前子图对应的输入数据,为Device上的内存空间。  | 
       
| 
          outputs  | 
        
          输出  | 
        
          当前子图对应的输出数据,为Device上的内存空间。  | 
       
返回值
| 
          参数名  | 
        
          类型  | 
        
          描述  | 
       
|---|---|---|
| 
          -  | 
        
          Status  | 
        
          SUCCESS:异步运行图成功。 FAILED:异步运行图失败。  | 
       
约束说明
- 调用该接口前,需要确定好Device上分配的内存大小。
 - 调用该接口前,需要完成CompileGraph及LoadGraph流程。
 - 调用该接口前,需要通过AscendCL提供的aclrtCreateStream接口创建Stream。
 - 得到输出运行结果前,需要通过AscendCL提供的aclrtSynchronizeStream接口保证Stream上的任务已经执行完。
 
     父主题: Graph运行接口