---
title: ImmutableInputs接口
description: "获取TensorMap对象。"
url: https://www.hiascend.com/document/detail/zh/mindie/latest/mindiellm/llmdev/mindie_llm0072.html
sourcePath: /source/zh/mindie/310/mindiellm/llmdev/mindie_llm0072.html
indexId: 1ecaf1fb7c376e9b21b42c0ed7ae4d8d2c742320a554a8c4b17573b51d10a71b58
---
# ImmutableInputs接口

#### 接口功能

获取TensorMap对象。


#### 接口格式

```
const TensorMap &ImmutableInputs() const
```


#### 接口参数

无。


#### 使用样例

构造一个请求对象后，给请求添加一个Tensor对象，然后再获取该请求对象中的TensorMap对象。

```
mindie_llm::InferRequestId runtimeReqId(0);
std::shared_ptr<mindie_llm::InferRequest> runtimeRequest(runtimeReqId);
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);
runtimeRequest->AddTensor(name, inputsTensor);
TensorMap tensorMap = runtimeRequest->ImmutableInputs();
```


#### 返回值

TensorMap对象。
