Input(const std::string &name, const LLM_ENGINE_DataType datatype, const int64_t *shape,const uint64_t dim_count)

接口功能

根据输入张量名称,张量内的数据类型,张量维度,张量dim创建推理请求输入张量对象。

接口格式

Input(const std::string &name, const LLM_ENGINE_DataType datatype, const int64_t *shape, const uint64_t dim_count)

接口参数

表1 接口参数

参数

是否必选

说明

取值要求

name

必选

输入张量名称。

合法字符串,非空。

datatype

必选

张量中保存的数据类型。

LLM_ENGINE_DataType_enum类型,请参见表2

shape

必选

张量的维度。

合法的维度信息。

dim_count

必选

张量的dim。

合法的维度值。

表2 LLM_ENGINE_DataType_enum类型说明

LLM_ENGINE_DataType_enum类型

意义

TYPE_INVALID

0

非法类型

TYPE_BOOL

1

bool类型

TYPE_UINT8

2

uint8类型

TYPE_UINT16

3

uint16类型

TYPE_UINT32

4

uint32类型

TYPE_UINT64

5

uint64类型

TYPE_INT8

6

int8类型

TYPE_INT16

7

int16类型

TYPE_INT32

8

int32类型

TYPE_INT64

9

int64类型

TYPE_FP16

10

float16类型

TYPE_FP32

11

float32类型

TYPE_FP64

12

float64类型

TYPE_STRING

13

string类型

TYPE_BF16

14

bf16类型

TYPE_BUTT

15

保留值

使用样例

std::shared_ptr<Input> input = std::make_shared<Input>(name, datatype, shape, dim_count);

返回值

返回推理请求输入张量对象。