-
Notifications
You must be signed in to change notification settings - Fork 110
/
Operator.go
266 lines (235 loc) · 7.26 KB
/
Operator.go
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
package tflite
import (
flatbuffers "github.com/google/flatbuffers/go"
)
type Operator struct {
_tab flatbuffers.Table
}
func GetRootAsOperator(buf []byte, offset flatbuffers.UOffsetT) *Operator {
n := flatbuffers.GetUOffsetT(buf[offset:])
x := &Operator{}
x.Init(buf, n+offset)
return x
}
func GetSizePrefixedRootAsOperator(buf []byte, offset flatbuffers.UOffsetT) *Operator {
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
x := &Operator{}
x.Init(buf, n+offset+flatbuffers.SizeUint32)
return x
}
func (rcv *Operator) Init(buf []byte, i flatbuffers.UOffsetT) {
rcv._tab.Bytes = buf
rcv._tab.Pos = i
}
func (rcv *Operator) Table() flatbuffers.Table {
return rcv._tab
}
func (rcv *Operator) OpcodeIndex() uint32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
return rcv._tab.GetUint32(o + rcv._tab.Pos)
}
return 0
}
func (rcv *Operator) MutateOpcodeIndex(n uint32) bool {
return rcv._tab.MutateUint32Slot(4, n)
}
func (rcv *Operator) Inputs(j int) int32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.GetInt32(a + flatbuffers.UOffsetT(j*4))
}
return 0
}
func (rcv *Operator) InputsLength() int {
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
if o != 0 {
return rcv._tab.VectorLen(o)
}
return 0
}
func (rcv *Operator) MutateInputs(j int, n int32) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.MutateInt32(a+flatbuffers.UOffsetT(j*4), n)
}
return false
}
func (rcv *Operator) Outputs(j int) int32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.GetInt32(a + flatbuffers.UOffsetT(j*4))
}
return 0
}
func (rcv *Operator) OutputsLength() int {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
return rcv._tab.VectorLen(o)
}
return 0
}
func (rcv *Operator) MutateOutputs(j int, n int32) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.MutateInt32(a+flatbuffers.UOffsetT(j*4), n)
}
return false
}
func (rcv *Operator) BuiltinOptionsType() BuiltinOptions {
o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
if o != 0 {
return BuiltinOptions(rcv._tab.GetByte(o + rcv._tab.Pos))
}
return 0
}
func (rcv *Operator) MutateBuiltinOptionsType(n BuiltinOptions) bool {
return rcv._tab.MutateByteSlot(10, byte(n))
}
func (rcv *Operator) BuiltinOptions(obj *flatbuffers.Table) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
if o != 0 {
rcv._tab.Union(obj, o)
return true
}
return false
}
func (rcv *Operator) CustomOptions(j int) byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.GetByte(a + flatbuffers.UOffsetT(j*1))
}
return 0
}
func (rcv *Operator) CustomOptionsLength() int {
o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
if o != 0 {
return rcv._tab.VectorLen(o)
}
return 0
}
func (rcv *Operator) CustomOptionsBytes() []byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
if o != 0 {
return rcv._tab.ByteVector(o + rcv._tab.Pos)
}
return nil
}
func (rcv *Operator) MutateCustomOptions(j int, n byte) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.MutateByte(a+flatbuffers.UOffsetT(j*1), n)
}
return false
}
func (rcv *Operator) CustomOptionsFormat() CustomOptionsFormat {
o := flatbuffers.UOffsetT(rcv._tab.Offset(16))
if o != 0 {
return CustomOptionsFormat(rcv._tab.GetInt8(o + rcv._tab.Pos))
}
return 0
}
func (rcv *Operator) MutateCustomOptionsFormat(n CustomOptionsFormat) bool {
return rcv._tab.MutateInt8Slot(16, int8(n))
}
func (rcv *Operator) MutatingVariableInputs(j int) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(18))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.GetBool(a + flatbuffers.UOffsetT(j*1))
}
return false
}
func (rcv *Operator) MutatingVariableInputsLength() int {
o := flatbuffers.UOffsetT(rcv._tab.Offset(18))
if o != 0 {
return rcv._tab.VectorLen(o)
}
return 0
}
func (rcv *Operator) MutateMutatingVariableInputs(j int, n bool) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(18))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.MutateBool(a+flatbuffers.UOffsetT(j*1), n)
}
return false
}
func (rcv *Operator) Intermediates(j int) int32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(20))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.GetInt32(a + flatbuffers.UOffsetT(j*4))
}
return 0
}
func (rcv *Operator) IntermediatesLength() int {
o := flatbuffers.UOffsetT(rcv._tab.Offset(20))
if o != 0 {
return rcv._tab.VectorLen(o)
}
return 0
}
func (rcv *Operator) MutateIntermediates(j int, n int32) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(20))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.MutateInt32(a+flatbuffers.UOffsetT(j*4), n)
}
return false
}
func OperatorStart(builder *flatbuffers.Builder) {
builder.StartObject(9)
}
func OperatorAddOpcodeIndex(builder *flatbuffers.Builder, opcodeIndex uint32) {
builder.PrependUint32Slot(0, opcodeIndex, 0)
}
func OperatorAddInputs(builder *flatbuffers.Builder, inputs flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(inputs), 0)
}
func OperatorStartInputsVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(4, numElems, 4)
}
func OperatorAddOutputs(builder *flatbuffers.Builder, outputs flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(2, flatbuffers.UOffsetT(outputs), 0)
}
func OperatorStartOutputsVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(4, numElems, 4)
}
func OperatorAddBuiltinOptionsType(builder *flatbuffers.Builder, builtinOptionsType BuiltinOptions) {
builder.PrependByteSlot(3, byte(builtinOptionsType), 0)
}
func OperatorAddBuiltinOptions(builder *flatbuffers.Builder, builtinOptions flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(4, flatbuffers.UOffsetT(builtinOptions), 0)
}
func OperatorAddCustomOptions(builder *flatbuffers.Builder, customOptions flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(5, flatbuffers.UOffsetT(customOptions), 0)
}
func OperatorStartCustomOptionsVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(1, numElems, 1)
}
func OperatorAddCustomOptionsFormat(builder *flatbuffers.Builder, customOptionsFormat CustomOptionsFormat) {
builder.PrependInt8Slot(6, int8(customOptionsFormat), 0)
}
func OperatorAddMutatingVariableInputs(builder *flatbuffers.Builder, mutatingVariableInputs flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(7, flatbuffers.UOffsetT(mutatingVariableInputs), 0)
}
func OperatorStartMutatingVariableInputsVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(1, numElems, 1)
}
func OperatorAddIntermediates(builder *flatbuffers.Builder, intermediates flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(8, flatbuffers.UOffsetT(intermediates), 0)
}
func OperatorStartIntermediatesVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(4, numElems, 4)
}
func OperatorEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
return builder.EndObject()
}