---
title: GetShapeSize
description: "获取当前Tensor运行时的shape大小，即此Tensor中包含的元素的数量。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/maintenref/basicdataapi/atlasopapi_07_00197.html
sourcePath: /source/zh/canncommercial/900/maintenref/basicdataapi/atlasopapi_07_00197.html
indexId: 684c6e11725a5acec9d7ddbb5edf44abf2ca1efe7ed232597d637117a1a146b478
---
# GetShapeSize

#### 函数功能

获取当前Tensor运行时的shape大小，即此Tensor中包含的元素的数量。


#### 函数原型

```
int64_t GetShapeSize() const
```


#### 参数说明

无。


#### 返回值说明

返回执行时shape的大小。


#### 约束说明

无。


#### 调用示例

```
Tensor tensor{{{8, 3, 224, 224}, {16, 3, 224, 224}},       // shape                
              {ge::FORMAT_ND, ge::FORMAT_FRACTAL_NZ, {}},  // format                              
              kFollowing,                                  // placement                
              ge::DT_FLOAT16,                              //dt                
              nullptr};
auto shape_size = tensor.GetShapeSize(); // 16*3*224*224
```
