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

#### 产品支持情况

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


#### 功能说明

向会话添加图。


#### 函数原型

```
add_graph(graph_id: int, add_graph: Graph, options: dict = None) -> None
```


#### 参数说明

| 参数名 | 输入/输出 | 描述 |
| --- | --- | --- |
| graph\_id | 输入 | 图ID。 |
| add\_graph | 输入 | 要添加的图对象。 |
| options | 输入 | 配置选项。 |


#### 返回值说明

无


#### 约束说明

- 如果graph_id不是整数，抛出TypeError。
- 如果add_graph不是Graph类型，抛出TypeError。
- 如果options不是字典类型，抛出TypeError。
- 如果添加失败，抛出RuntimeError。
