---
title: GetVersion
description: "获取Tensor中的version。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/maintenref/basicdataapi/atlasopapi_07_00764.html
sourcePath: /source/zh/canncommercial/900/maintenref/basicdataapi/atlasopapi_07_00764.html
indexId: 57d794aeb389edff7a8e087d5b9a002d992222ed967981e827d00a7f81831d0e78
---
# GetVersion

#### 函数功能

获取Tensor中的version。


#### 函数原型

```
TensorVersion GetVersion () const
```


#### 参数说明

无


#### 返回值说明

获取Tensor的version。

关于TensorVersion类型的定义，请参见TensorVersion。


#### 约束说明

无


#### 调用示例

```
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 version = tensor.GetVersion(); // kTensorV2
```
