-
Notifications
You must be signed in to change notification settings - Fork 110
/
QuantizationParameters.go
211 lines (186 loc) · 6.05 KB
/
QuantizationParameters.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
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
package tflite
import (
flatbuffers "github.com/google/flatbuffers/go"
)
type QuantizationParameters struct {
_tab flatbuffers.Table
}
func GetRootAsQuantizationParameters(buf []byte, offset flatbuffers.UOffsetT) *QuantizationParameters {
n := flatbuffers.GetUOffsetT(buf[offset:])
x := &QuantizationParameters{}
x.Init(buf, n+offset)
return x
}
func GetSizePrefixedRootAsQuantizationParameters(buf []byte, offset flatbuffers.UOffsetT) *QuantizationParameters {
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
x := &QuantizationParameters{}
x.Init(buf, n+offset+flatbuffers.SizeUint32)
return x
}
func (rcv *QuantizationParameters) Init(buf []byte, i flatbuffers.UOffsetT) {
rcv._tab.Bytes = buf
rcv._tab.Pos = i
}
func (rcv *QuantizationParameters) Table() flatbuffers.Table {
return rcv._tab
}
func (rcv *QuantizationParameters) Min(j int) float32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.GetFloat32(a + flatbuffers.UOffsetT(j*4))
}
return 0
}
func (rcv *QuantizationParameters) MinLength() int {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
return rcv._tab.VectorLen(o)
}
return 0
}
func (rcv *QuantizationParameters) MutateMin(j int, n float32) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.MutateFloat32(a+flatbuffers.UOffsetT(j*4), n)
}
return false
}
func (rcv *QuantizationParameters) Max(j int) float32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.GetFloat32(a + flatbuffers.UOffsetT(j*4))
}
return 0
}
func (rcv *QuantizationParameters) MaxLength() int {
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
if o != 0 {
return rcv._tab.VectorLen(o)
}
return 0
}
func (rcv *QuantizationParameters) MutateMax(j int, n float32) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.MutateFloat32(a+flatbuffers.UOffsetT(j*4), n)
}
return false
}
func (rcv *QuantizationParameters) Scale(j int) float32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.GetFloat32(a + flatbuffers.UOffsetT(j*4))
}
return 0
}
func (rcv *QuantizationParameters) ScaleLength() int {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
return rcv._tab.VectorLen(o)
}
return 0
}
func (rcv *QuantizationParameters) MutateScale(j int, n float32) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.MutateFloat32(a+flatbuffers.UOffsetT(j*4), n)
}
return false
}
func (rcv *QuantizationParameters) ZeroPoint(j int) int64 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.GetInt64(a + flatbuffers.UOffsetT(j*8))
}
return 0
}
func (rcv *QuantizationParameters) ZeroPointLength() int {
o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
if o != 0 {
return rcv._tab.VectorLen(o)
}
return 0
}
func (rcv *QuantizationParameters) MutateZeroPoint(j int, n int64) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.MutateInt64(a+flatbuffers.UOffsetT(j*8), n)
}
return false
}
func (rcv *QuantizationParameters) DetailsType() QuantizationDetails {
o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
if o != 0 {
return QuantizationDetails(rcv._tab.GetByte(o + rcv._tab.Pos))
}
return 0
}
func (rcv *QuantizationParameters) MutateDetailsType(n QuantizationDetails) bool {
return rcv._tab.MutateByteSlot(12, byte(n))
}
func (rcv *QuantizationParameters) Details(obj *flatbuffers.Table) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
if o != 0 {
rcv._tab.Union(obj, o)
return true
}
return false
}
func (rcv *QuantizationParameters) QuantizedDimension() int32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(16))
if o != 0 {
return rcv._tab.GetInt32(o + rcv._tab.Pos)
}
return 0
}
func (rcv *QuantizationParameters) MutateQuantizedDimension(n int32) bool {
return rcv._tab.MutateInt32Slot(16, n)
}
func QuantizationParametersStart(builder *flatbuffers.Builder) {
builder.StartObject(7)
}
func QuantizationParametersAddMin(builder *flatbuffers.Builder, min flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(min), 0)
}
func QuantizationParametersStartMinVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(4, numElems, 4)
}
func QuantizationParametersAddMax(builder *flatbuffers.Builder, max flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(max), 0)
}
func QuantizationParametersStartMaxVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(4, numElems, 4)
}
func QuantizationParametersAddScale(builder *flatbuffers.Builder, scale flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(2, flatbuffers.UOffsetT(scale), 0)
}
func QuantizationParametersStartScaleVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(4, numElems, 4)
}
func QuantizationParametersAddZeroPoint(builder *flatbuffers.Builder, zeroPoint flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(3, flatbuffers.UOffsetT(zeroPoint), 0)
}
func QuantizationParametersStartZeroPointVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(8, numElems, 8)
}
func QuantizationParametersAddDetailsType(builder *flatbuffers.Builder, detailsType QuantizationDetails) {
builder.PrependByteSlot(4, byte(detailsType), 0)
}
func QuantizationParametersAddDetails(builder *flatbuffers.Builder, details flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(5, flatbuffers.UOffsetT(details), 0)
}
func QuantizationParametersAddQuantizedDimension(builder *flatbuffers.Builder, quantizedDimension int32) {
builder.PrependInt32Slot(6, quantizedDimension, 0)
}
func QuantizationParametersEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
return builder.EndObject()
}