DelTensorByName

Function

Deletes a tensor based on the name.

Format

Status DelTensorByName(const std::string &name)

Parameters

Parameter

Mandatory/Optional

Description

Value

name

Mandatory

Tensor name.

Valid string type

Usage Example

Construct a request object and delete the tensor object named INPUT_IDS from the request.

1
2
3
4
5
6
7
8
9
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");

Return Value

Status object.