---
title: GetDataType
description: "获取TensorDesc所描述Tensor的数据类型。"
url: https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/maintenref/basicdataapi/atlasopapi_07_00432.html
sourcePath: /source/zh/CANNCommunityEdition/920beta1/maintenref/basicdataapi/atlasopapi_07_00432.html
indexId: 9a458e1ba72db63b8628d39a64a11090c3650650872af0d84da6bfe2547f50d589
---
# GetDataType

#### 函数功能

获取TensorDesc所描述Tensor的数据类型。


#### 函数原型

```
DataType GetDataType() const
```


#### 参数说明

无。


#### 返回值

DataType类型，TensorDesc所描述的Tensor的数据类型。


#### 异常处理

无。


#### 约束说明

由于返回的DataType信息为值拷贝，因此修改返回的DataType信息，不影响TensorDesc中已有的DataType信息。
