---
title: 简介
description: "RuntimeAttrs是一个算子属性存取类，用于在算子执行过程中提供对属性的访问能力。该类提供了一系列方法，允许用户根据属性索引获取不同类型的属性值，例如，int64_t、float、bool、string、Tensor等类型。在ExtendedKernelContext及其子类中，可通过GetAttrs接口获取算子属性，返回值中仅包含在IR原型定义中的属性。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/maintenref/basicdataapi/atlasopapi_07_00551.html
sourcePath: /source/zh/canncommercial/900/maintenref/basicdataapi/atlasopapi_07_00551.html
indexId: f5a15560839a05730f909053e8b0f328819a71a1c178a7fd7241306099a334e278
---
# 简介

RuntimeAttrs是一个算子属性存取类，用于在算子执行过程中提供对属性的访问能力。该类提供了一系列方法，允许用户根据属性索引获取不同类型的属性值，例如，int64_t、float、bool、string、Tensor等类型。在ExtendedKernelContext及其子类中，可通过GetAttrs接口获取算子属性，返回值中仅包含在IR原型定义中的属性。

#### 需要包含的头文件

```
#include <runtime_attrs.h>
```


#### Public成员函数

```
RuntimeAttrs
() = delete
RuntimeAttrs
(const
RuntimeAttrs
&) = delete
RuntimeAttrs
(
RuntimeAttrs
&&) = delete
RuntimeAttrs
&
operator=
(const
RuntimeAttrs
&) = delete
RuntimeAttrs
&
operator=
(
RuntimeAttrs
&&) = delete
template<typename T>  const T *
GetAttrPointer
(size_t index) const
const int64_t *
GetInt
(const size_t index) const
const
TypedContinuousVector
<int64_t> *
GetListInt
(const size_t index) const
const
ContinuousVectorVector
*
GetListListInt
(const size_t index) const
const char *
GetStr
(const size_t index) const
const
Tensor
*
GetTensor
(const size_t index) const
const float *
GetFloat
(const size_t index) const
const bool *
GetBool
(const size_t index) const
const
TypedContinuousVector
<float> *
GetListFloat
(const size_t index) const
const
ContinuousVectorVector
*
GetListListFloat
(const size_t index) const
size_t
GetAttrNum
() const
```
