---
title: GetTensorShape
description: "获取Tensor的shape。"
url: https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/others/tbeaicpudevg/atlascpuapi_10_0023.html
sourcePath: /source/zh/CANNCommunityEdition/920beta1/others/tbeaicpudevg/atlascpuapi_10_0023.html
indexId: 483b0fce704c7f66fe6d4736771dc180c2dfbc5107decd191f8cf618dfbb2b0c85
---
# GetTensorShape

#### 函数功能

获取Tensor的shape。


#### 函数原型

std::shared_ptr<TensorShape> GetTensorShape() const


#### 参数说明

无


#### 返回值说明

std::shared_ptr<TensorShape>，Tensor的shape的指针。


#### 约束说明

无。


#### 调用示例

```
auto shape = tensor->GetTensorShape();
```
