AddTensor
Function
Adds a tensor.
Format
Status AddTensor(const std::string& tensorName, TensorPtr &tensor)
Parameters
Parameter |
Mandatory/Optional |
Description |
Value |
|---|---|---|---|
tensorName |
Mandatory |
Tensor name. |
Valid string type |
tensor |
Mandatory |
Tensor data. |
Valid InferTensor class. For details, see InferTensor. |
Usage Example
Construct a request object and add a tensor with the name of INPUT_IDS, TYPE_INT64, and shape {1, 2}.
1 2 3 4 5 6 7 | 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); |
Return Value
Status object.
Parent topic: InferRequest