---
title: SetInput
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendgraphapi/atlasgeapi_07_0658.html
sourcePath: /source/zh/canncommercial/900/API/ascendgraphapi/atlasgeapi_07_0658.html
indexId: cb09041e9579976a62a71f7bb08353e6846df804d0423c93b036b203a54eb93d72
---
# SetInput

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | √ |
| Atlas 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |


#### 头文件和库文件

- 头文件：#include <graph/operator.h>
- 库文件：libgraph.so


#### 功能说明

设置算子Input，即由哪个算子的输出连到本算子。

有如下几种SetInput方法：

如果指定srcOprt第0个Output为当前算子Input，使用第一个函数原型设置当前算子Input，不需要指定srcOprt的Output名称。

如果指定srcOprt的其它Output为当前算子Input，使用第二个函数原型设置当前算子Input，需要指定srcOprt的Output名称。

如果指定srcOprt的其它Output为当前算子Input，使用第三个函数原型设置当前算子Input，需要指定srcOprt的第index个Output。


#### 函数原型

数据类型为string的接口后续版本会废弃，建议使用数据类型为非string的接口。


```
Operator &SetInput(const std::string &dst_name, const Operator &src_oprt)
Operator &SetInput(const char_t *dst_name, const Operator &src_oprt)
Operator &SetInput(const std::string &dst_name, const Operator &src_oprt, const std::string &name)
Operator &SetInput(const char_t *dst_name, const Operator &src_oprt, const char_t *name)
Operator &SetInput(const std::string &dst_name, const Operator &src_oprt, uint32_t index)
Operator &SetInput(const char_t *dst_name, const Operator &src_oprt, uint32_t index)
Operator &SetInput(uint32_t dst_index, const Operator &src_oprt, uint32_t src_index)
Operator &SetInput(const char_t *dst_name, uint32_t dst_index, const Operator &src_oprt, const char_t *name)
Operator &SetInput(const char_t *dst_name, uint32_t dst_index, const Operator &src_oprt)
```


#### 参数说明

| 参数名 | 输入/输出 | 描述 |
| --- | --- | --- |
| dst\_name | 输入 | 当前算子Input名称。 |
| src\_oprt | 输入 | Input名称为dst\_name的输入算子对象。 |
| src\_index | 输入 | src\_oprt的第src\_index个输出。 |
| name | 输入 | src\_oprt的Output名称。 |
| index | 输入 | src\_oprt的第index个Output。 |
| dst\_index | 输入 | 名称为dst\_name的第dst\_index个动态输入。 |


#### 返回值说明

当前调度者本身。


#### 异常处理

无。


#### 约束说明

无。
