---
title: EsSetDataType
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendgraphapi/atlasgeapi_07_0509.html
sourcePath: /source/zh/canncommercial/900/API/ascendgraphapi/atlasgeapi_07_0509.html
indexId: 21bc8ee88a7cdd92734ae0865b3e7a8b9a3049a870104c949e45c274a5a32fda72
---
# EsSetDataType

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | √ |
| Atlas 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |


#### 头文件/库文件

- 头文件：#include <ge/esb_funcs.h>
- 库文件：libeager_style_graph_builder_base.so、libeager_style_graph_builder_base_static.a


#### 功能说明

设置Tensor的数据类型，不设置默认为float。


#### 函数原型

```
uint32_t EsSetDataType(EsCTensorHolder *tensor, C_DataType data_type)
```


#### 参数说明

| 参数名 | 输入/输出 | 说明 |
| --- | --- | --- |
| tensor | 输入 | tensor持有者指针。 |
| data\_type | 输入 | 数据类型。 |


#### 返回值说明

| 参数名 | 类型 | 说明 |
| --- | --- | --- |
| \- | uint32\_t | 成功为0，其他失败。 |


#### 约束说明

无


#### 调用示例

```
/ 1. 创建图构建器（EsCGraphBuilder）
EsCGraphBuilder *builder = EsCreateGraphBuilder("graph_name");
// 2. 添加起始节点
EsCTensorHolder *data0 = EsCreateInput(builder, 0); // 添加第 0 个输入节点, 默认为FLOAT类型
EsSetDataType(data0, C_DT_INT32); //设置第0个输入节点的数据类型
```
