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

#### 函数功能

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


#### 函数原型

```
DataType GetDataType() const
```


#### 参数说明

无。


#### 返回值

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


#### 异常处理

无。


#### 约束说明

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