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

#### 产品支持情况

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


#### 头文件/库文件

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


#### 功能说明

获取指定属性名字的值。


#### 函数原型

```
graphStatus GetAttr(const AscendString &name, int64_t &attr_value) const
graphStatus GetAttr(const AscendString &name, int32_t &attr_value) const
graphStatus GetAttr(const AscendString &name, uint32_t &attr_value) const
graphStatus GetAttr(const AscendString &name, float32_t &attr_value) const
graphStatus GetAttr(const AscendString &name, AscendString &attr_value) const
graphStatus GetAttr(const AscendString &name, bool &attr_value) const
graphStatus GetAttr(const AscendString &name, Tensor &attr_value) const
graphStatus GetAttr(const AscendString &name, std::vector<int64_t> &attr_value) const
graphStatus GetAttr(const AscendString &name, std::vector<int32_t> &attr_value) const
graphStatus GetAttr(const AscendString &name, std::vector<uint32_t> &attr_value) const
graphStatus GetAttr(const AscendString &name, std::vector<float32_t> &attr_value) const
graphStatus GetAttr(const AscendString &name, std::vector<AscendString> &attr_values) const
graphStatus GetAttr(const AscendString &name, std::vector<bool> &attr_value) const
graphStatus GetAttr(const AscendString &name, std::vector<Tensor> &attr_value) const
graphStatus GetAttr(const AscendString &name, OpBytes &attr_value) const
graphStatus GetAttr(const AscendString &name, std::vector<std::vector<int64_t>> &attr_value) const
graphStatus GetAttr(const AscendString &name, std::vector<ge::DataType> &attr_value) const
graphStatus GetAttr(const AscendString &name, ge::DataType &attr_value) const
graphStatus GetAttr(const AscendString &name, AttrValue &attr_value) const
```


#### 参数说明

| 参数名 | 输入/输出 | 说明 |
| --- | --- | --- |
| name | 输入 | 属性名称。 |
| attr\_value | 输出 | 返回的int64\_t表示的整型类型属性值。 |
| attr\_value | 输出 | 返回的int32\_t表示的整型类型属性值。 |
| attr\_value | 输出 | 返回的uint32\_t表示的整型类型属性值。 |
| attr\_value | 输出 | 返回的浮点类型float的属性值。 |
| attr\_value | 输出 | 返回的字符串类型AscendString的属性值。 |
| attr\_value | 输出 | 返回的布尔类型bool的属性值。 |
| attr\_value | 输出 | 返回的Tensor类型的属性值。 |
| attr\_value | 输出 | 返回的vector<int64\_t>表示的整型列表类型属性值。 |
| attr\_value | 输出 | 返回的vector<int32\_t>表示的整型列表类型属性值。 |
| attr\_value | 输出 | 返回的vector<uint32\_t>表示的整型列表类型属性值。 |
| attr\_value | 输出 | 返回的浮点列表类型vector<float>的属性值。 |
| attr\_value | 输出 | 返回的字符串列表类型vector<ge::AscendString>的属性值。 |
| attr\_value | 输出 | 返回的布尔列表类型vector<bool>的属性值。 |
| attr\_value | 输出 | 返回的Tensor列表类型vector<Tensor>的属性值。 |
| attr\_value | 输出 | 返回的Bytes，即字节数组类型的属性值，OpBytes即vector<uint8\_t>。 |
| attr\_value | 输出 | 返回的vector<vector<int64\_t>>表示的整型二维列表类型属性值。 |
| attr\_value | 输出 | 返回的vector<ge::DataType>表示的DataType列表类型属性值。 |
| attr\_value | 输出 | 返回的DataType类型的属性值。 |
| attr\_value | 输出 | 返回的AttrValue类型的属性值。 |


#### 返回值说明

| 参数名 | 类型 | 说明 |
| --- | --- | --- |
| \- | graphStatus | GRAPH\_SUCCESS(0)：成功。 其他值：失败。 |


#### 约束说明

无
