---
title: DelTensorByName接口
description: "根据Name删除Tensor。"
url: https://www.hiascend.com/document/detail/zh/mindie/latest/mindiellm/llmdev/mindie_llm0067.html
sourcePath: /source/zh/mindie/310/mindiellm/llmdev/mindie_llm0067.html
indexId: 36c1acc1928462100e2584c339b4e51ce3e91ba0d1b5dc41c79dc165502ce7cf58
---
# DelTensorByName接口

#### 接口功能

根据Name删除Tensor。


#### 接口格式

```
Status DelTensorByName(const std::string &name)
```


#### 接口参数

| 参数 | 是否必选 | 说明 | 取值要求 |
| --- | --- | --- | --- |
| name | 是 | Tensor名称。 | 合法的string类型。 |


#### 使用样例

构造一个请求对象，从请求中删除名称为“INPUT_IDS”的Tensor对象。

```
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);
mindie_llm::TensorPtr tensor = std::make_shared<mindie_llm::InferTensor>();
mindie_llm::Status ret = runtimeRequest->DelTensorByName("INPUT_IDS");
```


#### 返回值

Status对象。
