---
title: SetIntAttrVal
description: "设置一个整数类型的属性值到算子中。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/maintenref/basicdataapi/atlasopapi_07_00707.html
sourcePath: /source/zh/canncommercial/900/maintenref/basicdataapi/atlasopapi_07_00707.html
indexId: 94e7f262c97a71560403420c2d403176f9c97325fe2d0881d46fb0fe8cfbd73c78
---
# SetIntAttrVal

#### 函数功能

设置一个整数类型的属性值到算子中。


#### 函数原型

```
bool SetIntAttrVal(const char *attr_name, const int64_t val) const
```


#### 参数说明

| 参数 | 输入/输出 | 说明 |
| --- | --- | --- |
| attr\_name | 输入 | 属性名。 |
| val | 输入 | 要设置的整数值。 |


#### 返回值说明

表示是否成功设置该属性值。


#### 约束说明

无


#### 调用示例

```
bool SetIntAttrVal(ExeResGenerationContext* context) {
  std::string attr_name = "";
  int64_t val = 6; 
  auto result = context->SetIntAttrVal(attr_name.c_str(),val);
  // ...
}
```
