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

#### 产品支持情况

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


#### 功能说明

获取算子的指定Index的Tensor描述信息。


#### 函数原型

- C函数原型
  1 aclTensorDesc *aclGetTensorDescByIndex(aclTensorDesc *desc, size_t index)

- python函数
  1 tensor_desc = acl.get_tensor_desc_by_index(desc, index)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| desc | int，Tensor描述数据的指针地址。 调用acl.mdl.create\_and\_get\_op\_desc接口，获取算子所有输入/输出的Tensor描述作为本接口的输入。 |
| index | int，指定获取第几个维度的大小，“index”值从0开始。 调用acl.mdl.create\_and\_get\_op\_desc接口获取的算子输入/输出的数量后，该“index”的取值范围：[0, (算子输入/输出的数量 \- 1)]。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| tensor\_desc | int，返回指定输入/输出的Tensor描述信息的指针地址。 |
