ImmutableInputs接口
接口功能
获取TensorMap对象。
接口格式
const TensorMap &ImmutableInputs() const
接口参数
无。
使用样例
构造一个请求对象后,给请求添加一个Tensor对象,然后再获取该请求对象中的TensorMap对象。
1 2 3 4 5 6 7 8 | 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对象。
父主题: InferRequest