Files
2026-07-13 13:33:03 +08:00

354 lines
5.6 KiB
Plaintext

include "Tensor.fbs";
namespace MNN;
enum BinaryOpOperation : int {
ADD = 0,
SUB = 1,
MUL = 2,
DIV = 3,
MAX_TEMP = 4,
MIN_TEMP = 5,
POW = 6,
REALDIV = 7,
MINIMUM = 8,
MAXIMUM = 9,
GREATER = 10,
GREATER_EQUAL = 11,
LESS = 12,
FLOORDIV = 13,
SquaredDifference = 14,
EQUAL = 15,
LESS_EQUAL = 16,
FLOORMOD = 17,
MOD = 19,
ATAN2 = 20,
LOGICALOR = 21,
NOTEQUAL = 22,
BITWISE_AND = 23,
BITWISE_OR = 24,
BITWISE_XOR = 25,
LOGICALXOR = 26,
LEFTSHIFT = 27,
RIGHTSHIFT = 28,
MUL_SILU = 29,
}
table BinaryOp {
opType:BinaryOpOperation;
T:DataType=DT_FLOAT;
// 0 -> No Activation
// 1 -> Relu
activationType:int=0;
}
table PackParam {
dataType:DataType;
axis:int;
}
table StridedSliceParam {
Index:DataType;
T:DataType;
beginMask:int;
endMask:int;
ellipsisMask:int;
newAxisMask:int;
shrinkAxisMask:int;
// type 0 --> from TF
// type 1 --> from Onnx/Torch
fromType:int;
}
table SqueezeParam {
squeezeDims:[int];
}
table CastParam {
srcT:DataType;
dstT:DataType;
}
enum ReductionType : byte{
SUM = 0,
ASUM = 1,
SUMSQ = 2,
MEAN = 3,
MAXIMUM = 4,
MINIMUM = 5,
PROD = 6,
ANY = 7,
ALL = 8,
}
table ReductionParam {
operation:ReductionType;
dim:[int];
coeff:float;
keepDims:bool;
dType:DataType=DT_FLOAT;
}
table Gather {
Tindices:DataType;
Tparams:DataType;
validateIndices:bool;
axis:int;
}
table ExpandDims {
T:DataType;
Tdim:DataType;
axis:int;
}
table Selu {
scale:float;
alpha:float;
}
table AsString {
T:DataType;
precision:int;
scientific:bool;
shortest:bool;
width:int;
fillString:string;
}
table ReduceJoin {
keepDims:bool;
separator:string;
}
enum UnaryOpOperation : int {
ABS = 0,
NEG = 1,
FLOOR = 2,
CEIL = 3,
SQUARE = 4,
SQRT = 5,
RSQRT = 6,
EXP = 7,
LOG = 8,
SIN = 9,
COS = 10,
TAN = 11,
ASIN = 12,
ACOS = 13,
ATAN = 14,
RECIPROCAL = 15,
LOG1P = 16,
BNLL = 17,
ACOSH = 18,
SINH = 19,
ASINH = 20,
ATANH = 21,
SIGN = 22,
ROUND = 23,
COSH = 24,
ERF = 25,
ERFC = 26,
ERFINV = 27,
EXPM1 = 28,
SIGMOID = 29,
TANH = 30,
HARDSWISH = 31,
GELU = 32,
GELU_STANDARD = 33,
SILU = 34,
}
table UnaryOp {
opType:UnaryOpOperation;
T:DataType;
tableInt8:[int8];
}
table TopKV2 {
T:DataType=DT_FLOAT;
sorted:bool=false;
largest:bool=true;
}
enum CropAndResizeMethod : byte{
BILINEAR=0,
NEAREST=1,
}
table CropAndResize {
extrapolationValue:float;
method:CropAndResizeMethod;
}
table Fill {
}
table GatherV2 {
Taxis:DataType;
Tindices:DataType;
Tparams:DataType;
}
table NonMaxSuppressionV2 {
}
table Range {
Tidx:DataType;
}
table Rank {
}
table Size {
outputDataType:DataType;
}
table Transpose {
Tperm:DataType;
}
table SliceTf {
T:DataType;
}
table QuantizeMaxMin {
T:DataType;
}
table Crop {
axis:int=2;
offset:[int];
}
table SpaceBatch {
blockShape:Blob;
padding:Blob;
}
table MatMul {
T:DataType;
transposeA:bool;
transposeB:bool;
weight:[float];
bias:[float];
}
table MomentsParam {
dim:[int];
keepDims:bool=true;
dType:DataType=DT_FLOAT;
}
table RNNParam {
numUnits: int;
isBidirectionalRNN: bool;
linearBeforeReset: bool;
keepAllOutputs: bool;
fwGateWeight: Blob;
fwGateBias: Blob;
fwCandidateWeight: Blob;
fwCandidateBias: Blob;
fwRecurrentBias: Blob;
bwGateWeight: Blob;
bwGateBias: Blob;
bwCandidateWeight: Blob;
bwCandidateBias: Blob;
bwRecurrentBias: Blob;
}
table BatchMatMulParam {
adjX: bool = false;
adjY: bool = false;
}
enum DepthToSpaceMode : byte {
DCR = 0,
CRD = 1
}
// DepthToSpace and SpaceToDepth using the same parameter
table DepthSpaceParam {
blockSize: int;
mode: DepthToSpaceMode = DCR;
}
table ReverseSequenceParam {
batchDim: int;
seqDim : int;
}
table DetectionPostProcessParam{
maxDetections: int;
maxClassesPerDetection: int;
detectionsPerClass: int;
nmsScoreThreshold:float;
iouThreshold:float;
numClasses:int;
useRegularNMS:bool;
// y_scale, x_scale, h_scale, w_scale
// always size == 4
centerSizeEncoding:[float];
}
table OneHotParam{
dType:DataType=DT_FLOAT;
axis:int=-1;
}
enum PadValueMode : byte{
CONSTANT = 0,
REFLECT = 1,
SYMMETRIC = 2,
EDGE=3,
}
table PadParam{
mode: PadValueMode = CONSTANT;
}
table LayerNorm {
axis: [int];
epsilon: float;
gamma: [float];
beta: [float];
group: int = 1;
external:[int64]; // [offset, gamma_bytes_size, beta_bytes_size]
useRMSNorm: bool = false;
}
table GroupNorm {
axis: int;
epsilon: float;
gamma: [float];
beta: [float];
group: int = 1;
bSwish: int = 0;
external:[int64]; // [offset, gamma_bytes_size, beta_bytes_size]
}
table RandomUniform {
seed:int = 0;
seed2:int = 0;
type:DataType = DT_FLOAT;
low:float = 0.0;
high:float = 1.0;
}
table TensorArray {
// false - fix array size; true - dynamic array size;
dynamic_size:bool = false;
// false - element dynamic shape; true - element identical shape;
identical_element_shapes:bool = false;
element_shape:[int];
T:DataType = DT_FLOAT;
// onnx related attributes
axis:int = 0;
keepdims:bool = true;
new_axis:bool = false;
}
table LSTMBlockCell {
cell_clip:float = 3.0;
forget_bias:float = 1.0;
use_peephole:bool = false;
}