GraphParam

功能

图算子参数。

定义

1
2
3
4
5
6
7
8
struct GraphParam {
    std::string name;
    uint32_t inTensorNum = 0;
    uint32_t outTensorNum = 0;
    uint32_t internalTensorNum = 0;
    std::vector<Node> nodes;
    InferShapeFunc inferShapeFunc = nullptr;
};

参数列表

成员名称

数据类型

默认值

描述

name

std::string

-

图算子名称。

仅允许字母、数字、下划线,名称长度不超过128。

inTensorNum

uint32_t

0

图算子输入tensor的数量,需小于或等于256,传入不正确的Tensor数量将返回“ERROR_INVALID_IN_TENSOR_NUM”报错,具体请参见ErrorType

outTensorNum

uint32_t

0

图算子输出tensor的数量,需小于或等于256,传入不正确的Tensor数量将返回“ERROR_INVALID_IN_TENSOR_NUM”报错,具体请参见ErrorType

internalTensorNum

uint32_t

0

图算子中间tensor的数量,需小于或等于256,传入不正确的Tensor数量将返回“ERROR_INVALID_IN_TENSOR_NUM”报错,具体请参见ErrorType

nodes

std::vector<Node>

-

图算子Node Vector。

nodes的长度满足小于1024。

nodes的顺序,需要满足各个node对应operation的执行顺序依赖关系,先执行的在前面,后执行的在后面。

如果inTensorNum,outTensorNum与internalTensorNum之和为S,则nodes中各个元素的inTensorIds,outTensorIds中各元素值均要求落在[0, S-1]范围内。

inferShapeFunc

InferShapeFunc

nullptr

inferShape函数指针。