flockml 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deep-profiling-report.html +119 -0
- package/dist/activations.d.ts +13 -0
- package/dist/activations.js +47 -0
- package/dist/break-test.d.ts +1 -0
- package/dist/break-test.js +249 -0
- package/dist/brutal-test.d.ts +1 -0
- package/dist/brutal-test.js +113 -0
- package/dist/client-node.d.ts +48 -0
- package/dist/client-node.js +174 -0
- package/dist/coordinator.d.ts +41 -0
- package/dist/coordinator.js +155 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +13 -0
- package/dist/matrix.d.ts +67 -0
- package/dist/matrix.js +185 -0
- package/dist/micro-benchmark.d.ts +1 -0
- package/dist/micro-benchmark.js +215 -0
- package/dist/network.d.ts +32 -0
- package/dist/network.js +127 -0
- package/dist/privacy.d.ts +17 -0
- package/dist/privacy.js +70 -0
- package/dist/quantization.d.ts +33 -0
- package/dist/quantization.js +92 -0
- package/dist/test.d.ts +1 -0
- package/dist/test.js +58 -0
- package/dist/worker.d.ts +15 -0
- package/dist/worker.js +95 -0
- package/package.json +21 -0
- package/src/activations.ts +45 -0
- package/src/break-test.ts +234 -0
- package/src/brutal-test.ts +103 -0
- package/src/client-node.ts +154 -0
- package/src/coordinator.ts +137 -0
- package/src/index.ts +5 -0
- package/src/messages.d.ts +429 -0
- package/src/messages.js +1173 -0
- package/src/messages.proto +30 -0
- package/src/micro-benchmark.ts +200 -0
- package/src/network.ts +113 -0
- package/src/privacy.ts +39 -0
- package/src/quantization.ts +82 -0
- package/src/test.ts +72 -0
- package/src/worker.ts +95 -0
- package/stress-report.html +190 -0
- package/tsconfig.json +14 -0
package/src/messages.js
ADDED
|
@@ -0,0 +1,1173 @@
|
|
|
1
|
+
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-mixed-operators, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars, default-case, jsdoc/require-param*/
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var $protobuf = require("protobufjs/minimal");
|
|
5
|
+
|
|
6
|
+
// Common aliases
|
|
7
|
+
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
|
8
|
+
var $Object = $util.global.Object, $undefined = $util.global.undefined, $Error = $util.global.Error, $TypeError = $util.global.TypeError, $Number = $util.global.Number, $String = $util.global.String, $Array = $util.global.Array, $isFinite = $util.global.isFinite;
|
|
9
|
+
|
|
10
|
+
// Exported root namespace
|
|
11
|
+
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
|
|
12
|
+
|
|
13
|
+
$root.flockml = (function() {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Namespace flockml.
|
|
17
|
+
* @exports flockml
|
|
18
|
+
* @namespace
|
|
19
|
+
*/
|
|
20
|
+
var flockml = {};
|
|
21
|
+
|
|
22
|
+
flockml.QuantizedMatrix = (function() {
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Properties of a QuantizedMatrix.
|
|
26
|
+
* @typedef {Object} flockml.QuantizedMatrix.$Properties
|
|
27
|
+
* @property {Uint8Array|null} [data] QuantizedMatrix data
|
|
28
|
+
* @property {number|null} [min] QuantizedMatrix min
|
|
29
|
+
* @property {number|null} [max] QuantizedMatrix max
|
|
30
|
+
* @property {number|null} [rows] QuantizedMatrix rows
|
|
31
|
+
* @property {number|null} [cols] QuantizedMatrix cols
|
|
32
|
+
* @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding when enabled
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Properties of a QuantizedMatrix.
|
|
37
|
+
* @memberof flockml
|
|
38
|
+
* @interface IQuantizedMatrix
|
|
39
|
+
* @augments flockml.QuantizedMatrix.$Properties
|
|
40
|
+
* @deprecated Use flockml.QuantizedMatrix.$Properties instead.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Shape of a QuantizedMatrix.
|
|
45
|
+
* @typedef {flockml.QuantizedMatrix.$Properties} flockml.QuantizedMatrix.$Shape
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Constructs a new QuantizedMatrix.
|
|
50
|
+
* @memberof flockml
|
|
51
|
+
* @classdesc Represents a QuantizedMatrix.
|
|
52
|
+
* @constructor
|
|
53
|
+
* @param {flockml.QuantizedMatrix.$Properties=} [properties] Properties to set
|
|
54
|
+
* @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding when enabled
|
|
55
|
+
*/
|
|
56
|
+
var QuantizedMatrix = function (properties) {
|
|
57
|
+
if (properties)
|
|
58
|
+
for (var keys = $Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
59
|
+
if (properties[keys[i]] != null && keys[i] !== "__proto__")
|
|
60
|
+
this[keys[i]] = properties[keys[i]];
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* QuantizedMatrix data.
|
|
65
|
+
* @member {Uint8Array} data
|
|
66
|
+
* @memberof flockml.QuantizedMatrix
|
|
67
|
+
* @instance
|
|
68
|
+
*/
|
|
69
|
+
QuantizedMatrix.prototype.data = $util.newBuffer([]);
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* QuantizedMatrix min.
|
|
73
|
+
* @member {number} min
|
|
74
|
+
* @memberof flockml.QuantizedMatrix
|
|
75
|
+
* @instance
|
|
76
|
+
*/
|
|
77
|
+
QuantizedMatrix.prototype.min = 0;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* QuantizedMatrix max.
|
|
81
|
+
* @member {number} max
|
|
82
|
+
* @memberof flockml.QuantizedMatrix
|
|
83
|
+
* @instance
|
|
84
|
+
*/
|
|
85
|
+
QuantizedMatrix.prototype.max = 0;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* QuantizedMatrix rows.
|
|
89
|
+
* @member {number} rows
|
|
90
|
+
* @memberof flockml.QuantizedMatrix
|
|
91
|
+
* @instance
|
|
92
|
+
*/
|
|
93
|
+
QuantizedMatrix.prototype.rows = 0;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* QuantizedMatrix cols.
|
|
97
|
+
* @member {number} cols
|
|
98
|
+
* @memberof flockml.QuantizedMatrix
|
|
99
|
+
* @instance
|
|
100
|
+
*/
|
|
101
|
+
QuantizedMatrix.prototype.cols = 0;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Creates a new QuantizedMatrix instance using the specified properties.
|
|
105
|
+
* @function create
|
|
106
|
+
* @memberof flockml.QuantizedMatrix
|
|
107
|
+
* @static
|
|
108
|
+
* @param {flockml.QuantizedMatrix.$Properties=} [properties] Properties to set
|
|
109
|
+
* @returns {flockml.QuantizedMatrix} QuantizedMatrix instance
|
|
110
|
+
* @type {{
|
|
111
|
+
* (properties: flockml.QuantizedMatrix.$Shape): flockml.QuantizedMatrix & flockml.QuantizedMatrix.$Shape;
|
|
112
|
+
* (properties?: flockml.QuantizedMatrix.$Properties): flockml.QuantizedMatrix;
|
|
113
|
+
* }}
|
|
114
|
+
*/
|
|
115
|
+
QuantizedMatrix.create = function(properties) {
|
|
116
|
+
return new QuantizedMatrix(properties);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Encodes the specified QuantizedMatrix message. Does not implicitly {@link flockml.QuantizedMatrix.verify|verify} messages.
|
|
121
|
+
* @function encode
|
|
122
|
+
* @memberof flockml.QuantizedMatrix
|
|
123
|
+
* @static
|
|
124
|
+
* @param {flockml.QuantizedMatrix.$Properties} message QuantizedMatrix message or plain object to encode
|
|
125
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
126
|
+
* @returns {$protobuf.Writer} Writer
|
|
127
|
+
*/
|
|
128
|
+
QuantizedMatrix.encode = function (message, writer, _depth) {
|
|
129
|
+
if (!writer)
|
|
130
|
+
writer = $Writer.create();
|
|
131
|
+
if (_depth === $undefined)
|
|
132
|
+
_depth = 0;
|
|
133
|
+
if (_depth > $util.recursionLimit)
|
|
134
|
+
throw $Error("max depth exceeded");
|
|
135
|
+
if (message.data != null && $Object.hasOwnProperty.call(message, "data"))
|
|
136
|
+
writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.data);
|
|
137
|
+
if (message.min != null && $Object.hasOwnProperty.call(message, "min"))
|
|
138
|
+
writer.uint32(/* id 2, wireType 5 =*/21).float(message.min);
|
|
139
|
+
if (message.max != null && $Object.hasOwnProperty.call(message, "max"))
|
|
140
|
+
writer.uint32(/* id 3, wireType 5 =*/29).float(message.max);
|
|
141
|
+
if (message.rows != null && $Object.hasOwnProperty.call(message, "rows"))
|
|
142
|
+
writer.uint32(/* id 4, wireType 0 =*/32).int32(message.rows);
|
|
143
|
+
if (message.cols != null && $Object.hasOwnProperty.call(message, "cols"))
|
|
144
|
+
writer.uint32(/* id 5, wireType 0 =*/40).int32(message.cols);
|
|
145
|
+
if (message.$unknowns != null && $Object.hasOwnProperty.call(message, "$unknowns"))
|
|
146
|
+
for (var i = 0; i < message.$unknowns.length; ++i)
|
|
147
|
+
writer.raw(message.$unknowns[i]);
|
|
148
|
+
return writer;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Encodes the specified QuantizedMatrix message, length delimited. Does not implicitly {@link flockml.QuantizedMatrix.verify|verify} messages.
|
|
153
|
+
* @function encodeDelimited
|
|
154
|
+
* @memberof flockml.QuantizedMatrix
|
|
155
|
+
* @static
|
|
156
|
+
* @param {flockml.QuantizedMatrix.$Properties} message QuantizedMatrix message or plain object to encode
|
|
157
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
158
|
+
* @returns {$protobuf.Writer} Writer
|
|
159
|
+
*/
|
|
160
|
+
QuantizedMatrix.encodeDelimited = function(message, writer) {
|
|
161
|
+
return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Decodes a QuantizedMatrix message from the specified reader or buffer.
|
|
166
|
+
* @function decode
|
|
167
|
+
* @memberof flockml.QuantizedMatrix
|
|
168
|
+
* @static
|
|
169
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
170
|
+
* @param {number} [length] Message length if known beforehand
|
|
171
|
+
* @returns {flockml.QuantizedMatrix & flockml.QuantizedMatrix.$Shape} QuantizedMatrix
|
|
172
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
173
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
174
|
+
*/
|
|
175
|
+
QuantizedMatrix.decode = function (reader, length, _end, _depth, _target) {
|
|
176
|
+
if (!(reader instanceof $Reader))
|
|
177
|
+
reader = $Reader.create(reader);
|
|
178
|
+
if (_depth === $undefined)
|
|
179
|
+
_depth = 0;
|
|
180
|
+
if (_depth > $Reader.recursionLimit)
|
|
181
|
+
throw $Error("max depth exceeded");
|
|
182
|
+
var end = length === $undefined ? reader.len : reader.pos + length, message = _target || new $root.flockml.QuantizedMatrix(), value;
|
|
183
|
+
while (reader.pos < end) {
|
|
184
|
+
var start = reader.pos;
|
|
185
|
+
var tag = reader.tag();
|
|
186
|
+
if (tag === _end) {
|
|
187
|
+
_end = $undefined;
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
var wireType = tag & 7;
|
|
191
|
+
switch (tag >>>= 3) {
|
|
192
|
+
case 1: {
|
|
193
|
+
if (wireType !== 2)
|
|
194
|
+
break;
|
|
195
|
+
if ((value = reader.bytes()).length)
|
|
196
|
+
message.data = value;
|
|
197
|
+
else
|
|
198
|
+
delete message.data;
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
case 2: {
|
|
202
|
+
if (wireType !== 5)
|
|
203
|
+
break;
|
|
204
|
+
if ((value = reader.float()) !== 0)
|
|
205
|
+
message.min = value;
|
|
206
|
+
else
|
|
207
|
+
delete message.min;
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
case 3: {
|
|
211
|
+
if (wireType !== 5)
|
|
212
|
+
break;
|
|
213
|
+
if ((value = reader.float()) !== 0)
|
|
214
|
+
message.max = value;
|
|
215
|
+
else
|
|
216
|
+
delete message.max;
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
case 4: {
|
|
220
|
+
if (wireType !== 0)
|
|
221
|
+
break;
|
|
222
|
+
if (value = reader.int32())
|
|
223
|
+
message.rows = value;
|
|
224
|
+
else
|
|
225
|
+
delete message.rows;
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
case 5: {
|
|
229
|
+
if (wireType !== 0)
|
|
230
|
+
break;
|
|
231
|
+
if (value = reader.int32())
|
|
232
|
+
message.cols = value;
|
|
233
|
+
else
|
|
234
|
+
delete message.cols;
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
reader.skipType(wireType, _depth, tag);
|
|
239
|
+
if (!reader.discardUnknown) {
|
|
240
|
+
$util.makeProp(message, "$unknowns", false);
|
|
241
|
+
(message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos));
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
if (_end !== $undefined)
|
|
245
|
+
throw $Error("missing end group");
|
|
246
|
+
return message;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Decodes a QuantizedMatrix message from the specified reader or buffer, length delimited.
|
|
251
|
+
* @function decodeDelimited
|
|
252
|
+
* @memberof flockml.QuantizedMatrix
|
|
253
|
+
* @static
|
|
254
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
255
|
+
* @returns {flockml.QuantizedMatrix & flockml.QuantizedMatrix.$Shape} QuantizedMatrix
|
|
256
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
257
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
258
|
+
*/
|
|
259
|
+
QuantizedMatrix.decodeDelimited = function(reader) {
|
|
260
|
+
if (!(reader instanceof $Reader))
|
|
261
|
+
reader = new $Reader(reader);
|
|
262
|
+
return this.decode(reader, reader.uint32());
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Verifies a QuantizedMatrix message.
|
|
267
|
+
* @function verify
|
|
268
|
+
* @memberof flockml.QuantizedMatrix
|
|
269
|
+
* @static
|
|
270
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
271
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
272
|
+
*/
|
|
273
|
+
QuantizedMatrix.verify = function (message, _depth) {
|
|
274
|
+
if (typeof message !== "object" || message === null)
|
|
275
|
+
return "object expected";
|
|
276
|
+
if (_depth === $undefined)
|
|
277
|
+
_depth = 0;
|
|
278
|
+
if (_depth > $util.recursionLimit)
|
|
279
|
+
return "max depth exceeded";
|
|
280
|
+
if (message.data != null && $Object.hasOwnProperty.call(message, "data"))
|
|
281
|
+
if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data)))
|
|
282
|
+
return "data: buffer expected";
|
|
283
|
+
if (message.min != null && $Object.hasOwnProperty.call(message, "min"))
|
|
284
|
+
if (typeof message.min !== "number")
|
|
285
|
+
return "min: number expected";
|
|
286
|
+
if (message.max != null && $Object.hasOwnProperty.call(message, "max"))
|
|
287
|
+
if (typeof message.max !== "number")
|
|
288
|
+
return "max: number expected";
|
|
289
|
+
if (message.rows != null && $Object.hasOwnProperty.call(message, "rows"))
|
|
290
|
+
if (!$util.isInteger(message.rows))
|
|
291
|
+
return "rows: integer expected";
|
|
292
|
+
if (message.cols != null && $Object.hasOwnProperty.call(message, "cols"))
|
|
293
|
+
if (!$util.isInteger(message.cols))
|
|
294
|
+
return "cols: integer expected";
|
|
295
|
+
return null;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Creates a QuantizedMatrix message from a plain object. Also converts values to their respective internal types.
|
|
300
|
+
* @function fromObject
|
|
301
|
+
* @memberof flockml.QuantizedMatrix
|
|
302
|
+
* @static
|
|
303
|
+
* @param {Object.<string,*>} object Plain object
|
|
304
|
+
* @returns {flockml.QuantizedMatrix} QuantizedMatrix
|
|
305
|
+
*/
|
|
306
|
+
QuantizedMatrix.fromObject = function (object, _depth) {
|
|
307
|
+
if (object instanceof $root.flockml.QuantizedMatrix)
|
|
308
|
+
return object;
|
|
309
|
+
if (!$util.isObject(object))
|
|
310
|
+
throw $TypeError(".flockml.QuantizedMatrix: object expected");
|
|
311
|
+
if (_depth === $undefined)
|
|
312
|
+
_depth = 0;
|
|
313
|
+
if (_depth > $util.recursionLimit)
|
|
314
|
+
throw $Error("max depth exceeded");
|
|
315
|
+
var message = new $root.flockml.QuantizedMatrix();
|
|
316
|
+
if (object.data != null)
|
|
317
|
+
if (object.data.length)
|
|
318
|
+
if (typeof object.data === "string")
|
|
319
|
+
$util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0);
|
|
320
|
+
else if (object.data.length >= 0)
|
|
321
|
+
message.data = object.data;
|
|
322
|
+
if (object.min != null)
|
|
323
|
+
if ($Number(object.min) !== 0)
|
|
324
|
+
message.min = $Number(object.min);
|
|
325
|
+
if (object.max != null)
|
|
326
|
+
if ($Number(object.max) !== 0)
|
|
327
|
+
message.max = $Number(object.max);
|
|
328
|
+
if (object.rows != null)
|
|
329
|
+
if ($Number(object.rows) !== 0)
|
|
330
|
+
message.rows = object.rows | 0;
|
|
331
|
+
if (object.cols != null)
|
|
332
|
+
if ($Number(object.cols) !== 0)
|
|
333
|
+
message.cols = object.cols | 0;
|
|
334
|
+
return message;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Creates a plain object from a QuantizedMatrix message. Also converts values to other types if specified.
|
|
339
|
+
* @function toObject
|
|
340
|
+
* @memberof flockml.QuantizedMatrix
|
|
341
|
+
* @static
|
|
342
|
+
* @param {flockml.QuantizedMatrix} message QuantizedMatrix
|
|
343
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
344
|
+
* @returns {Object.<string,*>} Plain object
|
|
345
|
+
*/
|
|
346
|
+
QuantizedMatrix.toObject = function (message, options, _depth) {
|
|
347
|
+
if (!options)
|
|
348
|
+
options = {};
|
|
349
|
+
if (_depth === $undefined)
|
|
350
|
+
_depth = 0;
|
|
351
|
+
if (_depth > $util.recursionLimit)
|
|
352
|
+
throw $Error("max depth exceeded");
|
|
353
|
+
var object = {};
|
|
354
|
+
if (options.defaults) {
|
|
355
|
+
if (options.bytes === $String)
|
|
356
|
+
object.data = "";
|
|
357
|
+
else {
|
|
358
|
+
object.data = [];
|
|
359
|
+
if (options.bytes !== $Array)
|
|
360
|
+
object.data = $util.newBuffer(object.data);
|
|
361
|
+
}
|
|
362
|
+
object.min = 0;
|
|
363
|
+
object.max = 0;
|
|
364
|
+
object.rows = 0;
|
|
365
|
+
object.cols = 0;
|
|
366
|
+
}
|
|
367
|
+
if (message.data != null && $Object.hasOwnProperty.call(message, "data"))
|
|
368
|
+
object.data = options.bytes === $String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === $Array ? $Array.prototype.slice.call(message.data) : message.data;
|
|
369
|
+
if (message.min != null && $Object.hasOwnProperty.call(message, "min"))
|
|
370
|
+
object.min = options.json && !$isFinite(message.min) ? $String(message.min) : message.min;
|
|
371
|
+
if (message.max != null && $Object.hasOwnProperty.call(message, "max"))
|
|
372
|
+
object.max = options.json && !$isFinite(message.max) ? $String(message.max) : message.max;
|
|
373
|
+
if (message.rows != null && $Object.hasOwnProperty.call(message, "rows"))
|
|
374
|
+
object.rows = message.rows;
|
|
375
|
+
if (message.cols != null && $Object.hasOwnProperty.call(message, "cols"))
|
|
376
|
+
object.cols = message.cols;
|
|
377
|
+
return object;
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Converts this QuantizedMatrix to JSON.
|
|
382
|
+
* @function toJSON
|
|
383
|
+
* @memberof flockml.QuantizedMatrix
|
|
384
|
+
* @instance
|
|
385
|
+
* @returns {Object.<string,*>} JSON object
|
|
386
|
+
*/
|
|
387
|
+
QuantizedMatrix.prototype.toJSON = function() {
|
|
388
|
+
return QuantizedMatrix.toObject(this, $protobuf.util.toJSONOptions);
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Gets the type url for QuantizedMatrix
|
|
393
|
+
* @function getTypeUrl
|
|
394
|
+
* @memberof flockml.QuantizedMatrix
|
|
395
|
+
* @static
|
|
396
|
+
* @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"`
|
|
397
|
+
* @returns {string} The type url
|
|
398
|
+
*/
|
|
399
|
+
QuantizedMatrix.getTypeUrl = function(prefix) {
|
|
400
|
+
if (prefix === $undefined)
|
|
401
|
+
prefix = "type.googleapis.com";
|
|
402
|
+
return prefix + "/flockml.QuantizedMatrix";
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
return QuantizedMatrix;
|
|
406
|
+
})();
|
|
407
|
+
|
|
408
|
+
flockml.GradientUpdate = (function() {
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Properties of a GradientUpdate.
|
|
412
|
+
* @typedef {Object} flockml.GradientUpdate.$Properties
|
|
413
|
+
* @property {flockml.QuantizedMatrix.$Properties|null} [weightsIh] GradientUpdate weightsIh
|
|
414
|
+
* @property {flockml.QuantizedMatrix.$Properties|null} [weightsHo] GradientUpdate weightsHo
|
|
415
|
+
* @property {flockml.QuantizedMatrix.$Properties|null} [biasH] GradientUpdate biasH
|
|
416
|
+
* @property {flockml.QuantizedMatrix.$Properties|null} [biasO] GradientUpdate biasO
|
|
417
|
+
* @property {number|null} [batchSize] GradientUpdate batchSize
|
|
418
|
+
* @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding when enabled
|
|
419
|
+
*/
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Properties of a GradientUpdate.
|
|
423
|
+
* @memberof flockml
|
|
424
|
+
* @interface IGradientUpdate
|
|
425
|
+
* @augments flockml.GradientUpdate.$Properties
|
|
426
|
+
* @deprecated Use flockml.GradientUpdate.$Properties instead.
|
|
427
|
+
*/
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Shape of a GradientUpdate.
|
|
431
|
+
* @typedef {flockml.GradientUpdate.$Properties} flockml.GradientUpdate.$Shape
|
|
432
|
+
*/
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Constructs a new GradientUpdate.
|
|
436
|
+
* @memberof flockml
|
|
437
|
+
* @classdesc Represents a GradientUpdate.
|
|
438
|
+
* @constructor
|
|
439
|
+
* @param {flockml.GradientUpdate.$Properties=} [properties] Properties to set
|
|
440
|
+
* @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding when enabled
|
|
441
|
+
*/
|
|
442
|
+
var GradientUpdate = function (properties) {
|
|
443
|
+
if (properties)
|
|
444
|
+
for (var keys = $Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
445
|
+
if (properties[keys[i]] != null && keys[i] !== "__proto__")
|
|
446
|
+
this[keys[i]] = properties[keys[i]];
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* GradientUpdate weightsIh.
|
|
451
|
+
* @member {flockml.QuantizedMatrix.$Properties|null|undefined} weightsIh
|
|
452
|
+
* @memberof flockml.GradientUpdate
|
|
453
|
+
* @instance
|
|
454
|
+
*/
|
|
455
|
+
GradientUpdate.prototype.weightsIh = null;
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* GradientUpdate weightsHo.
|
|
459
|
+
* @member {flockml.QuantizedMatrix.$Properties|null|undefined} weightsHo
|
|
460
|
+
* @memberof flockml.GradientUpdate
|
|
461
|
+
* @instance
|
|
462
|
+
*/
|
|
463
|
+
GradientUpdate.prototype.weightsHo = null;
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* GradientUpdate biasH.
|
|
467
|
+
* @member {flockml.QuantizedMatrix.$Properties|null|undefined} biasH
|
|
468
|
+
* @memberof flockml.GradientUpdate
|
|
469
|
+
* @instance
|
|
470
|
+
*/
|
|
471
|
+
GradientUpdate.prototype.biasH = null;
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* GradientUpdate biasO.
|
|
475
|
+
* @member {flockml.QuantizedMatrix.$Properties|null|undefined} biasO
|
|
476
|
+
* @memberof flockml.GradientUpdate
|
|
477
|
+
* @instance
|
|
478
|
+
*/
|
|
479
|
+
GradientUpdate.prototype.biasO = null;
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* GradientUpdate batchSize.
|
|
483
|
+
* @member {number} batchSize
|
|
484
|
+
* @memberof flockml.GradientUpdate
|
|
485
|
+
* @instance
|
|
486
|
+
*/
|
|
487
|
+
GradientUpdate.prototype.batchSize = 0;
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Creates a new GradientUpdate instance using the specified properties.
|
|
491
|
+
* @function create
|
|
492
|
+
* @memberof flockml.GradientUpdate
|
|
493
|
+
* @static
|
|
494
|
+
* @param {flockml.GradientUpdate.$Properties=} [properties] Properties to set
|
|
495
|
+
* @returns {flockml.GradientUpdate} GradientUpdate instance
|
|
496
|
+
* @type {{
|
|
497
|
+
* (properties: flockml.GradientUpdate.$Shape): flockml.GradientUpdate & flockml.GradientUpdate.$Shape;
|
|
498
|
+
* (properties?: flockml.GradientUpdate.$Properties): flockml.GradientUpdate;
|
|
499
|
+
* }}
|
|
500
|
+
*/
|
|
501
|
+
GradientUpdate.create = function(properties) {
|
|
502
|
+
return new GradientUpdate(properties);
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Encodes the specified GradientUpdate message. Does not implicitly {@link flockml.GradientUpdate.verify|verify} messages.
|
|
507
|
+
* @function encode
|
|
508
|
+
* @memberof flockml.GradientUpdate
|
|
509
|
+
* @static
|
|
510
|
+
* @param {flockml.GradientUpdate.$Properties} message GradientUpdate message or plain object to encode
|
|
511
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
512
|
+
* @returns {$protobuf.Writer} Writer
|
|
513
|
+
*/
|
|
514
|
+
GradientUpdate.encode = function (message, writer, _depth) {
|
|
515
|
+
if (!writer)
|
|
516
|
+
writer = $Writer.create();
|
|
517
|
+
if (_depth === $undefined)
|
|
518
|
+
_depth = 0;
|
|
519
|
+
if (_depth > $util.recursionLimit)
|
|
520
|
+
throw $Error("max depth exceeded");
|
|
521
|
+
if (message.weightsIh != null && $Object.hasOwnProperty.call(message, "weightsIh"))
|
|
522
|
+
$root.flockml.QuantizedMatrix.encode(message.weightsIh, writer.uint32(/* id 1, wireType 2 =*/10).fork(), _depth + 1).ldelim();
|
|
523
|
+
if (message.weightsHo != null && $Object.hasOwnProperty.call(message, "weightsHo"))
|
|
524
|
+
$root.flockml.QuantizedMatrix.encode(message.weightsHo, writer.uint32(/* id 2, wireType 2 =*/18).fork(), _depth + 1).ldelim();
|
|
525
|
+
if (message.biasH != null && $Object.hasOwnProperty.call(message, "biasH"))
|
|
526
|
+
$root.flockml.QuantizedMatrix.encode(message.biasH, writer.uint32(/* id 3, wireType 2 =*/26).fork(), _depth + 1).ldelim();
|
|
527
|
+
if (message.biasO != null && $Object.hasOwnProperty.call(message, "biasO"))
|
|
528
|
+
$root.flockml.QuantizedMatrix.encode(message.biasO, writer.uint32(/* id 4, wireType 2 =*/34).fork(), _depth + 1).ldelim();
|
|
529
|
+
if (message.batchSize != null && $Object.hasOwnProperty.call(message, "batchSize"))
|
|
530
|
+
writer.uint32(/* id 5, wireType 0 =*/40).int32(message.batchSize);
|
|
531
|
+
if (message.$unknowns != null && $Object.hasOwnProperty.call(message, "$unknowns"))
|
|
532
|
+
for (var i = 0; i < message.$unknowns.length; ++i)
|
|
533
|
+
writer.raw(message.$unknowns[i]);
|
|
534
|
+
return writer;
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Encodes the specified GradientUpdate message, length delimited. Does not implicitly {@link flockml.GradientUpdate.verify|verify} messages.
|
|
539
|
+
* @function encodeDelimited
|
|
540
|
+
* @memberof flockml.GradientUpdate
|
|
541
|
+
* @static
|
|
542
|
+
* @param {flockml.GradientUpdate.$Properties} message GradientUpdate message or plain object to encode
|
|
543
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
544
|
+
* @returns {$protobuf.Writer} Writer
|
|
545
|
+
*/
|
|
546
|
+
GradientUpdate.encodeDelimited = function(message, writer) {
|
|
547
|
+
return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Decodes a GradientUpdate message from the specified reader or buffer.
|
|
552
|
+
* @function decode
|
|
553
|
+
* @memberof flockml.GradientUpdate
|
|
554
|
+
* @static
|
|
555
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
556
|
+
* @param {number} [length] Message length if known beforehand
|
|
557
|
+
* @returns {flockml.GradientUpdate & flockml.GradientUpdate.$Shape} GradientUpdate
|
|
558
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
559
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
560
|
+
*/
|
|
561
|
+
GradientUpdate.decode = function (reader, length, _end, _depth, _target) {
|
|
562
|
+
if (!(reader instanceof $Reader))
|
|
563
|
+
reader = $Reader.create(reader);
|
|
564
|
+
if (_depth === $undefined)
|
|
565
|
+
_depth = 0;
|
|
566
|
+
if (_depth > $Reader.recursionLimit)
|
|
567
|
+
throw $Error("max depth exceeded");
|
|
568
|
+
var end = length === $undefined ? reader.len : reader.pos + length, message = _target || new $root.flockml.GradientUpdate(), value;
|
|
569
|
+
while (reader.pos < end) {
|
|
570
|
+
var start = reader.pos;
|
|
571
|
+
var tag = reader.tag();
|
|
572
|
+
if (tag === _end) {
|
|
573
|
+
_end = $undefined;
|
|
574
|
+
break;
|
|
575
|
+
}
|
|
576
|
+
var wireType = tag & 7;
|
|
577
|
+
switch (tag >>>= 3) {
|
|
578
|
+
case 1: {
|
|
579
|
+
if (wireType !== 2)
|
|
580
|
+
break;
|
|
581
|
+
message.weightsIh = $root.flockml.QuantizedMatrix.decode(reader, reader.uint32(), $undefined, _depth + 1, message.weightsIh);
|
|
582
|
+
continue;
|
|
583
|
+
}
|
|
584
|
+
case 2: {
|
|
585
|
+
if (wireType !== 2)
|
|
586
|
+
break;
|
|
587
|
+
message.weightsHo = $root.flockml.QuantizedMatrix.decode(reader, reader.uint32(), $undefined, _depth + 1, message.weightsHo);
|
|
588
|
+
continue;
|
|
589
|
+
}
|
|
590
|
+
case 3: {
|
|
591
|
+
if (wireType !== 2)
|
|
592
|
+
break;
|
|
593
|
+
message.biasH = $root.flockml.QuantizedMatrix.decode(reader, reader.uint32(), $undefined, _depth + 1, message.biasH);
|
|
594
|
+
continue;
|
|
595
|
+
}
|
|
596
|
+
case 4: {
|
|
597
|
+
if (wireType !== 2)
|
|
598
|
+
break;
|
|
599
|
+
message.biasO = $root.flockml.QuantizedMatrix.decode(reader, reader.uint32(), $undefined, _depth + 1, message.biasO);
|
|
600
|
+
continue;
|
|
601
|
+
}
|
|
602
|
+
case 5: {
|
|
603
|
+
if (wireType !== 0)
|
|
604
|
+
break;
|
|
605
|
+
if (value = reader.int32())
|
|
606
|
+
message.batchSize = value;
|
|
607
|
+
else
|
|
608
|
+
delete message.batchSize;
|
|
609
|
+
continue;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
reader.skipType(wireType, _depth, tag);
|
|
613
|
+
if (!reader.discardUnknown) {
|
|
614
|
+
$util.makeProp(message, "$unknowns", false);
|
|
615
|
+
(message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos));
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
if (_end !== $undefined)
|
|
619
|
+
throw $Error("missing end group");
|
|
620
|
+
return message;
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Decodes a GradientUpdate message from the specified reader or buffer, length delimited.
|
|
625
|
+
* @function decodeDelimited
|
|
626
|
+
* @memberof flockml.GradientUpdate
|
|
627
|
+
* @static
|
|
628
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
629
|
+
* @returns {flockml.GradientUpdate & flockml.GradientUpdate.$Shape} GradientUpdate
|
|
630
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
631
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
632
|
+
*/
|
|
633
|
+
GradientUpdate.decodeDelimited = function(reader) {
|
|
634
|
+
if (!(reader instanceof $Reader))
|
|
635
|
+
reader = new $Reader(reader);
|
|
636
|
+
return this.decode(reader, reader.uint32());
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* Verifies a GradientUpdate message.
|
|
641
|
+
* @function verify
|
|
642
|
+
* @memberof flockml.GradientUpdate
|
|
643
|
+
* @static
|
|
644
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
645
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
646
|
+
*/
|
|
647
|
+
GradientUpdate.verify = function (message, _depth) {
|
|
648
|
+
if (typeof message !== "object" || message === null)
|
|
649
|
+
return "object expected";
|
|
650
|
+
if (_depth === $undefined)
|
|
651
|
+
_depth = 0;
|
|
652
|
+
if (_depth > $util.recursionLimit)
|
|
653
|
+
return "max depth exceeded";
|
|
654
|
+
if (message.weightsIh != null && $Object.hasOwnProperty.call(message, "weightsIh")) {
|
|
655
|
+
var error = $root.flockml.QuantizedMatrix.verify(message.weightsIh, _depth + 1);
|
|
656
|
+
if (error)
|
|
657
|
+
return "weightsIh." + error;
|
|
658
|
+
}
|
|
659
|
+
if (message.weightsHo != null && $Object.hasOwnProperty.call(message, "weightsHo")) {
|
|
660
|
+
var error = $root.flockml.QuantizedMatrix.verify(message.weightsHo, _depth + 1);
|
|
661
|
+
if (error)
|
|
662
|
+
return "weightsHo." + error;
|
|
663
|
+
}
|
|
664
|
+
if (message.biasH != null && $Object.hasOwnProperty.call(message, "biasH")) {
|
|
665
|
+
var error = $root.flockml.QuantizedMatrix.verify(message.biasH, _depth + 1);
|
|
666
|
+
if (error)
|
|
667
|
+
return "biasH." + error;
|
|
668
|
+
}
|
|
669
|
+
if (message.biasO != null && $Object.hasOwnProperty.call(message, "biasO")) {
|
|
670
|
+
var error = $root.flockml.QuantizedMatrix.verify(message.biasO, _depth + 1);
|
|
671
|
+
if (error)
|
|
672
|
+
return "biasO." + error;
|
|
673
|
+
}
|
|
674
|
+
if (message.batchSize != null && $Object.hasOwnProperty.call(message, "batchSize"))
|
|
675
|
+
if (!$util.isInteger(message.batchSize))
|
|
676
|
+
return "batchSize: integer expected";
|
|
677
|
+
return null;
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* Creates a GradientUpdate message from a plain object. Also converts values to their respective internal types.
|
|
682
|
+
* @function fromObject
|
|
683
|
+
* @memberof flockml.GradientUpdate
|
|
684
|
+
* @static
|
|
685
|
+
* @param {Object.<string,*>} object Plain object
|
|
686
|
+
* @returns {flockml.GradientUpdate} GradientUpdate
|
|
687
|
+
*/
|
|
688
|
+
GradientUpdate.fromObject = function (object, _depth) {
|
|
689
|
+
if (object instanceof $root.flockml.GradientUpdate)
|
|
690
|
+
return object;
|
|
691
|
+
if (!$util.isObject(object))
|
|
692
|
+
throw $TypeError(".flockml.GradientUpdate: object expected");
|
|
693
|
+
if (_depth === $undefined)
|
|
694
|
+
_depth = 0;
|
|
695
|
+
if (_depth > $util.recursionLimit)
|
|
696
|
+
throw $Error("max depth exceeded");
|
|
697
|
+
var message = new $root.flockml.GradientUpdate();
|
|
698
|
+
if (object.weightsIh != null) {
|
|
699
|
+
if (!$util.isObject(object.weightsIh))
|
|
700
|
+
throw $TypeError(".flockml.GradientUpdate.weightsIh: object expected");
|
|
701
|
+
message.weightsIh = $root.flockml.QuantizedMatrix.fromObject(object.weightsIh, _depth + 1);
|
|
702
|
+
}
|
|
703
|
+
if (object.weightsHo != null) {
|
|
704
|
+
if (!$util.isObject(object.weightsHo))
|
|
705
|
+
throw $TypeError(".flockml.GradientUpdate.weightsHo: object expected");
|
|
706
|
+
message.weightsHo = $root.flockml.QuantizedMatrix.fromObject(object.weightsHo, _depth + 1);
|
|
707
|
+
}
|
|
708
|
+
if (object.biasH != null) {
|
|
709
|
+
if (!$util.isObject(object.biasH))
|
|
710
|
+
throw $TypeError(".flockml.GradientUpdate.biasH: object expected");
|
|
711
|
+
message.biasH = $root.flockml.QuantizedMatrix.fromObject(object.biasH, _depth + 1);
|
|
712
|
+
}
|
|
713
|
+
if (object.biasO != null) {
|
|
714
|
+
if (!$util.isObject(object.biasO))
|
|
715
|
+
throw $TypeError(".flockml.GradientUpdate.biasO: object expected");
|
|
716
|
+
message.biasO = $root.flockml.QuantizedMatrix.fromObject(object.biasO, _depth + 1);
|
|
717
|
+
}
|
|
718
|
+
if (object.batchSize != null)
|
|
719
|
+
if ($Number(object.batchSize) !== 0)
|
|
720
|
+
message.batchSize = object.batchSize | 0;
|
|
721
|
+
return message;
|
|
722
|
+
};
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* Creates a plain object from a GradientUpdate message. Also converts values to other types if specified.
|
|
726
|
+
* @function toObject
|
|
727
|
+
* @memberof flockml.GradientUpdate
|
|
728
|
+
* @static
|
|
729
|
+
* @param {flockml.GradientUpdate} message GradientUpdate
|
|
730
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
731
|
+
* @returns {Object.<string,*>} Plain object
|
|
732
|
+
*/
|
|
733
|
+
GradientUpdate.toObject = function (message, options, _depth) {
|
|
734
|
+
if (!options)
|
|
735
|
+
options = {};
|
|
736
|
+
if (_depth === $undefined)
|
|
737
|
+
_depth = 0;
|
|
738
|
+
if (_depth > $util.recursionLimit)
|
|
739
|
+
throw $Error("max depth exceeded");
|
|
740
|
+
var object = {};
|
|
741
|
+
if (options.defaults) {
|
|
742
|
+
object.weightsIh = null;
|
|
743
|
+
object.weightsHo = null;
|
|
744
|
+
object.biasH = null;
|
|
745
|
+
object.biasO = null;
|
|
746
|
+
object.batchSize = 0;
|
|
747
|
+
}
|
|
748
|
+
if (message.weightsIh != null && $Object.hasOwnProperty.call(message, "weightsIh"))
|
|
749
|
+
object.weightsIh = $root.flockml.QuantizedMatrix.toObject(message.weightsIh, options, _depth + 1);
|
|
750
|
+
if (message.weightsHo != null && $Object.hasOwnProperty.call(message, "weightsHo"))
|
|
751
|
+
object.weightsHo = $root.flockml.QuantizedMatrix.toObject(message.weightsHo, options, _depth + 1);
|
|
752
|
+
if (message.biasH != null && $Object.hasOwnProperty.call(message, "biasH"))
|
|
753
|
+
object.biasH = $root.flockml.QuantizedMatrix.toObject(message.biasH, options, _depth + 1);
|
|
754
|
+
if (message.biasO != null && $Object.hasOwnProperty.call(message, "biasO"))
|
|
755
|
+
object.biasO = $root.flockml.QuantizedMatrix.toObject(message.biasO, options, _depth + 1);
|
|
756
|
+
if (message.batchSize != null && $Object.hasOwnProperty.call(message, "batchSize"))
|
|
757
|
+
object.batchSize = message.batchSize;
|
|
758
|
+
return object;
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* Converts this GradientUpdate to JSON.
|
|
763
|
+
* @function toJSON
|
|
764
|
+
* @memberof flockml.GradientUpdate
|
|
765
|
+
* @instance
|
|
766
|
+
* @returns {Object.<string,*>} JSON object
|
|
767
|
+
*/
|
|
768
|
+
GradientUpdate.prototype.toJSON = function() {
|
|
769
|
+
return GradientUpdate.toObject(this, $protobuf.util.toJSONOptions);
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Gets the type url for GradientUpdate
|
|
774
|
+
* @function getTypeUrl
|
|
775
|
+
* @memberof flockml.GradientUpdate
|
|
776
|
+
* @static
|
|
777
|
+
* @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"`
|
|
778
|
+
* @returns {string} The type url
|
|
779
|
+
*/
|
|
780
|
+
GradientUpdate.getTypeUrl = function(prefix) {
|
|
781
|
+
if (prefix === $undefined)
|
|
782
|
+
prefix = "type.googleapis.com";
|
|
783
|
+
return prefix + "/flockml.GradientUpdate";
|
|
784
|
+
};
|
|
785
|
+
|
|
786
|
+
return GradientUpdate;
|
|
787
|
+
})();
|
|
788
|
+
|
|
789
|
+
flockml.GlobalModel = (function() {
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* Properties of a GlobalModel.
|
|
793
|
+
* @typedef {Object} flockml.GlobalModel.$Properties
|
|
794
|
+
* @property {flockml.QuantizedMatrix.$Properties|null} [weightsIh] GlobalModel weightsIh
|
|
795
|
+
* @property {flockml.QuantizedMatrix.$Properties|null} [weightsHo] GlobalModel weightsHo
|
|
796
|
+
* @property {flockml.QuantizedMatrix.$Properties|null} [biasH] GlobalModel biasH
|
|
797
|
+
* @property {flockml.QuantizedMatrix.$Properties|null} [biasO] GlobalModel biasO
|
|
798
|
+
* @property {number|null} [version] GlobalModel version
|
|
799
|
+
* @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding when enabled
|
|
800
|
+
*/
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Properties of a GlobalModel.
|
|
804
|
+
* @memberof flockml
|
|
805
|
+
* @interface IGlobalModel
|
|
806
|
+
* @augments flockml.GlobalModel.$Properties
|
|
807
|
+
* @deprecated Use flockml.GlobalModel.$Properties instead.
|
|
808
|
+
*/
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Shape of a GlobalModel.
|
|
812
|
+
* @typedef {flockml.GlobalModel.$Properties} flockml.GlobalModel.$Shape
|
|
813
|
+
*/
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Constructs a new GlobalModel.
|
|
817
|
+
* @memberof flockml
|
|
818
|
+
* @classdesc Represents a GlobalModel.
|
|
819
|
+
* @constructor
|
|
820
|
+
* @param {flockml.GlobalModel.$Properties=} [properties] Properties to set
|
|
821
|
+
* @property {Array.<Uint8Array>} [$unknowns] Unknown fields preserved while decoding when enabled
|
|
822
|
+
*/
|
|
823
|
+
var GlobalModel = function (properties) {
|
|
824
|
+
if (properties)
|
|
825
|
+
for (var keys = $Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
826
|
+
if (properties[keys[i]] != null && keys[i] !== "__proto__")
|
|
827
|
+
this[keys[i]] = properties[keys[i]];
|
|
828
|
+
};
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* GlobalModel weightsIh.
|
|
832
|
+
* @member {flockml.QuantizedMatrix.$Properties|null|undefined} weightsIh
|
|
833
|
+
* @memberof flockml.GlobalModel
|
|
834
|
+
* @instance
|
|
835
|
+
*/
|
|
836
|
+
GlobalModel.prototype.weightsIh = null;
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* GlobalModel weightsHo.
|
|
840
|
+
* @member {flockml.QuantizedMatrix.$Properties|null|undefined} weightsHo
|
|
841
|
+
* @memberof flockml.GlobalModel
|
|
842
|
+
* @instance
|
|
843
|
+
*/
|
|
844
|
+
GlobalModel.prototype.weightsHo = null;
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* GlobalModel biasH.
|
|
848
|
+
* @member {flockml.QuantizedMatrix.$Properties|null|undefined} biasH
|
|
849
|
+
* @memberof flockml.GlobalModel
|
|
850
|
+
* @instance
|
|
851
|
+
*/
|
|
852
|
+
GlobalModel.prototype.biasH = null;
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* GlobalModel biasO.
|
|
856
|
+
* @member {flockml.QuantizedMatrix.$Properties|null|undefined} biasO
|
|
857
|
+
* @memberof flockml.GlobalModel
|
|
858
|
+
* @instance
|
|
859
|
+
*/
|
|
860
|
+
GlobalModel.prototype.biasO = null;
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* GlobalModel version.
|
|
864
|
+
* @member {number} version
|
|
865
|
+
* @memberof flockml.GlobalModel
|
|
866
|
+
* @instance
|
|
867
|
+
*/
|
|
868
|
+
GlobalModel.prototype.version = 0;
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* Creates a new GlobalModel instance using the specified properties.
|
|
872
|
+
* @function create
|
|
873
|
+
* @memberof flockml.GlobalModel
|
|
874
|
+
* @static
|
|
875
|
+
* @param {flockml.GlobalModel.$Properties=} [properties] Properties to set
|
|
876
|
+
* @returns {flockml.GlobalModel} GlobalModel instance
|
|
877
|
+
* @type {{
|
|
878
|
+
* (properties: flockml.GlobalModel.$Shape): flockml.GlobalModel & flockml.GlobalModel.$Shape;
|
|
879
|
+
* (properties?: flockml.GlobalModel.$Properties): flockml.GlobalModel;
|
|
880
|
+
* }}
|
|
881
|
+
*/
|
|
882
|
+
GlobalModel.create = function(properties) {
|
|
883
|
+
return new GlobalModel(properties);
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* Encodes the specified GlobalModel message. Does not implicitly {@link flockml.GlobalModel.verify|verify} messages.
|
|
888
|
+
* @function encode
|
|
889
|
+
* @memberof flockml.GlobalModel
|
|
890
|
+
* @static
|
|
891
|
+
* @param {flockml.GlobalModel.$Properties} message GlobalModel message or plain object to encode
|
|
892
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
893
|
+
* @returns {$protobuf.Writer} Writer
|
|
894
|
+
*/
|
|
895
|
+
GlobalModel.encode = function (message, writer, _depth) {
|
|
896
|
+
if (!writer)
|
|
897
|
+
writer = $Writer.create();
|
|
898
|
+
if (_depth === $undefined)
|
|
899
|
+
_depth = 0;
|
|
900
|
+
if (_depth > $util.recursionLimit)
|
|
901
|
+
throw $Error("max depth exceeded");
|
|
902
|
+
if (message.weightsIh != null && $Object.hasOwnProperty.call(message, "weightsIh"))
|
|
903
|
+
$root.flockml.QuantizedMatrix.encode(message.weightsIh, writer.uint32(/* id 1, wireType 2 =*/10).fork(), _depth + 1).ldelim();
|
|
904
|
+
if (message.weightsHo != null && $Object.hasOwnProperty.call(message, "weightsHo"))
|
|
905
|
+
$root.flockml.QuantizedMatrix.encode(message.weightsHo, writer.uint32(/* id 2, wireType 2 =*/18).fork(), _depth + 1).ldelim();
|
|
906
|
+
if (message.biasH != null && $Object.hasOwnProperty.call(message, "biasH"))
|
|
907
|
+
$root.flockml.QuantizedMatrix.encode(message.biasH, writer.uint32(/* id 3, wireType 2 =*/26).fork(), _depth + 1).ldelim();
|
|
908
|
+
if (message.biasO != null && $Object.hasOwnProperty.call(message, "biasO"))
|
|
909
|
+
$root.flockml.QuantizedMatrix.encode(message.biasO, writer.uint32(/* id 4, wireType 2 =*/34).fork(), _depth + 1).ldelim();
|
|
910
|
+
if (message.version != null && $Object.hasOwnProperty.call(message, "version"))
|
|
911
|
+
writer.uint32(/* id 5, wireType 0 =*/40).int32(message.version);
|
|
912
|
+
if (message.$unknowns != null && $Object.hasOwnProperty.call(message, "$unknowns"))
|
|
913
|
+
for (var i = 0; i < message.$unknowns.length; ++i)
|
|
914
|
+
writer.raw(message.$unknowns[i]);
|
|
915
|
+
return writer;
|
|
916
|
+
};
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Encodes the specified GlobalModel message, length delimited. Does not implicitly {@link flockml.GlobalModel.verify|verify} messages.
|
|
920
|
+
* @function encodeDelimited
|
|
921
|
+
* @memberof flockml.GlobalModel
|
|
922
|
+
* @static
|
|
923
|
+
* @param {flockml.GlobalModel.$Properties} message GlobalModel message or plain object to encode
|
|
924
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
925
|
+
* @returns {$protobuf.Writer} Writer
|
|
926
|
+
*/
|
|
927
|
+
GlobalModel.encodeDelimited = function(message, writer) {
|
|
928
|
+
return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();
|
|
929
|
+
};
|
|
930
|
+
|
|
931
|
+
/**
|
|
932
|
+
* Decodes a GlobalModel message from the specified reader or buffer.
|
|
933
|
+
* @function decode
|
|
934
|
+
* @memberof flockml.GlobalModel
|
|
935
|
+
* @static
|
|
936
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
937
|
+
* @param {number} [length] Message length if known beforehand
|
|
938
|
+
* @returns {flockml.GlobalModel & flockml.GlobalModel.$Shape} GlobalModel
|
|
939
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
940
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
941
|
+
*/
|
|
942
|
+
GlobalModel.decode = function (reader, length, _end, _depth, _target) {
|
|
943
|
+
if (!(reader instanceof $Reader))
|
|
944
|
+
reader = $Reader.create(reader);
|
|
945
|
+
if (_depth === $undefined)
|
|
946
|
+
_depth = 0;
|
|
947
|
+
if (_depth > $Reader.recursionLimit)
|
|
948
|
+
throw $Error("max depth exceeded");
|
|
949
|
+
var end = length === $undefined ? reader.len : reader.pos + length, message = _target || new $root.flockml.GlobalModel(), value;
|
|
950
|
+
while (reader.pos < end) {
|
|
951
|
+
var start = reader.pos;
|
|
952
|
+
var tag = reader.tag();
|
|
953
|
+
if (tag === _end) {
|
|
954
|
+
_end = $undefined;
|
|
955
|
+
break;
|
|
956
|
+
}
|
|
957
|
+
var wireType = tag & 7;
|
|
958
|
+
switch (tag >>>= 3) {
|
|
959
|
+
case 1: {
|
|
960
|
+
if (wireType !== 2)
|
|
961
|
+
break;
|
|
962
|
+
message.weightsIh = $root.flockml.QuantizedMatrix.decode(reader, reader.uint32(), $undefined, _depth + 1, message.weightsIh);
|
|
963
|
+
continue;
|
|
964
|
+
}
|
|
965
|
+
case 2: {
|
|
966
|
+
if (wireType !== 2)
|
|
967
|
+
break;
|
|
968
|
+
message.weightsHo = $root.flockml.QuantizedMatrix.decode(reader, reader.uint32(), $undefined, _depth + 1, message.weightsHo);
|
|
969
|
+
continue;
|
|
970
|
+
}
|
|
971
|
+
case 3: {
|
|
972
|
+
if (wireType !== 2)
|
|
973
|
+
break;
|
|
974
|
+
message.biasH = $root.flockml.QuantizedMatrix.decode(reader, reader.uint32(), $undefined, _depth + 1, message.biasH);
|
|
975
|
+
continue;
|
|
976
|
+
}
|
|
977
|
+
case 4: {
|
|
978
|
+
if (wireType !== 2)
|
|
979
|
+
break;
|
|
980
|
+
message.biasO = $root.flockml.QuantizedMatrix.decode(reader, reader.uint32(), $undefined, _depth + 1, message.biasO);
|
|
981
|
+
continue;
|
|
982
|
+
}
|
|
983
|
+
case 5: {
|
|
984
|
+
if (wireType !== 0)
|
|
985
|
+
break;
|
|
986
|
+
if (value = reader.int32())
|
|
987
|
+
message.version = value;
|
|
988
|
+
else
|
|
989
|
+
delete message.version;
|
|
990
|
+
continue;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
reader.skipType(wireType, _depth, tag);
|
|
994
|
+
if (!reader.discardUnknown) {
|
|
995
|
+
$util.makeProp(message, "$unknowns", false);
|
|
996
|
+
(message.$unknowns || (message.$unknowns = [])).push(reader.raw(start, reader.pos));
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
if (_end !== $undefined)
|
|
1000
|
+
throw $Error("missing end group");
|
|
1001
|
+
return message;
|
|
1002
|
+
};
|
|
1003
|
+
|
|
1004
|
+
/**
|
|
1005
|
+
* Decodes a GlobalModel message from the specified reader or buffer, length delimited.
|
|
1006
|
+
* @function decodeDelimited
|
|
1007
|
+
* @memberof flockml.GlobalModel
|
|
1008
|
+
* @static
|
|
1009
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
1010
|
+
* @returns {flockml.GlobalModel & flockml.GlobalModel.$Shape} GlobalModel
|
|
1011
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
1012
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
1013
|
+
*/
|
|
1014
|
+
GlobalModel.decodeDelimited = function(reader) {
|
|
1015
|
+
if (!(reader instanceof $Reader))
|
|
1016
|
+
reader = new $Reader(reader);
|
|
1017
|
+
return this.decode(reader, reader.uint32());
|
|
1018
|
+
};
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Verifies a GlobalModel message.
|
|
1022
|
+
* @function verify
|
|
1023
|
+
* @memberof flockml.GlobalModel
|
|
1024
|
+
* @static
|
|
1025
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
1026
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
1027
|
+
*/
|
|
1028
|
+
GlobalModel.verify = function (message, _depth) {
|
|
1029
|
+
if (typeof message !== "object" || message === null)
|
|
1030
|
+
return "object expected";
|
|
1031
|
+
if (_depth === $undefined)
|
|
1032
|
+
_depth = 0;
|
|
1033
|
+
if (_depth > $util.recursionLimit)
|
|
1034
|
+
return "max depth exceeded";
|
|
1035
|
+
if (message.weightsIh != null && $Object.hasOwnProperty.call(message, "weightsIh")) {
|
|
1036
|
+
var error = $root.flockml.QuantizedMatrix.verify(message.weightsIh, _depth + 1);
|
|
1037
|
+
if (error)
|
|
1038
|
+
return "weightsIh." + error;
|
|
1039
|
+
}
|
|
1040
|
+
if (message.weightsHo != null && $Object.hasOwnProperty.call(message, "weightsHo")) {
|
|
1041
|
+
var error = $root.flockml.QuantizedMatrix.verify(message.weightsHo, _depth + 1);
|
|
1042
|
+
if (error)
|
|
1043
|
+
return "weightsHo." + error;
|
|
1044
|
+
}
|
|
1045
|
+
if (message.biasH != null && $Object.hasOwnProperty.call(message, "biasH")) {
|
|
1046
|
+
var error = $root.flockml.QuantizedMatrix.verify(message.biasH, _depth + 1);
|
|
1047
|
+
if (error)
|
|
1048
|
+
return "biasH." + error;
|
|
1049
|
+
}
|
|
1050
|
+
if (message.biasO != null && $Object.hasOwnProperty.call(message, "biasO")) {
|
|
1051
|
+
var error = $root.flockml.QuantizedMatrix.verify(message.biasO, _depth + 1);
|
|
1052
|
+
if (error)
|
|
1053
|
+
return "biasO." + error;
|
|
1054
|
+
}
|
|
1055
|
+
if (message.version != null && $Object.hasOwnProperty.call(message, "version"))
|
|
1056
|
+
if (!$util.isInteger(message.version))
|
|
1057
|
+
return "version: integer expected";
|
|
1058
|
+
return null;
|
|
1059
|
+
};
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
* Creates a GlobalModel message from a plain object. Also converts values to their respective internal types.
|
|
1063
|
+
* @function fromObject
|
|
1064
|
+
* @memberof flockml.GlobalModel
|
|
1065
|
+
* @static
|
|
1066
|
+
* @param {Object.<string,*>} object Plain object
|
|
1067
|
+
* @returns {flockml.GlobalModel} GlobalModel
|
|
1068
|
+
*/
|
|
1069
|
+
GlobalModel.fromObject = function (object, _depth) {
|
|
1070
|
+
if (object instanceof $root.flockml.GlobalModel)
|
|
1071
|
+
return object;
|
|
1072
|
+
if (!$util.isObject(object))
|
|
1073
|
+
throw $TypeError(".flockml.GlobalModel: object expected");
|
|
1074
|
+
if (_depth === $undefined)
|
|
1075
|
+
_depth = 0;
|
|
1076
|
+
if (_depth > $util.recursionLimit)
|
|
1077
|
+
throw $Error("max depth exceeded");
|
|
1078
|
+
var message = new $root.flockml.GlobalModel();
|
|
1079
|
+
if (object.weightsIh != null) {
|
|
1080
|
+
if (!$util.isObject(object.weightsIh))
|
|
1081
|
+
throw $TypeError(".flockml.GlobalModel.weightsIh: object expected");
|
|
1082
|
+
message.weightsIh = $root.flockml.QuantizedMatrix.fromObject(object.weightsIh, _depth + 1);
|
|
1083
|
+
}
|
|
1084
|
+
if (object.weightsHo != null) {
|
|
1085
|
+
if (!$util.isObject(object.weightsHo))
|
|
1086
|
+
throw $TypeError(".flockml.GlobalModel.weightsHo: object expected");
|
|
1087
|
+
message.weightsHo = $root.flockml.QuantizedMatrix.fromObject(object.weightsHo, _depth + 1);
|
|
1088
|
+
}
|
|
1089
|
+
if (object.biasH != null) {
|
|
1090
|
+
if (!$util.isObject(object.biasH))
|
|
1091
|
+
throw $TypeError(".flockml.GlobalModel.biasH: object expected");
|
|
1092
|
+
message.biasH = $root.flockml.QuantizedMatrix.fromObject(object.biasH, _depth + 1);
|
|
1093
|
+
}
|
|
1094
|
+
if (object.biasO != null) {
|
|
1095
|
+
if (!$util.isObject(object.biasO))
|
|
1096
|
+
throw $TypeError(".flockml.GlobalModel.biasO: object expected");
|
|
1097
|
+
message.biasO = $root.flockml.QuantizedMatrix.fromObject(object.biasO, _depth + 1);
|
|
1098
|
+
}
|
|
1099
|
+
if (object.version != null)
|
|
1100
|
+
if ($Number(object.version) !== 0)
|
|
1101
|
+
message.version = object.version | 0;
|
|
1102
|
+
return message;
|
|
1103
|
+
};
|
|
1104
|
+
|
|
1105
|
+
/**
|
|
1106
|
+
* Creates a plain object from a GlobalModel message. Also converts values to other types if specified.
|
|
1107
|
+
* @function toObject
|
|
1108
|
+
* @memberof flockml.GlobalModel
|
|
1109
|
+
* @static
|
|
1110
|
+
* @param {flockml.GlobalModel} message GlobalModel
|
|
1111
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
1112
|
+
* @returns {Object.<string,*>} Plain object
|
|
1113
|
+
*/
|
|
1114
|
+
GlobalModel.toObject = function (message, options, _depth) {
|
|
1115
|
+
if (!options)
|
|
1116
|
+
options = {};
|
|
1117
|
+
if (_depth === $undefined)
|
|
1118
|
+
_depth = 0;
|
|
1119
|
+
if (_depth > $util.recursionLimit)
|
|
1120
|
+
throw $Error("max depth exceeded");
|
|
1121
|
+
var object = {};
|
|
1122
|
+
if (options.defaults) {
|
|
1123
|
+
object.weightsIh = null;
|
|
1124
|
+
object.weightsHo = null;
|
|
1125
|
+
object.biasH = null;
|
|
1126
|
+
object.biasO = null;
|
|
1127
|
+
object.version = 0;
|
|
1128
|
+
}
|
|
1129
|
+
if (message.weightsIh != null && $Object.hasOwnProperty.call(message, "weightsIh"))
|
|
1130
|
+
object.weightsIh = $root.flockml.QuantizedMatrix.toObject(message.weightsIh, options, _depth + 1);
|
|
1131
|
+
if (message.weightsHo != null && $Object.hasOwnProperty.call(message, "weightsHo"))
|
|
1132
|
+
object.weightsHo = $root.flockml.QuantizedMatrix.toObject(message.weightsHo, options, _depth + 1);
|
|
1133
|
+
if (message.biasH != null && $Object.hasOwnProperty.call(message, "biasH"))
|
|
1134
|
+
object.biasH = $root.flockml.QuantizedMatrix.toObject(message.biasH, options, _depth + 1);
|
|
1135
|
+
if (message.biasO != null && $Object.hasOwnProperty.call(message, "biasO"))
|
|
1136
|
+
object.biasO = $root.flockml.QuantizedMatrix.toObject(message.biasO, options, _depth + 1);
|
|
1137
|
+
if (message.version != null && $Object.hasOwnProperty.call(message, "version"))
|
|
1138
|
+
object.version = message.version;
|
|
1139
|
+
return object;
|
|
1140
|
+
};
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* Converts this GlobalModel to JSON.
|
|
1144
|
+
* @function toJSON
|
|
1145
|
+
* @memberof flockml.GlobalModel
|
|
1146
|
+
* @instance
|
|
1147
|
+
* @returns {Object.<string,*>} JSON object
|
|
1148
|
+
*/
|
|
1149
|
+
GlobalModel.prototype.toJSON = function() {
|
|
1150
|
+
return GlobalModel.toObject(this, $protobuf.util.toJSONOptions);
|
|
1151
|
+
};
|
|
1152
|
+
|
|
1153
|
+
/**
|
|
1154
|
+
* Gets the type url for GlobalModel
|
|
1155
|
+
* @function getTypeUrl
|
|
1156
|
+
* @memberof flockml.GlobalModel
|
|
1157
|
+
* @static
|
|
1158
|
+
* @param {string} [prefix] Custom type url prefix, defaults to `"type.googleapis.com"`
|
|
1159
|
+
* @returns {string} The type url
|
|
1160
|
+
*/
|
|
1161
|
+
GlobalModel.getTypeUrl = function(prefix) {
|
|
1162
|
+
if (prefix === $undefined)
|
|
1163
|
+
prefix = "type.googleapis.com";
|
|
1164
|
+
return prefix + "/flockml.GlobalModel";
|
|
1165
|
+
};
|
|
1166
|
+
|
|
1167
|
+
return GlobalModel;
|
|
1168
|
+
})();
|
|
1169
|
+
|
|
1170
|
+
return flockml;
|
|
1171
|
+
})();
|
|
1172
|
+
|
|
1173
|
+
module.exports = $root;
|