下载
中文
注册

Input接口

接口功能

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

接口格式

Input(const std::string &name, LLM_ENGINE_DataType datatype, const int64_t *shape, uint64_t dimCount);
Input() = delete;

接口参数

表1 接口参数

参数

是否必选

说明

取值要求

name

必选

输入张量名称。

合法字符串string类型,非空。

datatype

必选

张量中保存的数据类型。

LLM_ENGINE_DataType_enum类型,请参见表2

shape

必选

张量的维度。

合法的维度信息,取值建议为{1, size},size为输入张量的长度。

dimCount

必选

张量的dim。

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

表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

保留值

使用样例

Input* input(name, datatype, shape, dimCount);

返回值

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