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

#### 函数功能

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


#### 函数原型

```
int64_t GetShapeSize() const
```


#### 参数说明

无


#### 返回值说明

返回执行时形状的大小。


#### 约束说明

无


#### 调用示例

```
TensorV2 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
```
