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

#### 产品支持情况

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


#### 功能说明

如果模型输入或输出的Shape是动态的，模型在模型执行之后可以调用本接口从aclmdlDataset类型的数据（该类型用于描述模型推理时的输入数据、输出数据）中获取指定的输入或者输出的Tensor描述信息。

典型场景举例：如果模型输入Shape是动态的，在模型执行之前调acl.mdl.set_dataset_tensor_desc设置该输入的Tensor描述信息，在模型执行之后，调用acl.mdl.get_dataset_tensor_desc接口获取模型动态输出的Tensor描述信息。


#### 函数原型

- C函数原型
  1 aclTensorDesc *aclmdlGetDatasetTensorDesc(const aclmdlDataset *dataset, size_t index)

- python函数
  1 tensorDesc =acl.mdl.get_dataset_tensor_desc(dataset, index)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| dataset | int，表示模型执行的输入或输出数据结构的指针地址。 |
| index | int，表示第几个输入或输出的序号。 模型存在多个输入、输出时，为避免序号出错，可以先调用acl.mdl.get\_input\_name\_by\_index、acl.mdl.get\_output\_name\_by\_index接口获取输入、输出的名称，根据输入、输出名称所对应的index来设置。 |


#### 返回值说明

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