下载
中文
注册

SetTensor接口

接口功能

请求的设置Tensor接口。

接口格式

void SetTensor(const std::string& tensorName, TensorPtr &tensor)

接口参数

参数

是否必选

说明

取值要求

tensorName

tensor名字。

合法的字符串string类型。

tensor

tensor内容。

合法的InferTensor类型,参考InferTensor

使用样例

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->SetTensor(name, inputsTensor);

返回值

无。