---
title: GetValue
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendcopapi/atlasascendc_api_07_00026.html
sourcePath: /source/zh/canncommercial/900/API/ascendcopapi/atlasascendc_api_07_00026.html
indexId: 1f581c94180e27b4806e02b8ac4d00bbaf1641e79c1dce14685a2a62810415b477
---
# GetValue

#### 产品支持情况

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


#### 功能说明

获取GlobalTensor的相应偏移位置的值。


#### 函数原型

```
__aicore__ inline __inout_pipe__(S) PrimType GetValue(const uint64_t offset) const
```


#### 参数说明


**表1 参数说明**

| 参数名 | 输入/输出 | 描述 |
| --- | --- | --- |
| offset | 输入 | 偏移offset个元素。 |


#### 返回值说明

返回PrimType类型的立即数。


#### 约束说明

如果GetValue的Global Memory地址内容存在被外部改写的可能，需要先调用DataCacheCleanAndInvalid，确保Data Cache与Global Memory的Cache一致性，之后再调用此接口。


#### 调用示例

```
// 数据(GlobalTensor): [0 100 200  ... ]

AscendC::GlobalTensor<uint32_t> tiling_global;
tiling_global.SetGlobalBuffer(reinterpret_cast<__gm__ uint32_t *>(tiling), 16);
const uint16_t C1 = (uint16_t)tiling_global.GetValue(0);
const uint16_t H = (uint16_t)tiling_global(1);  
// 示例结果如下：
// C1 = 0，H = 100
```
