AddOriginalInput接口

接口功能

接口格式

Status AddOriginalInput(LLM_ENGINE_DataType datatype, const int64_t *shape, uint64_t dimCount, Input **input);
Status AddOriginalInput(const std::string &name, LLM_ENGINE_DataType datatype, const int64_t *shape, uint64_t dimCount, Input **input);

接口参数

参数

是否必选

说明

取值要求

datatype

必选

输入张量中保存的数据类型。

合法的数据类型,请参考LLM_ENGINE_DataType_enum枚举

shape

必选

输入张量的维度。

非空指针。取值建议为{1, size},size为输入张量的长度。

dimCount

必选

输入张量的dim。

uint64_类型,小于或等于10000。取值建议为2,与shape长度一致。

input

必选

指针的指针,用于在函数外访问到输入张量对象。

合法的指针的指针。

参数

是否必选

说明

取值要求

name

必选

输入张量的名称。

由大写字母和下划线组成,且不以下划线作为开头和结尾。

datatype

必选

输入张量中保存的数据类型。

合法的数据类型,请参考LLM_ENGINE_DataType_enum枚举

shape

必选

输入张量的维度。

非空指针。取值建议为{1, size},size为输入张量的长度。

dimCount

必选

输入张量的dim。

uint64_类型,小于或等于10000。取值建议为2,与shape长度一致。

input

必选

指针的指针,用于在函数外访问到输入张量对象。

合法的指针的指针。

使用样例

通过RequestId类,初始化请求对象,并为请求对象增加输入数据。

1
2
3
4
5
6
int reqId = 0;
request = std::make_shared<InferenceRequest>(RequestID(reqId));
InferenceRequest::Input *input;
data_size = 10;
std::vector<int64_t> shape({1, data_size});
request->AddOriginalInput(TYPE_INT64, &shape[0], shape.size(), &input);

返回值