---
title: GetMemType接口
description: "获取张量对象的MemType。"
url: https://www.hiascend.com/document/detail/zh/mindie/latest/mindiellm/llmdev/mindie_llm0108.html
sourcePath: /source/zh/mindie/310/mindiellm/llmdev/mindie_llm0108.html
indexId: 2c72f6f9bdd43734bf10cb7b5dd912b1e88ba2c79ce5730cdb6b9f37b6c06d7758
---
# GetMemType接口

#### 接口功能

获取张量对象的MemType。


#### 接口格式

```
MemType GetMemType() const
```


#### 接口参数

无。


#### 使用样例

构造一个名为"INPUT_IDS"，数据类型为INT64，数据维度为{1，2}的Tensor对象，然后获取对象的MemType。

```
std::string name = "INPUT_IDS";
mindie_llm::InferDataType dataType = mindie_llm::InferDataType::TYPE_INT64;
std::vector<int64_t> dataShape = {1, 2};
auto inputsTensor = std::make_shared<mindie_llm::InferTensor>(name, dataType, dataShape);
mindie_llm::MemType type = inputsTensor->GetMemType();
```


#### 返回值

张量对象的MemType，类型为MemType。
