forked from alibaba/MNN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTFQuantizeOp.fbs
161 lines (137 loc) · 2.66 KB
/
TFQuantizeOp.fbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
//
// MNN.fbs
// MNN
//
// Created by MNN on 2019/1/4.
// Copyright © 2018, Alibaba Group Holding Limited
//
include "CaffeOp.fbs";
include "Tensor.fbs";
include "Type.fbs";
namespace MNN;
enum FusedActivation : byte {
kTfLiteActNone = 0,
kTfLiteActRelu,
kTfLiteActRelu1,
kTfLiteActRelu6,
kTfLiteActTanh,
kTfLiteActSignBit,
kTfLiteActSigmoid,
}
table QuantizedParam {
zeroPoint: int;
scale: float;
}
table QuantizedAdd {
activationType: FusedActivation;
input1QuantizedParam: QuantizedParam;
input2QuantizedParam: QuantizedParam;
outputQuantizedParam: QuantizedParam;
}
enum ModeFormat : byte {
TENSORFLOW = 0,
TFLITE
}
enum QuantizeMode : byte {
MIN_COMBINED = 0,
MIN_FIRST,
SCALED
}
table Dequantize {
inputQuantizedParam: QuantizedParam;
mode: QuantizeMode;
modelFormat: ModeFormat = TENSORFLOW;
type: DataType;
}
table QuantizedAvgPool {
kernelX: int;
kernelY: int;
modelFormat: ModeFormat = TENSORFLOW;
outputActivationMax: int;
outputActivationMin: int;
padType: PoolPadType;
padX: int;
padY: int;
strideX: int;
strideY: int;
type: DataType;
}
table QuantizedBiasAdd {
bias: [int32];
inputType: DataType;
max: int32;
min: int32;
outputType: DataType;
}
table QuantizedConcat {
activationType: FusedActivation;
axis: int;
inputScale: [float];
inputZeroPoint: [int];
outputQuantizedParam: QuantizedParam;
}
table QuantizedLogistic {
inputQuantizedParam: QuantizedParam;
outputQuantizedParam: QuantizedParam;
}
table QuantizedMatMul {
transposeA: bool;
transposeB: bool;
}
table QuantizedMaxPool {
kernelX: int;
kernelY: int;
modelFormat: ModeFormat = TENSORFLOW;
outputActivationMax: int;
outputActivationMin: int;
padType: PoolPadType;
padX: int;
padY: int;
strideX: int;
strideY: int;
type: DataType;
}
table QuantizedRelu {
type: DataType;
}
table QuantizedRelu6 {
type: DataType;
}
table QuantizedReshape {
dims: [int];
modelFormat: ModeFormat = TENSORFLOW;
}
table QuantizedSoftmax {
beta: float;
inputScale: float;
}
enum QuantizeRoundMode : byte {
HALF_AWAY_FROM_ZERO = 0,
HALF_TO_EVEN
}
table QuantizeV2 {
type: DataType;
mode: QuantizeMode;
roundMode: QuantizeRoundMode;
}
table RequantizationRange { }
table Requantize { }
table TfQuantizedConv2D {
bias: [int32];
biasflag: bool;
common: Convolution2DCommon;
weight: [ubyte];
// tflite
activationType: FusedActivation;
multiplier: int32;
outMax: int32;
outMin: int32;
shift: int32;
// for depthwise_conv2D
biasQuantizedParam: QuantizedParam;
depthMultiplier: int;
filterQuantizedParam: QuantizedParam;
inputQuantizedParam: QuantizedParam;
modelFormat: ModeFormat = TENSORFLOW;
outputQuantizedParam: QuantizedParam;
}