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

#### 产品支持情况

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


#### 头文件/库文件

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


#### 功能说明

支持基于用户构造的Operator对象生成一个Graph对象。

功能与SetInputs一致。SetInputs未来会逐步消亡，统一使用此接口。


#### 函数原型

```
static GraphPtr ConstructFromInputs(const std::vector<Operator> &inputs, const AscendString &name)
```


#### 参数说明

| 参数名 | 输入/输出 | 说明 |
| --- | --- | --- |
| inputs | 输入 | 整图输入的Operator。 |
| name | 输入 | Graph的名字。 |


#### 返回值说明

| 参数名 | 类型 | 说明 |
| --- | --- | --- |
| \- | GraphPtr | 图指针，返回新构造的图。 |


#### 约束说明

无


#### 调用示例

```
GraphPtr graph;
graph =  Graph::ConstructFromInputs(inputs, graph_name);
graph->SetOutputs(outputs);
```
