---
title: 函数：create_tensor_desc
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendgraphapi/aclpythondevg_01_0023.html
sourcePath: /source/zh/canncommercial/900/API/ascendgraphapi/aclpythondevg_01_0023.html
indexId: 2ed928e5d99eec2a1ca00255aaf24a1186b07a27777b9e2e1d3eceaffc3f7b9175
---
# 函数：create_tensor_desc

#### 产品支持情况

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


#### 功能说明

创建aclTensorDesc类型的数据，该数据类型用于描述Tensor的数据类型、Shape、Format等信息。

如需销毁aclTensorDesc类型的数据，请参见函数：destroy_tensor_desc。


#### 函数原型

- C函数原型
  1 aclTensorDesc *aclCreateTensorDesc(aclDataType dataType, int numDims, const int64_t *dims, aclFormat format)

- python函数
  1 tensor_desc = acl.create_tensor_desc(data_type, dims, format)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| data\_type | int，表示Tensor描述的数据类型。 |
| dims | list，Tensor描述指定维度大小。“dims”是一个int的列表，列表中的每项表示Tensor中每个维度的大小，如果列表中某个元素的值为0，则为空Tensor。如果用户需要使用空Tensor，则在申请内存时，内存大小最小为1Byte，以保障后续业务正常运行。 |
| format | int，Tensor描述的Format。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| tensor\_desc | int，创建Tensor描述的地址对象。 |
