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

#### 产品支持情况

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


#### 功能说明

根据指定的“dstFormat”转换“srcDesc”（输入源aclTensorDesc中）的Format，生成新的目标aclTensorDesc，源aclTensorDesc中的Format保持不变。当前版本不支持该接口，预留接口。


#### 函数原型

- C函数原型
  1 aclError aclTransTensorDescFormat(const aclTensorDesc *srcDesc, aclFormat dstFormat, aclTensorDesc **dstDesc)

- python函数
  1 dst_desc, ret =acl.trans_tensor_desc_format(src_desc, dst_format)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| src\_desc | int，输入源aclTensorDesc数据的指针地址。需提前调用函数：create\_tensor\_desc接口创建aclTensorDesc类型。 |
| dst\_format | int，需要设置的目标Format，具体请参见aclFormat(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg\_01\_0914.html)。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| dst\_desc | int，输出aclTensorDesc的指针地址。需提前调用函数：create\_tensor\_desc接口创建aclTensorDesc类型。 |
| ret | int，错误码。 返回0表示成功。 返回其它值(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg\_01\_0911.html)表示失败。 |
