---
title: TensorDesc简介
description: "TensorDesc用于储存ListTensorDesc.GetDesc()中根据index获取对应的Tensor描述信息。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendcopapi/atlasascendc_api_07_00062.html
sourcePath: /source/zh/canncommercial/900/API/ascendcopapi/atlasascendc_api_07_00062.html
indexId: 86244c85bea4b4d48a7268aaa7d8ed720100c1951380cb5013fc9850694792fb77
---
# TensorDesc简介

TensorDesc用于储存ListTensorDesc.GetDesc()中根据index获取对应的Tensor描述信息。

#### 原型定义

```
template<class T> class TensorDesc {
    TensorDesc();
    ~TensorDesc();
    void SetShapeAddr(uint64_t* shapePtr);
    uint64_t GetDim();
    uint64_t GetIndex();
    uint64_t GetShape(uint32_t offset);
    T* GetDataPtr();
    GlobalTensor<T> GetDataObj();
}
```


#### 模板参数


**表1 模板参数说明**

| 参数名 | 描述 |
| --- | --- |
| T | Tensor数据类型。 |


#### 成员函数

```
TensorDesc
()
~
TensorDesc
()
void
SetShapeAddr
(uint64_t* shapePtr)
uint64_t
GetDim
()
uint64_t
GetIndex
()
uint64_t
GetShape
(uint32_t offset)
T*
GetDataPtr
()
GlobalTensor<T>
GetDataObj
()
```
