---
title: InferTensor接口
description: "默认构造函数。"
url: https://www.hiascend.com/document/detail/zh/mindie/latest/mindiellm/llmdev/mindie_llm0103.html
sourcePath: /source/zh/mindie/310/mindiellm/llmdev/mindie_llm0103.html
indexId: 8fe535cbd3269e6485f232bc265dbcc71689468213243c295eb2d159a6c2891858
---
# InferTensor接口

#### 接口功能

默认构造函数。


#### 接口格式

```
InferTensor() = default;
InferTensor(std::string name, InferDataType dataType, std::vector<int64_t> dataShape);
InferTensor(const InferTensor &other) = delete;
```


#### 接口参数

| 参数 | 是否必选 | 说明 | 取值要求 |
| --- | --- | --- | --- |
| name | 是 | Tensor名称。 | 合法的string类型。 |
| dataType | 是 | tensor数据类型。 | 合法的数据类型，请参考InferDataType。 |
| dataShape | 是 | tensor数据维度。 | 合法的数据维度，类型为std::vector<int64\_t>。 |


#### 使用样例

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

```
auto runtimeTensor = std::make_shared<mindie_llm::InferTensor>();
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);
```


#### 返回值

InferTensor对象。
