---
title: GetViewShape
description: "获取aclTensor的ViewShape。ViewShape表示aclTensor的逻辑shape。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/aolapi/atlasascendc_api_07_1072.html
sourcePath: /source/zh/canncommercial/900/API/aolapi/atlasascendc_api_07_1072.html
indexId: 19167592727db3d4dc4cf91c84402ff710e788b4c290f09762e7418351b2d5fc70
---
# GetViewShape

#### 功能说明

获取aclTensor的ViewShape。ViewShape表示aclTensor的逻辑shape。

假设一个aclTensor的StorageShape和ViewShape如下：

- StorageShape为[10, 20]：表示该aclTensor在内存上是按照[10, 20]排布的。
- ViewShape为[2, 5, 20]：在算子使用时，表示该aclTensor可被视为一块[2, 5, 20]的数据使用。


#### 函数原型

```
gert::Shape GetViewShape()
```


#### 参数说明

无


#### 返回值说明

返回值为gert::Shape，记录了一组shape信息，例如一个三维shape：[10, 20, 30]。

gert::Shape介绍参见《基础数据结构和接口(https://www.hiascend.com/document/detail/zh/canncommercial/900/maintenref/basicdataapi/atlasopapi_07_00001.html)》中“gert::Shape(https://www.hiascend.comdocument/detail/zh/canncommercial/900/maintenref/basicdataapi/atlasopapi_07_00149.html)”。


#### 约束说明

无


#### 调用示例

```
void Func(const aclTensor *input) {
    auto shape = input->GetViewShape();
}
```
