onnxruntime

Форк
0
7391 строка · 296.3 Кб
1
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
2
'use strict';
3

4
var $protobuf = require('protobufjs/minimal');
5

6
// Common aliases
7
var $Reader = $protobuf.Reader,
8
  $Writer = $protobuf.Writer,
9
  $util = $protobuf.util;
10

11
// Exported root namespace
12
var $root = $protobuf.roots['default'] || ($protobuf.roots['default'] = {});
13

14
$root.onnx = (function () {
15
  /**
16
   * Namespace onnx.
17
   * @exports onnx
18
   * @namespace
19
   */
20
  var onnx = {};
21

22
  /**
23
   * Version enum.
24
   * @name onnx.Version
25
   * @enum {number}
26
   * @property {number} _START_VERSION=0 _START_VERSION value
27
   * @property {number} IR_VERSION_2017_10_10=1 IR_VERSION_2017_10_10 value
28
   * @property {number} IR_VERSION_2017_10_30=2 IR_VERSION_2017_10_30 value
29
   * @property {number} IR_VERSION_2017_11_3=3 IR_VERSION_2017_11_3 value
30
   * @property {number} IR_VERSION_2019_1_22=4 IR_VERSION_2019_1_22 value
31
   * @property {number} IR_VERSION_2019_3_18=5 IR_VERSION_2019_3_18 value
32
   * @property {number} IR_VERSION_2019_9_19=6 IR_VERSION_2019_9_19 value
33
   * @property {number} IR_VERSION_2020_5_8=7 IR_VERSION_2020_5_8 value
34
   * @property {number} IR_VERSION_2021_7_30=8 IR_VERSION_2021_7_30 value
35
   * @property {number} IR_VERSION=9 IR_VERSION value
36
   */
37
  onnx.Version = (function () {
38
    var valuesById = {},
39
      values = Object.create(valuesById);
40
    values[(valuesById[0] = '_START_VERSION')] = 0;
41
    values[(valuesById[1] = 'IR_VERSION_2017_10_10')] = 1;
42
    values[(valuesById[2] = 'IR_VERSION_2017_10_30')] = 2;
43
    values[(valuesById[3] = 'IR_VERSION_2017_11_3')] = 3;
44
    values[(valuesById[4] = 'IR_VERSION_2019_1_22')] = 4;
45
    values[(valuesById[5] = 'IR_VERSION_2019_3_18')] = 5;
46
    values[(valuesById[6] = 'IR_VERSION_2019_9_19')] = 6;
47
    values[(valuesById[7] = 'IR_VERSION_2020_5_8')] = 7;
48
    values[(valuesById[8] = 'IR_VERSION_2021_7_30')] = 8;
49
    values[(valuesById[9] = 'IR_VERSION')] = 9;
50
    return values;
51
  })();
52

53
  onnx.AttributeProto = (function () {
54
    /**
55
     * Properties of an AttributeProto.
56
     * @memberof onnx
57
     * @interface IAttributeProto
58
     * @property {string|null} [name] AttributeProto name
59
     * @property {string|null} [refAttrName] AttributeProto refAttrName
60
     * @property {string|null} [docString] AttributeProto docString
61
     * @property {onnx.AttributeProto.AttributeType|null} [type] AttributeProto type
62
     * @property {number|null} [f] AttributeProto f
63
     * @property {number|Long|null} [i] AttributeProto i
64
     * @property {Uint8Array|null} [s] AttributeProto s
65
     * @property {onnx.ITensorProto|null} [t] AttributeProto t
66
     * @property {onnx.IGraphProto|null} [g] AttributeProto g
67
     * @property {onnx.ISparseTensorProto|null} [sparseTensor] AttributeProto sparseTensor
68
     * @property {onnx.ITypeProto|null} [tp] AttributeProto tp
69
     * @property {Array.<number>|null} [floats] AttributeProto floats
70
     * @property {Array.<number|Long>|null} [ints] AttributeProto ints
71
     * @property {Array.<Uint8Array>|null} [strings] AttributeProto strings
72
     * @property {Array.<onnx.ITensorProto>|null} [tensors] AttributeProto tensors
73
     * @property {Array.<onnx.IGraphProto>|null} [graphs] AttributeProto graphs
74
     * @property {Array.<onnx.ISparseTensorProto>|null} [sparseTensors] AttributeProto sparseTensors
75
     * @property {Array.<onnx.ITypeProto>|null} [typeProtos] AttributeProto typeProtos
76
     */
77

78
    /**
79
     * Constructs a new AttributeProto.
80
     * @memberof onnx
81
     * @classdesc Represents an AttributeProto.
82
     * @implements IAttributeProto
83
     * @constructor
84
     * @param {onnx.IAttributeProto=} [properties] Properties to set
85
     */
86
    function AttributeProto(properties) {
87
      this.floats = [];
88
      this.ints = [];
89
      this.strings = [];
90
      this.tensors = [];
91
      this.graphs = [];
92
      this.sparseTensors = [];
93
      this.typeProtos = [];
94
      if (properties)
95
        for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
96
          if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
97
    }
98

99
    /**
100
     * AttributeProto name.
101
     * @member {string} name
102
     * @memberof onnx.AttributeProto
103
     * @instance
104
     */
105
    AttributeProto.prototype.name = '';
106

107
    /**
108
     * AttributeProto refAttrName.
109
     * @member {string} refAttrName
110
     * @memberof onnx.AttributeProto
111
     * @instance
112
     */
113
    AttributeProto.prototype.refAttrName = '';
114

115
    /**
116
     * AttributeProto docString.
117
     * @member {string} docString
118
     * @memberof onnx.AttributeProto
119
     * @instance
120
     */
121
    AttributeProto.prototype.docString = '';
122

123
    /**
124
     * AttributeProto type.
125
     * @member {onnx.AttributeProto.AttributeType} type
126
     * @memberof onnx.AttributeProto
127
     * @instance
128
     */
129
    AttributeProto.prototype.type = 0;
130

131
    /**
132
     * AttributeProto f.
133
     * @member {number} f
134
     * @memberof onnx.AttributeProto
135
     * @instance
136
     */
137
    AttributeProto.prototype.f = 0;
138

139
    /**
140
     * AttributeProto i.
141
     * @member {number|Long} i
142
     * @memberof onnx.AttributeProto
143
     * @instance
144
     */
145
    AttributeProto.prototype.i = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
146

147
    /**
148
     * AttributeProto s.
149
     * @member {Uint8Array} s
150
     * @memberof onnx.AttributeProto
151
     * @instance
152
     */
153
    AttributeProto.prototype.s = $util.newBuffer([]);
154

155
    /**
156
     * AttributeProto t.
157
     * @member {onnx.ITensorProto|null|undefined} t
158
     * @memberof onnx.AttributeProto
159
     * @instance
160
     */
161
    AttributeProto.prototype.t = null;
162

163
    /**
164
     * AttributeProto g.
165
     * @member {onnx.IGraphProto|null|undefined} g
166
     * @memberof onnx.AttributeProto
167
     * @instance
168
     */
169
    AttributeProto.prototype.g = null;
170

171
    /**
172
     * AttributeProto sparseTensor.
173
     * @member {onnx.ISparseTensorProto|null|undefined} sparseTensor
174
     * @memberof onnx.AttributeProto
175
     * @instance
176
     */
177
    AttributeProto.prototype.sparseTensor = null;
178

179
    /**
180
     * AttributeProto tp.
181
     * @member {onnx.ITypeProto|null|undefined} tp
182
     * @memberof onnx.AttributeProto
183
     * @instance
184
     */
185
    AttributeProto.prototype.tp = null;
186

187
    /**
188
     * AttributeProto floats.
189
     * @member {Array.<number>} floats
190
     * @memberof onnx.AttributeProto
191
     * @instance
192
     */
193
    AttributeProto.prototype.floats = $util.emptyArray;
194

195
    /**
196
     * AttributeProto ints.
197
     * @member {Array.<number|Long>} ints
198
     * @memberof onnx.AttributeProto
199
     * @instance
200
     */
201
    AttributeProto.prototype.ints = $util.emptyArray;
202

203
    /**
204
     * AttributeProto strings.
205
     * @member {Array.<Uint8Array>} strings
206
     * @memberof onnx.AttributeProto
207
     * @instance
208
     */
209
    AttributeProto.prototype.strings = $util.emptyArray;
210

211
    /**
212
     * AttributeProto tensors.
213
     * @member {Array.<onnx.ITensorProto>} tensors
214
     * @memberof onnx.AttributeProto
215
     * @instance
216
     */
217
    AttributeProto.prototype.tensors = $util.emptyArray;
218

219
    /**
220
     * AttributeProto graphs.
221
     * @member {Array.<onnx.IGraphProto>} graphs
222
     * @memberof onnx.AttributeProto
223
     * @instance
224
     */
225
    AttributeProto.prototype.graphs = $util.emptyArray;
226

227
    /**
228
     * AttributeProto sparseTensors.
229
     * @member {Array.<onnx.ISparseTensorProto>} sparseTensors
230
     * @memberof onnx.AttributeProto
231
     * @instance
232
     */
233
    AttributeProto.prototype.sparseTensors = $util.emptyArray;
234

235
    /**
236
     * AttributeProto typeProtos.
237
     * @member {Array.<onnx.ITypeProto>} typeProtos
238
     * @memberof onnx.AttributeProto
239
     * @instance
240
     */
241
    AttributeProto.prototype.typeProtos = $util.emptyArray;
242

243
    /**
244
     * Creates a new AttributeProto instance using the specified properties.
245
     * @function create
246
     * @memberof onnx.AttributeProto
247
     * @static
248
     * @param {onnx.IAttributeProto=} [properties] Properties to set
249
     * @returns {onnx.AttributeProto} AttributeProto instance
250
     */
251
    AttributeProto.create = function create(properties) {
252
      return new AttributeProto(properties);
253
    };
254

255
    /**
256
     * Encodes the specified AttributeProto message. Does not implicitly {@link onnx.AttributeProto.verify|verify} messages.
257
     * @function encode
258
     * @memberof onnx.AttributeProto
259
     * @static
260
     * @param {onnx.IAttributeProto} message AttributeProto message or plain object to encode
261
     * @param {$protobuf.Writer} [writer] Writer to encode to
262
     * @returns {$protobuf.Writer} Writer
263
     */
264
    AttributeProto.encode = function encode(message, writer) {
265
      if (!writer) writer = $Writer.create();
266
      if (message.name != null && Object.hasOwnProperty.call(message, 'name'))
267
        writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.name);
268
      if (message.f != null && Object.hasOwnProperty.call(message, 'f'))
269
        writer.uint32(/* id 2, wireType 5 =*/ 21).float(message.f);
270
      if (message.i != null && Object.hasOwnProperty.call(message, 'i'))
271
        writer.uint32(/* id 3, wireType 0 =*/ 24).int64(message.i);
272
      if (message.s != null && Object.hasOwnProperty.call(message, 's'))
273
        writer.uint32(/* id 4, wireType 2 =*/ 34).bytes(message.s);
274
      if (message.t != null && Object.hasOwnProperty.call(message, 't'))
275
        $root.onnx.TensorProto.encode(message.t, writer.uint32(/* id 5, wireType 2 =*/ 42).fork()).ldelim();
276
      if (message.g != null && Object.hasOwnProperty.call(message, 'g'))
277
        $root.onnx.GraphProto.encode(message.g, writer.uint32(/* id 6, wireType 2 =*/ 50).fork()).ldelim();
278
      if (message.floats != null && message.floats.length) {
279
        writer.uint32(/* id 7, wireType 2 =*/ 58).fork();
280
        for (var i = 0; i < message.floats.length; ++i) writer.float(message.floats[i]);
281
        writer.ldelim();
282
      }
283
      if (message.ints != null && message.ints.length) {
284
        writer.uint32(/* id 8, wireType 2 =*/ 66).fork();
285
        for (var i = 0; i < message.ints.length; ++i) writer.int64(message.ints[i]);
286
        writer.ldelim();
287
      }
288
      if (message.strings != null && message.strings.length)
289
        for (var i = 0; i < message.strings.length; ++i)
290
          writer.uint32(/* id 9, wireType 2 =*/ 74).bytes(message.strings[i]);
291
      if (message.tensors != null && message.tensors.length)
292
        for (var i = 0; i < message.tensors.length; ++i)
293
          $root.onnx.TensorProto.encode(message.tensors[i], writer.uint32(/* id 10, wireType 2 =*/ 82).fork()).ldelim();
294
      if (message.graphs != null && message.graphs.length)
295
        for (var i = 0; i < message.graphs.length; ++i)
296
          $root.onnx.GraphProto.encode(message.graphs[i], writer.uint32(/* id 11, wireType 2 =*/ 90).fork()).ldelim();
297
      if (message.docString != null && Object.hasOwnProperty.call(message, 'docString'))
298
        writer.uint32(/* id 13, wireType 2 =*/ 106).string(message.docString);
299
      if (message.tp != null && Object.hasOwnProperty.call(message, 'tp'))
300
        $root.onnx.TypeProto.encode(message.tp, writer.uint32(/* id 14, wireType 2 =*/ 114).fork()).ldelim();
301
      if (message.typeProtos != null && message.typeProtos.length)
302
        for (var i = 0; i < message.typeProtos.length; ++i)
303
          $root.onnx.TypeProto.encode(
304
            message.typeProtos[i],
305
            writer.uint32(/* id 15, wireType 2 =*/ 122).fork(),
306
          ).ldelim();
307
      if (message.type != null && Object.hasOwnProperty.call(message, 'type'))
308
        writer.uint32(/* id 20, wireType 0 =*/ 160).int32(message.type);
309
      if (message.refAttrName != null && Object.hasOwnProperty.call(message, 'refAttrName'))
310
        writer.uint32(/* id 21, wireType 2 =*/ 170).string(message.refAttrName);
311
      if (message.sparseTensor != null && Object.hasOwnProperty.call(message, 'sparseTensor'))
312
        $root.onnx.SparseTensorProto.encode(
313
          message.sparseTensor,
314
          writer.uint32(/* id 22, wireType 2 =*/ 178).fork(),
315
        ).ldelim();
316
      if (message.sparseTensors != null && message.sparseTensors.length)
317
        for (var i = 0; i < message.sparseTensors.length; ++i)
318
          $root.onnx.SparseTensorProto.encode(
319
            message.sparseTensors[i],
320
            writer.uint32(/* id 23, wireType 2 =*/ 186).fork(),
321
          ).ldelim();
322
      return writer;
323
    };
324

325
    /**
326
     * Encodes the specified AttributeProto message, length delimited. Does not implicitly {@link onnx.AttributeProto.verify|verify} messages.
327
     * @function encodeDelimited
328
     * @memberof onnx.AttributeProto
329
     * @static
330
     * @param {onnx.IAttributeProto} message AttributeProto message or plain object to encode
331
     * @param {$protobuf.Writer} [writer] Writer to encode to
332
     * @returns {$protobuf.Writer} Writer
333
     */
334
    AttributeProto.encodeDelimited = function encodeDelimited(message, writer) {
335
      return this.encode(message, writer).ldelim();
336
    };
337

338
    /**
339
     * Decodes an AttributeProto message from the specified reader or buffer.
340
     * @function decode
341
     * @memberof onnx.AttributeProto
342
     * @static
343
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
344
     * @param {number} [length] Message length if known beforehand
345
     * @returns {onnx.AttributeProto} AttributeProto
346
     * @throws {Error} If the payload is not a reader or valid buffer
347
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
348
     */
349
    AttributeProto.decode = function decode(reader, length) {
350
      if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
351
      var end = length === undefined ? reader.len : reader.pos + length,
352
        message = new $root.onnx.AttributeProto();
353
      while (reader.pos < end) {
354
        var tag = reader.uint32();
355
        switch (tag >>> 3) {
356
          case 1: {
357
            message.name = reader.string();
358
            break;
359
          }
360
          case 21: {
361
            message.refAttrName = reader.string();
362
            break;
363
          }
364
          case 13: {
365
            message.docString = reader.string();
366
            break;
367
          }
368
          case 20: {
369
            message.type = reader.int32();
370
            break;
371
          }
372
          case 2: {
373
            message.f = reader.float();
374
            break;
375
          }
376
          case 3: {
377
            message.i = reader.int64();
378
            break;
379
          }
380
          case 4: {
381
            message.s = reader.bytes();
382
            break;
383
          }
384
          case 5: {
385
            message.t = $root.onnx.TensorProto.decode(reader, reader.uint32());
386
            break;
387
          }
388
          case 6: {
389
            message.g = $root.onnx.GraphProto.decode(reader, reader.uint32());
390
            break;
391
          }
392
          case 22: {
393
            message.sparseTensor = $root.onnx.SparseTensorProto.decode(reader, reader.uint32());
394
            break;
395
          }
396
          case 14: {
397
            message.tp = $root.onnx.TypeProto.decode(reader, reader.uint32());
398
            break;
399
          }
400
          case 7: {
401
            if (!(message.floats && message.floats.length)) message.floats = [];
402
            if ((tag & 7) === 2) {
403
              var end2 = reader.uint32() + reader.pos;
404
              while (reader.pos < end2) message.floats.push(reader.float());
405
            } else message.floats.push(reader.float());
406
            break;
407
          }
408
          case 8: {
409
            if (!(message.ints && message.ints.length)) message.ints = [];
410
            if ((tag & 7) === 2) {
411
              var end2 = reader.uint32() + reader.pos;
412
              while (reader.pos < end2) message.ints.push(reader.int64());
413
            } else message.ints.push(reader.int64());
414
            break;
415
          }
416
          case 9: {
417
            if (!(message.strings && message.strings.length)) message.strings = [];
418
            message.strings.push(reader.bytes());
419
            break;
420
          }
421
          case 10: {
422
            if (!(message.tensors && message.tensors.length)) message.tensors = [];
423
            message.tensors.push($root.onnx.TensorProto.decode(reader, reader.uint32()));
424
            break;
425
          }
426
          case 11: {
427
            if (!(message.graphs && message.graphs.length)) message.graphs = [];
428
            message.graphs.push($root.onnx.GraphProto.decode(reader, reader.uint32()));
429
            break;
430
          }
431
          case 23: {
432
            if (!(message.sparseTensors && message.sparseTensors.length)) message.sparseTensors = [];
433
            message.sparseTensors.push($root.onnx.SparseTensorProto.decode(reader, reader.uint32()));
434
            break;
435
          }
436
          case 15: {
437
            if (!(message.typeProtos && message.typeProtos.length)) message.typeProtos = [];
438
            message.typeProtos.push($root.onnx.TypeProto.decode(reader, reader.uint32()));
439
            break;
440
          }
441
          default:
442
            reader.skipType(tag & 7);
443
            break;
444
        }
445
      }
446
      return message;
447
    };
448

449
    /**
450
     * Decodes an AttributeProto message from the specified reader or buffer, length delimited.
451
     * @function decodeDelimited
452
     * @memberof onnx.AttributeProto
453
     * @static
454
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
455
     * @returns {onnx.AttributeProto} AttributeProto
456
     * @throws {Error} If the payload is not a reader or valid buffer
457
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
458
     */
459
    AttributeProto.decodeDelimited = function decodeDelimited(reader) {
460
      if (!(reader instanceof $Reader)) reader = new $Reader(reader);
461
      return this.decode(reader, reader.uint32());
462
    };
463

464
    /**
465
     * Verifies an AttributeProto message.
466
     * @function verify
467
     * @memberof onnx.AttributeProto
468
     * @static
469
     * @param {Object.<string,*>} message Plain object to verify
470
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
471
     */
472
    AttributeProto.verify = function verify(message) {
473
      if (typeof message !== 'object' || message === null) return 'object expected';
474
      if (message.name != null && message.hasOwnProperty('name'))
475
        if (!$util.isString(message.name)) return 'name: string expected';
476
      if (message.refAttrName != null && message.hasOwnProperty('refAttrName'))
477
        if (!$util.isString(message.refAttrName)) return 'refAttrName: string expected';
478
      if (message.docString != null && message.hasOwnProperty('docString'))
479
        if (!$util.isString(message.docString)) return 'docString: string expected';
480
      if (message.type != null && message.hasOwnProperty('type'))
481
        switch (message.type) {
482
          default:
483
            return 'type: enum value expected';
484
          case 0:
485
          case 1:
486
          case 2:
487
          case 3:
488
          case 4:
489
          case 5:
490
          case 11:
491
          case 13:
492
          case 6:
493
          case 7:
494
          case 8:
495
          case 9:
496
          case 10:
497
          case 12:
498
          case 14:
499
            break;
500
        }
501
      if (message.f != null && message.hasOwnProperty('f'))
502
        if (typeof message.f !== 'number') return 'f: number expected';
503
      if (message.i != null && message.hasOwnProperty('i'))
504
        if (
505
          !$util.isInteger(message.i) &&
506
          !(message.i && $util.isInteger(message.i.low) && $util.isInteger(message.i.high))
507
        )
508
          return 'i: integer|Long expected';
509
      if (message.s != null && message.hasOwnProperty('s'))
510
        if (!((message.s && typeof message.s.length === 'number') || $util.isString(message.s)))
511
          return 's: buffer expected';
512
      if (message.t != null && message.hasOwnProperty('t')) {
513
        var error = $root.onnx.TensorProto.verify(message.t);
514
        if (error) return 't.' + error;
515
      }
516
      if (message.g != null && message.hasOwnProperty('g')) {
517
        var error = $root.onnx.GraphProto.verify(message.g);
518
        if (error) return 'g.' + error;
519
      }
520
      if (message.sparseTensor != null && message.hasOwnProperty('sparseTensor')) {
521
        var error = $root.onnx.SparseTensorProto.verify(message.sparseTensor);
522
        if (error) return 'sparseTensor.' + error;
523
      }
524
      if (message.tp != null && message.hasOwnProperty('tp')) {
525
        var error = $root.onnx.TypeProto.verify(message.tp);
526
        if (error) return 'tp.' + error;
527
      }
528
      if (message.floats != null && message.hasOwnProperty('floats')) {
529
        if (!Array.isArray(message.floats)) return 'floats: array expected';
530
        for (var i = 0; i < message.floats.length; ++i)
531
          if (typeof message.floats[i] !== 'number') return 'floats: number[] expected';
532
      }
533
      if (message.ints != null && message.hasOwnProperty('ints')) {
534
        if (!Array.isArray(message.ints)) return 'ints: array expected';
535
        for (var i = 0; i < message.ints.length; ++i)
536
          if (
537
            !$util.isInteger(message.ints[i]) &&
538
            !(message.ints[i] && $util.isInteger(message.ints[i].low) && $util.isInteger(message.ints[i].high))
539
          )
540
            return 'ints: integer|Long[] expected';
541
      }
542
      if (message.strings != null && message.hasOwnProperty('strings')) {
543
        if (!Array.isArray(message.strings)) return 'strings: array expected';
544
        for (var i = 0; i < message.strings.length; ++i)
545
          if (
546
            !(
547
              (message.strings[i] && typeof message.strings[i].length === 'number') ||
548
              $util.isString(message.strings[i])
549
            )
550
          )
551
            return 'strings: buffer[] expected';
552
      }
553
      if (message.tensors != null && message.hasOwnProperty('tensors')) {
554
        if (!Array.isArray(message.tensors)) return 'tensors: array expected';
555
        for (var i = 0; i < message.tensors.length; ++i) {
556
          var error = $root.onnx.TensorProto.verify(message.tensors[i]);
557
          if (error) return 'tensors.' + error;
558
        }
559
      }
560
      if (message.graphs != null && message.hasOwnProperty('graphs')) {
561
        if (!Array.isArray(message.graphs)) return 'graphs: array expected';
562
        for (var i = 0; i < message.graphs.length; ++i) {
563
          var error = $root.onnx.GraphProto.verify(message.graphs[i]);
564
          if (error) return 'graphs.' + error;
565
        }
566
      }
567
      if (message.sparseTensors != null && message.hasOwnProperty('sparseTensors')) {
568
        if (!Array.isArray(message.sparseTensors)) return 'sparseTensors: array expected';
569
        for (var i = 0; i < message.sparseTensors.length; ++i) {
570
          var error = $root.onnx.SparseTensorProto.verify(message.sparseTensors[i]);
571
          if (error) return 'sparseTensors.' + error;
572
        }
573
      }
574
      if (message.typeProtos != null && message.hasOwnProperty('typeProtos')) {
575
        if (!Array.isArray(message.typeProtos)) return 'typeProtos: array expected';
576
        for (var i = 0; i < message.typeProtos.length; ++i) {
577
          var error = $root.onnx.TypeProto.verify(message.typeProtos[i]);
578
          if (error) return 'typeProtos.' + error;
579
        }
580
      }
581
      return null;
582
    };
583

584
    /**
585
     * Creates an AttributeProto message from a plain object. Also converts values to their respective internal types.
586
     * @function fromObject
587
     * @memberof onnx.AttributeProto
588
     * @static
589
     * @param {Object.<string,*>} object Plain object
590
     * @returns {onnx.AttributeProto} AttributeProto
591
     */
592
    AttributeProto.fromObject = function fromObject(object) {
593
      if (object instanceof $root.onnx.AttributeProto) return object;
594
      var message = new $root.onnx.AttributeProto();
595
      if (object.name != null) message.name = String(object.name);
596
      if (object.refAttrName != null) message.refAttrName = String(object.refAttrName);
597
      if (object.docString != null) message.docString = String(object.docString);
598
      switch (object.type) {
599
        default:
600
          if (typeof object.type === 'number') {
601
            message.type = object.type;
602
            break;
603
          }
604
          break;
605
        case 'UNDEFINED':
606
        case 0:
607
          message.type = 0;
608
          break;
609
        case 'FLOAT':
610
        case 1:
611
          message.type = 1;
612
          break;
613
        case 'INT':
614
        case 2:
615
          message.type = 2;
616
          break;
617
        case 'STRING':
618
        case 3:
619
          message.type = 3;
620
          break;
621
        case 'TENSOR':
622
        case 4:
623
          message.type = 4;
624
          break;
625
        case 'GRAPH':
626
        case 5:
627
          message.type = 5;
628
          break;
629
        case 'SPARSE_TENSOR':
630
        case 11:
631
          message.type = 11;
632
          break;
633
        case 'TYPE_PROTO':
634
        case 13:
635
          message.type = 13;
636
          break;
637
        case 'FLOATS':
638
        case 6:
639
          message.type = 6;
640
          break;
641
        case 'INTS':
642
        case 7:
643
          message.type = 7;
644
          break;
645
        case 'STRINGS':
646
        case 8:
647
          message.type = 8;
648
          break;
649
        case 'TENSORS':
650
        case 9:
651
          message.type = 9;
652
          break;
653
        case 'GRAPHS':
654
        case 10:
655
          message.type = 10;
656
          break;
657
        case 'SPARSE_TENSORS':
658
        case 12:
659
          message.type = 12;
660
          break;
661
        case 'TYPE_PROTOS':
662
        case 14:
663
          message.type = 14;
664
          break;
665
      }
666
      if (object.f != null) message.f = Number(object.f);
667
      if (object.i != null)
668
        if ($util.Long) (message.i = $util.Long.fromValue(object.i)).unsigned = false;
669
        else if (typeof object.i === 'string') message.i = parseInt(object.i, 10);
670
        else if (typeof object.i === 'number') message.i = object.i;
671
        else if (typeof object.i === 'object')
672
          message.i = new $util.LongBits(object.i.low >>> 0, object.i.high >>> 0).toNumber();
673
      if (object.s != null)
674
        if (typeof object.s === 'string')
675
          $util.base64.decode(object.s, (message.s = $util.newBuffer($util.base64.length(object.s))), 0);
676
        else if (object.s.length >= 0) message.s = object.s;
677
      if (object.t != null) {
678
        if (typeof object.t !== 'object') throw TypeError('.onnx.AttributeProto.t: object expected');
679
        message.t = $root.onnx.TensorProto.fromObject(object.t);
680
      }
681
      if (object.g != null) {
682
        if (typeof object.g !== 'object') throw TypeError('.onnx.AttributeProto.g: object expected');
683
        message.g = $root.onnx.GraphProto.fromObject(object.g);
684
      }
685
      if (object.sparseTensor != null) {
686
        if (typeof object.sparseTensor !== 'object')
687
          throw TypeError('.onnx.AttributeProto.sparseTensor: object expected');
688
        message.sparseTensor = $root.onnx.SparseTensorProto.fromObject(object.sparseTensor);
689
      }
690
      if (object.tp != null) {
691
        if (typeof object.tp !== 'object') throw TypeError('.onnx.AttributeProto.tp: object expected');
692
        message.tp = $root.onnx.TypeProto.fromObject(object.tp);
693
      }
694
      if (object.floats) {
695
        if (!Array.isArray(object.floats)) throw TypeError('.onnx.AttributeProto.floats: array expected');
696
        message.floats = [];
697
        for (var i = 0; i < object.floats.length; ++i) message.floats[i] = Number(object.floats[i]);
698
      }
699
      if (object.ints) {
700
        if (!Array.isArray(object.ints)) throw TypeError('.onnx.AttributeProto.ints: array expected');
701
        message.ints = [];
702
        for (var i = 0; i < object.ints.length; ++i)
703
          if ($util.Long) (message.ints[i] = $util.Long.fromValue(object.ints[i])).unsigned = false;
704
          else if (typeof object.ints[i] === 'string') message.ints[i] = parseInt(object.ints[i], 10);
705
          else if (typeof object.ints[i] === 'number') message.ints[i] = object.ints[i];
706
          else if (typeof object.ints[i] === 'object')
707
            message.ints[i] = new $util.LongBits(object.ints[i].low >>> 0, object.ints[i].high >>> 0).toNumber();
708
      }
709
      if (object.strings) {
710
        if (!Array.isArray(object.strings)) throw TypeError('.onnx.AttributeProto.strings: array expected');
711
        message.strings = [];
712
        for (var i = 0; i < object.strings.length; ++i)
713
          if (typeof object.strings[i] === 'string')
714
            $util.base64.decode(
715
              object.strings[i],
716
              (message.strings[i] = $util.newBuffer($util.base64.length(object.strings[i]))),
717
              0,
718
            );
719
          else if (object.strings[i].length >= 0) message.strings[i] = object.strings[i];
720
      }
721
      if (object.tensors) {
722
        if (!Array.isArray(object.tensors)) throw TypeError('.onnx.AttributeProto.tensors: array expected');
723
        message.tensors = [];
724
        for (var i = 0; i < object.tensors.length; ++i) {
725
          if (typeof object.tensors[i] !== 'object') throw TypeError('.onnx.AttributeProto.tensors: object expected');
726
          message.tensors[i] = $root.onnx.TensorProto.fromObject(object.tensors[i]);
727
        }
728
      }
729
      if (object.graphs) {
730
        if (!Array.isArray(object.graphs)) throw TypeError('.onnx.AttributeProto.graphs: array expected');
731
        message.graphs = [];
732
        for (var i = 0; i < object.graphs.length; ++i) {
733
          if (typeof object.graphs[i] !== 'object') throw TypeError('.onnx.AttributeProto.graphs: object expected');
734
          message.graphs[i] = $root.onnx.GraphProto.fromObject(object.graphs[i]);
735
        }
736
      }
737
      if (object.sparseTensors) {
738
        if (!Array.isArray(object.sparseTensors)) throw TypeError('.onnx.AttributeProto.sparseTensors: array expected');
739
        message.sparseTensors = [];
740
        for (var i = 0; i < object.sparseTensors.length; ++i) {
741
          if (typeof object.sparseTensors[i] !== 'object')
742
            throw TypeError('.onnx.AttributeProto.sparseTensors: object expected');
743
          message.sparseTensors[i] = $root.onnx.SparseTensorProto.fromObject(object.sparseTensors[i]);
744
        }
745
      }
746
      if (object.typeProtos) {
747
        if (!Array.isArray(object.typeProtos)) throw TypeError('.onnx.AttributeProto.typeProtos: array expected');
748
        message.typeProtos = [];
749
        for (var i = 0; i < object.typeProtos.length; ++i) {
750
          if (typeof object.typeProtos[i] !== 'object')
751
            throw TypeError('.onnx.AttributeProto.typeProtos: object expected');
752
          message.typeProtos[i] = $root.onnx.TypeProto.fromObject(object.typeProtos[i]);
753
        }
754
      }
755
      return message;
756
    };
757

758
    /**
759
     * Creates a plain object from an AttributeProto message. Also converts values to other types if specified.
760
     * @function toObject
761
     * @memberof onnx.AttributeProto
762
     * @static
763
     * @param {onnx.AttributeProto} message AttributeProto
764
     * @param {$protobuf.IConversionOptions} [options] Conversion options
765
     * @returns {Object.<string,*>} Plain object
766
     */
767
    AttributeProto.toObject = function toObject(message, options) {
768
      if (!options) options = {};
769
      var object = {};
770
      if (options.arrays || options.defaults) {
771
        object.floats = [];
772
        object.ints = [];
773
        object.strings = [];
774
        object.tensors = [];
775
        object.graphs = [];
776
        object.typeProtos = [];
777
        object.sparseTensors = [];
778
      }
779
      if (options.defaults) {
780
        object.name = '';
781
        object.f = 0;
782
        if ($util.Long) {
783
          var long = new $util.Long(0, 0, false);
784
          object.i = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
785
        } else object.i = options.longs === String ? '0' : 0;
786
        if (options.bytes === String) object.s = '';
787
        else {
788
          object.s = [];
789
          if (options.bytes !== Array) object.s = $util.newBuffer(object.s);
790
        }
791
        object.t = null;
792
        object.g = null;
793
        object.docString = '';
794
        object.tp = null;
795
        object.type = options.enums === String ? 'UNDEFINED' : 0;
796
        object.refAttrName = '';
797
        object.sparseTensor = null;
798
      }
799
      if (message.name != null && message.hasOwnProperty('name')) object.name = message.name;
800
      if (message.f != null && message.hasOwnProperty('f'))
801
        object.f = options.json && !isFinite(message.f) ? String(message.f) : message.f;
802
      if (message.i != null && message.hasOwnProperty('i'))
803
        if (typeof message.i === 'number') object.i = options.longs === String ? String(message.i) : message.i;
804
        else
805
          object.i =
806
            options.longs === String
807
              ? $util.Long.prototype.toString.call(message.i)
808
              : options.longs === Number
809
                ? new $util.LongBits(message.i.low >>> 0, message.i.high >>> 0).toNumber()
810
                : message.i;
811
      if (message.s != null && message.hasOwnProperty('s'))
812
        object.s =
813
          options.bytes === String
814
            ? $util.base64.encode(message.s, 0, message.s.length)
815
            : options.bytes === Array
816
              ? Array.prototype.slice.call(message.s)
817
              : message.s;
818
      if (message.t != null && message.hasOwnProperty('t'))
819
        object.t = $root.onnx.TensorProto.toObject(message.t, options);
820
      if (message.g != null && message.hasOwnProperty('g'))
821
        object.g = $root.onnx.GraphProto.toObject(message.g, options);
822
      if (message.floats && message.floats.length) {
823
        object.floats = [];
824
        for (var j = 0; j < message.floats.length; ++j)
825
          object.floats[j] =
826
            options.json && !isFinite(message.floats[j]) ? String(message.floats[j]) : message.floats[j];
827
      }
828
      if (message.ints && message.ints.length) {
829
        object.ints = [];
830
        for (var j = 0; j < message.ints.length; ++j)
831
          if (typeof message.ints[j] === 'number')
832
            object.ints[j] = options.longs === String ? String(message.ints[j]) : message.ints[j];
833
          else
834
            object.ints[j] =
835
              options.longs === String
836
                ? $util.Long.prototype.toString.call(message.ints[j])
837
                : options.longs === Number
838
                  ? new $util.LongBits(message.ints[j].low >>> 0, message.ints[j].high >>> 0).toNumber()
839
                  : message.ints[j];
840
      }
841
      if (message.strings && message.strings.length) {
842
        object.strings = [];
843
        for (var j = 0; j < message.strings.length; ++j)
844
          object.strings[j] =
845
            options.bytes === String
846
              ? $util.base64.encode(message.strings[j], 0, message.strings[j].length)
847
              : options.bytes === Array
848
                ? Array.prototype.slice.call(message.strings[j])
849
                : message.strings[j];
850
      }
851
      if (message.tensors && message.tensors.length) {
852
        object.tensors = [];
853
        for (var j = 0; j < message.tensors.length; ++j)
854
          object.tensors[j] = $root.onnx.TensorProto.toObject(message.tensors[j], options);
855
      }
856
      if (message.graphs && message.graphs.length) {
857
        object.graphs = [];
858
        for (var j = 0; j < message.graphs.length; ++j)
859
          object.graphs[j] = $root.onnx.GraphProto.toObject(message.graphs[j], options);
860
      }
861
      if (message.docString != null && message.hasOwnProperty('docString')) object.docString = message.docString;
862
      if (message.tp != null && message.hasOwnProperty('tp'))
863
        object.tp = $root.onnx.TypeProto.toObject(message.tp, options);
864
      if (message.typeProtos && message.typeProtos.length) {
865
        object.typeProtos = [];
866
        for (var j = 0; j < message.typeProtos.length; ++j)
867
          object.typeProtos[j] = $root.onnx.TypeProto.toObject(message.typeProtos[j], options);
868
      }
869
      if (message.type != null && message.hasOwnProperty('type'))
870
        object.type =
871
          options.enums === String
872
            ? $root.onnx.AttributeProto.AttributeType[message.type] === undefined
873
              ? message.type
874
              : $root.onnx.AttributeProto.AttributeType[message.type]
875
            : message.type;
876
      if (message.refAttrName != null && message.hasOwnProperty('refAttrName'))
877
        object.refAttrName = message.refAttrName;
878
      if (message.sparseTensor != null && message.hasOwnProperty('sparseTensor'))
879
        object.sparseTensor = $root.onnx.SparseTensorProto.toObject(message.sparseTensor, options);
880
      if (message.sparseTensors && message.sparseTensors.length) {
881
        object.sparseTensors = [];
882
        for (var j = 0; j < message.sparseTensors.length; ++j)
883
          object.sparseTensors[j] = $root.onnx.SparseTensorProto.toObject(message.sparseTensors[j], options);
884
      }
885
      return object;
886
    };
887

888
    /**
889
     * Converts this AttributeProto to JSON.
890
     * @function toJSON
891
     * @memberof onnx.AttributeProto
892
     * @instance
893
     * @returns {Object.<string,*>} JSON object
894
     */
895
    AttributeProto.prototype.toJSON = function toJSON() {
896
      return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
897
    };
898

899
    /**
900
     * Gets the default type url for AttributeProto
901
     * @function getTypeUrl
902
     * @memberof onnx.AttributeProto
903
     * @static
904
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
905
     * @returns {string} The default type url
906
     */
907
    AttributeProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
908
      if (typeUrlPrefix === undefined) {
909
        typeUrlPrefix = 'type.googleapis.com';
910
      }
911
      return typeUrlPrefix + '/onnx.AttributeProto';
912
    };
913

914
    /**
915
     * AttributeType enum.
916
     * @name onnx.AttributeProto.AttributeType
917
     * @enum {number}
918
     * @property {number} UNDEFINED=0 UNDEFINED value
919
     * @property {number} FLOAT=1 FLOAT value
920
     * @property {number} INT=2 INT value
921
     * @property {number} STRING=3 STRING value
922
     * @property {number} TENSOR=4 TENSOR value
923
     * @property {number} GRAPH=5 GRAPH value
924
     * @property {number} SPARSE_TENSOR=11 SPARSE_TENSOR value
925
     * @property {number} TYPE_PROTO=13 TYPE_PROTO value
926
     * @property {number} FLOATS=6 FLOATS value
927
     * @property {number} INTS=7 INTS value
928
     * @property {number} STRINGS=8 STRINGS value
929
     * @property {number} TENSORS=9 TENSORS value
930
     * @property {number} GRAPHS=10 GRAPHS value
931
     * @property {number} SPARSE_TENSORS=12 SPARSE_TENSORS value
932
     * @property {number} TYPE_PROTOS=14 TYPE_PROTOS value
933
     */
934
    AttributeProto.AttributeType = (function () {
935
      var valuesById = {},
936
        values = Object.create(valuesById);
937
      values[(valuesById[0] = 'UNDEFINED')] = 0;
938
      values[(valuesById[1] = 'FLOAT')] = 1;
939
      values[(valuesById[2] = 'INT')] = 2;
940
      values[(valuesById[3] = 'STRING')] = 3;
941
      values[(valuesById[4] = 'TENSOR')] = 4;
942
      values[(valuesById[5] = 'GRAPH')] = 5;
943
      values[(valuesById[11] = 'SPARSE_TENSOR')] = 11;
944
      values[(valuesById[13] = 'TYPE_PROTO')] = 13;
945
      values[(valuesById[6] = 'FLOATS')] = 6;
946
      values[(valuesById[7] = 'INTS')] = 7;
947
      values[(valuesById[8] = 'STRINGS')] = 8;
948
      values[(valuesById[9] = 'TENSORS')] = 9;
949
      values[(valuesById[10] = 'GRAPHS')] = 10;
950
      values[(valuesById[12] = 'SPARSE_TENSORS')] = 12;
951
      values[(valuesById[14] = 'TYPE_PROTOS')] = 14;
952
      return values;
953
    })();
954

955
    return AttributeProto;
956
  })();
957

958
  onnx.ValueInfoProto = (function () {
959
    /**
960
     * Properties of a ValueInfoProto.
961
     * @memberof onnx
962
     * @interface IValueInfoProto
963
     * @property {string|null} [name] ValueInfoProto name
964
     * @property {onnx.ITypeProto|null} [type] ValueInfoProto type
965
     * @property {string|null} [docString] ValueInfoProto docString
966
     */
967

968
    /**
969
     * Constructs a new ValueInfoProto.
970
     * @memberof onnx
971
     * @classdesc Represents a ValueInfoProto.
972
     * @implements IValueInfoProto
973
     * @constructor
974
     * @param {onnx.IValueInfoProto=} [properties] Properties to set
975
     */
976
    function ValueInfoProto(properties) {
977
      if (properties)
978
        for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
979
          if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
980
    }
981

982
    /**
983
     * ValueInfoProto name.
984
     * @member {string} name
985
     * @memberof onnx.ValueInfoProto
986
     * @instance
987
     */
988
    ValueInfoProto.prototype.name = '';
989

990
    /**
991
     * ValueInfoProto type.
992
     * @member {onnx.ITypeProto|null|undefined} type
993
     * @memberof onnx.ValueInfoProto
994
     * @instance
995
     */
996
    ValueInfoProto.prototype.type = null;
997

998
    /**
999
     * ValueInfoProto docString.
1000
     * @member {string} docString
1001
     * @memberof onnx.ValueInfoProto
1002
     * @instance
1003
     */
1004
    ValueInfoProto.prototype.docString = '';
1005

1006
    /**
1007
     * Creates a new ValueInfoProto instance using the specified properties.
1008
     * @function create
1009
     * @memberof onnx.ValueInfoProto
1010
     * @static
1011
     * @param {onnx.IValueInfoProto=} [properties] Properties to set
1012
     * @returns {onnx.ValueInfoProto} ValueInfoProto instance
1013
     */
1014
    ValueInfoProto.create = function create(properties) {
1015
      return new ValueInfoProto(properties);
1016
    };
1017

1018
    /**
1019
     * Encodes the specified ValueInfoProto message. Does not implicitly {@link onnx.ValueInfoProto.verify|verify} messages.
1020
     * @function encode
1021
     * @memberof onnx.ValueInfoProto
1022
     * @static
1023
     * @param {onnx.IValueInfoProto} message ValueInfoProto message or plain object to encode
1024
     * @param {$protobuf.Writer} [writer] Writer to encode to
1025
     * @returns {$protobuf.Writer} Writer
1026
     */
1027
    ValueInfoProto.encode = function encode(message, writer) {
1028
      if (!writer) writer = $Writer.create();
1029
      if (message.name != null && Object.hasOwnProperty.call(message, 'name'))
1030
        writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.name);
1031
      if (message.type != null && Object.hasOwnProperty.call(message, 'type'))
1032
        $root.onnx.TypeProto.encode(message.type, writer.uint32(/* id 2, wireType 2 =*/ 18).fork()).ldelim();
1033
      if (message.docString != null && Object.hasOwnProperty.call(message, 'docString'))
1034
        writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.docString);
1035
      return writer;
1036
    };
1037

1038
    /**
1039
     * Encodes the specified ValueInfoProto message, length delimited. Does not implicitly {@link onnx.ValueInfoProto.verify|verify} messages.
1040
     * @function encodeDelimited
1041
     * @memberof onnx.ValueInfoProto
1042
     * @static
1043
     * @param {onnx.IValueInfoProto} message ValueInfoProto message or plain object to encode
1044
     * @param {$protobuf.Writer} [writer] Writer to encode to
1045
     * @returns {$protobuf.Writer} Writer
1046
     */
1047
    ValueInfoProto.encodeDelimited = function encodeDelimited(message, writer) {
1048
      return this.encode(message, writer).ldelim();
1049
    };
1050

1051
    /**
1052
     * Decodes a ValueInfoProto message from the specified reader or buffer.
1053
     * @function decode
1054
     * @memberof onnx.ValueInfoProto
1055
     * @static
1056
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1057
     * @param {number} [length] Message length if known beforehand
1058
     * @returns {onnx.ValueInfoProto} ValueInfoProto
1059
     * @throws {Error} If the payload is not a reader or valid buffer
1060
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
1061
     */
1062
    ValueInfoProto.decode = function decode(reader, length) {
1063
      if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
1064
      var end = length === undefined ? reader.len : reader.pos + length,
1065
        message = new $root.onnx.ValueInfoProto();
1066
      while (reader.pos < end) {
1067
        var tag = reader.uint32();
1068
        switch (tag >>> 3) {
1069
          case 1: {
1070
            message.name = reader.string();
1071
            break;
1072
          }
1073
          case 2: {
1074
            message.type = $root.onnx.TypeProto.decode(reader, reader.uint32());
1075
            break;
1076
          }
1077
          case 3: {
1078
            message.docString = reader.string();
1079
            break;
1080
          }
1081
          default:
1082
            reader.skipType(tag & 7);
1083
            break;
1084
        }
1085
      }
1086
      return message;
1087
    };
1088

1089
    /**
1090
     * Decodes a ValueInfoProto message from the specified reader or buffer, length delimited.
1091
     * @function decodeDelimited
1092
     * @memberof onnx.ValueInfoProto
1093
     * @static
1094
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1095
     * @returns {onnx.ValueInfoProto} ValueInfoProto
1096
     * @throws {Error} If the payload is not a reader or valid buffer
1097
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
1098
     */
1099
    ValueInfoProto.decodeDelimited = function decodeDelimited(reader) {
1100
      if (!(reader instanceof $Reader)) reader = new $Reader(reader);
1101
      return this.decode(reader, reader.uint32());
1102
    };
1103

1104
    /**
1105
     * Verifies a ValueInfoProto message.
1106
     * @function verify
1107
     * @memberof onnx.ValueInfoProto
1108
     * @static
1109
     * @param {Object.<string,*>} message Plain object to verify
1110
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
1111
     */
1112
    ValueInfoProto.verify = function verify(message) {
1113
      if (typeof message !== 'object' || message === null) return 'object expected';
1114
      if (message.name != null && message.hasOwnProperty('name'))
1115
        if (!$util.isString(message.name)) return 'name: string expected';
1116
      if (message.type != null && message.hasOwnProperty('type')) {
1117
        var error = $root.onnx.TypeProto.verify(message.type);
1118
        if (error) return 'type.' + error;
1119
      }
1120
      if (message.docString != null && message.hasOwnProperty('docString'))
1121
        if (!$util.isString(message.docString)) return 'docString: string expected';
1122
      return null;
1123
    };
1124

1125
    /**
1126
     * Creates a ValueInfoProto message from a plain object. Also converts values to their respective internal types.
1127
     * @function fromObject
1128
     * @memberof onnx.ValueInfoProto
1129
     * @static
1130
     * @param {Object.<string,*>} object Plain object
1131
     * @returns {onnx.ValueInfoProto} ValueInfoProto
1132
     */
1133
    ValueInfoProto.fromObject = function fromObject(object) {
1134
      if (object instanceof $root.onnx.ValueInfoProto) return object;
1135
      var message = new $root.onnx.ValueInfoProto();
1136
      if (object.name != null) message.name = String(object.name);
1137
      if (object.type != null) {
1138
        if (typeof object.type !== 'object') throw TypeError('.onnx.ValueInfoProto.type: object expected');
1139
        message.type = $root.onnx.TypeProto.fromObject(object.type);
1140
      }
1141
      if (object.docString != null) message.docString = String(object.docString);
1142
      return message;
1143
    };
1144

1145
    /**
1146
     * Creates a plain object from a ValueInfoProto message. Also converts values to other types if specified.
1147
     * @function toObject
1148
     * @memberof onnx.ValueInfoProto
1149
     * @static
1150
     * @param {onnx.ValueInfoProto} message ValueInfoProto
1151
     * @param {$protobuf.IConversionOptions} [options] Conversion options
1152
     * @returns {Object.<string,*>} Plain object
1153
     */
1154
    ValueInfoProto.toObject = function toObject(message, options) {
1155
      if (!options) options = {};
1156
      var object = {};
1157
      if (options.defaults) {
1158
        object.name = '';
1159
        object.type = null;
1160
        object.docString = '';
1161
      }
1162
      if (message.name != null && message.hasOwnProperty('name')) object.name = message.name;
1163
      if (message.type != null && message.hasOwnProperty('type'))
1164
        object.type = $root.onnx.TypeProto.toObject(message.type, options);
1165
      if (message.docString != null && message.hasOwnProperty('docString')) object.docString = message.docString;
1166
      return object;
1167
    };
1168

1169
    /**
1170
     * Converts this ValueInfoProto to JSON.
1171
     * @function toJSON
1172
     * @memberof onnx.ValueInfoProto
1173
     * @instance
1174
     * @returns {Object.<string,*>} JSON object
1175
     */
1176
    ValueInfoProto.prototype.toJSON = function toJSON() {
1177
      return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1178
    };
1179

1180
    /**
1181
     * Gets the default type url for ValueInfoProto
1182
     * @function getTypeUrl
1183
     * @memberof onnx.ValueInfoProto
1184
     * @static
1185
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1186
     * @returns {string} The default type url
1187
     */
1188
    ValueInfoProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1189
      if (typeUrlPrefix === undefined) {
1190
        typeUrlPrefix = 'type.googleapis.com';
1191
      }
1192
      return typeUrlPrefix + '/onnx.ValueInfoProto';
1193
    };
1194

1195
    return ValueInfoProto;
1196
  })();
1197

1198
  onnx.NodeProto = (function () {
1199
    /**
1200
     * Properties of a NodeProto.
1201
     * @memberof onnx
1202
     * @interface INodeProto
1203
     * @property {Array.<string>|null} [input] NodeProto input
1204
     * @property {Array.<string>|null} [output] NodeProto output
1205
     * @property {string|null} [name] NodeProto name
1206
     * @property {string|null} [opType] NodeProto opType
1207
     * @property {string|null} [domain] NodeProto domain
1208
     * @property {Array.<onnx.IAttributeProto>|null} [attribute] NodeProto attribute
1209
     * @property {string|null} [docString] NodeProto docString
1210
     */
1211

1212
    /**
1213
     * Constructs a new NodeProto.
1214
     * @memberof onnx
1215
     * @classdesc Represents a NodeProto.
1216
     * @implements INodeProto
1217
     * @constructor
1218
     * @param {onnx.INodeProto=} [properties] Properties to set
1219
     */
1220
    function NodeProto(properties) {
1221
      this.input = [];
1222
      this.output = [];
1223
      this.attribute = [];
1224
      if (properties)
1225
        for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1226
          if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
1227
    }
1228

1229
    /**
1230
     * NodeProto input.
1231
     * @member {Array.<string>} input
1232
     * @memberof onnx.NodeProto
1233
     * @instance
1234
     */
1235
    NodeProto.prototype.input = $util.emptyArray;
1236

1237
    /**
1238
     * NodeProto output.
1239
     * @member {Array.<string>} output
1240
     * @memberof onnx.NodeProto
1241
     * @instance
1242
     */
1243
    NodeProto.prototype.output = $util.emptyArray;
1244

1245
    /**
1246
     * NodeProto name.
1247
     * @member {string} name
1248
     * @memberof onnx.NodeProto
1249
     * @instance
1250
     */
1251
    NodeProto.prototype.name = '';
1252

1253
    /**
1254
     * NodeProto opType.
1255
     * @member {string} opType
1256
     * @memberof onnx.NodeProto
1257
     * @instance
1258
     */
1259
    NodeProto.prototype.opType = '';
1260

1261
    /**
1262
     * NodeProto domain.
1263
     * @member {string} domain
1264
     * @memberof onnx.NodeProto
1265
     * @instance
1266
     */
1267
    NodeProto.prototype.domain = '';
1268

1269
    /**
1270
     * NodeProto attribute.
1271
     * @member {Array.<onnx.IAttributeProto>} attribute
1272
     * @memberof onnx.NodeProto
1273
     * @instance
1274
     */
1275
    NodeProto.prototype.attribute = $util.emptyArray;
1276

1277
    /**
1278
     * NodeProto docString.
1279
     * @member {string} docString
1280
     * @memberof onnx.NodeProto
1281
     * @instance
1282
     */
1283
    NodeProto.prototype.docString = '';
1284

1285
    /**
1286
     * Creates a new NodeProto instance using the specified properties.
1287
     * @function create
1288
     * @memberof onnx.NodeProto
1289
     * @static
1290
     * @param {onnx.INodeProto=} [properties] Properties to set
1291
     * @returns {onnx.NodeProto} NodeProto instance
1292
     */
1293
    NodeProto.create = function create(properties) {
1294
      return new NodeProto(properties);
1295
    };
1296

1297
    /**
1298
     * Encodes the specified NodeProto message. Does not implicitly {@link onnx.NodeProto.verify|verify} messages.
1299
     * @function encode
1300
     * @memberof onnx.NodeProto
1301
     * @static
1302
     * @param {onnx.INodeProto} message NodeProto message or plain object to encode
1303
     * @param {$protobuf.Writer} [writer] Writer to encode to
1304
     * @returns {$protobuf.Writer} Writer
1305
     */
1306
    NodeProto.encode = function encode(message, writer) {
1307
      if (!writer) writer = $Writer.create();
1308
      if (message.input != null && message.input.length)
1309
        for (var i = 0; i < message.input.length; ++i)
1310
          writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.input[i]);
1311
      if (message.output != null && message.output.length)
1312
        for (var i = 0; i < message.output.length; ++i)
1313
          writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.output[i]);
1314
      if (message.name != null && Object.hasOwnProperty.call(message, 'name'))
1315
        writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.name);
1316
      if (message.opType != null && Object.hasOwnProperty.call(message, 'opType'))
1317
        writer.uint32(/* id 4, wireType 2 =*/ 34).string(message.opType);
1318
      if (message.attribute != null && message.attribute.length)
1319
        for (var i = 0; i < message.attribute.length; ++i)
1320
          $root.onnx.AttributeProto.encode(
1321
            message.attribute[i],
1322
            writer.uint32(/* id 5, wireType 2 =*/ 42).fork(),
1323
          ).ldelim();
1324
      if (message.docString != null && Object.hasOwnProperty.call(message, 'docString'))
1325
        writer.uint32(/* id 6, wireType 2 =*/ 50).string(message.docString);
1326
      if (message.domain != null && Object.hasOwnProperty.call(message, 'domain'))
1327
        writer.uint32(/* id 7, wireType 2 =*/ 58).string(message.domain);
1328
      return writer;
1329
    };
1330

1331
    /**
1332
     * Encodes the specified NodeProto message, length delimited. Does not implicitly {@link onnx.NodeProto.verify|verify} messages.
1333
     * @function encodeDelimited
1334
     * @memberof onnx.NodeProto
1335
     * @static
1336
     * @param {onnx.INodeProto} message NodeProto message or plain object to encode
1337
     * @param {$protobuf.Writer} [writer] Writer to encode to
1338
     * @returns {$protobuf.Writer} Writer
1339
     */
1340
    NodeProto.encodeDelimited = function encodeDelimited(message, writer) {
1341
      return this.encode(message, writer).ldelim();
1342
    };
1343

1344
    /**
1345
     * Decodes a NodeProto message from the specified reader or buffer.
1346
     * @function decode
1347
     * @memberof onnx.NodeProto
1348
     * @static
1349
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1350
     * @param {number} [length] Message length if known beforehand
1351
     * @returns {onnx.NodeProto} NodeProto
1352
     * @throws {Error} If the payload is not a reader or valid buffer
1353
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
1354
     */
1355
    NodeProto.decode = function decode(reader, length) {
1356
      if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
1357
      var end = length === undefined ? reader.len : reader.pos + length,
1358
        message = new $root.onnx.NodeProto();
1359
      while (reader.pos < end) {
1360
        var tag = reader.uint32();
1361
        switch (tag >>> 3) {
1362
          case 1: {
1363
            if (!(message.input && message.input.length)) message.input = [];
1364
            message.input.push(reader.string());
1365
            break;
1366
          }
1367
          case 2: {
1368
            if (!(message.output && message.output.length)) message.output = [];
1369
            message.output.push(reader.string());
1370
            break;
1371
          }
1372
          case 3: {
1373
            message.name = reader.string();
1374
            break;
1375
          }
1376
          case 4: {
1377
            message.opType = reader.string();
1378
            break;
1379
          }
1380
          case 7: {
1381
            message.domain = reader.string();
1382
            break;
1383
          }
1384
          case 5: {
1385
            if (!(message.attribute && message.attribute.length)) message.attribute = [];
1386
            message.attribute.push($root.onnx.AttributeProto.decode(reader, reader.uint32()));
1387
            break;
1388
          }
1389
          case 6: {
1390
            message.docString = reader.string();
1391
            break;
1392
          }
1393
          default:
1394
            reader.skipType(tag & 7);
1395
            break;
1396
        }
1397
      }
1398
      return message;
1399
    };
1400

1401
    /**
1402
     * Decodes a NodeProto message from the specified reader or buffer, length delimited.
1403
     * @function decodeDelimited
1404
     * @memberof onnx.NodeProto
1405
     * @static
1406
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1407
     * @returns {onnx.NodeProto} NodeProto
1408
     * @throws {Error} If the payload is not a reader or valid buffer
1409
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
1410
     */
1411
    NodeProto.decodeDelimited = function decodeDelimited(reader) {
1412
      if (!(reader instanceof $Reader)) reader = new $Reader(reader);
1413
      return this.decode(reader, reader.uint32());
1414
    };
1415

1416
    /**
1417
     * Verifies a NodeProto message.
1418
     * @function verify
1419
     * @memberof onnx.NodeProto
1420
     * @static
1421
     * @param {Object.<string,*>} message Plain object to verify
1422
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
1423
     */
1424
    NodeProto.verify = function verify(message) {
1425
      if (typeof message !== 'object' || message === null) return 'object expected';
1426
      if (message.input != null && message.hasOwnProperty('input')) {
1427
        if (!Array.isArray(message.input)) return 'input: array expected';
1428
        for (var i = 0; i < message.input.length; ++i)
1429
          if (!$util.isString(message.input[i])) return 'input: string[] expected';
1430
      }
1431
      if (message.output != null && message.hasOwnProperty('output')) {
1432
        if (!Array.isArray(message.output)) return 'output: array expected';
1433
        for (var i = 0; i < message.output.length; ++i)
1434
          if (!$util.isString(message.output[i])) return 'output: string[] expected';
1435
      }
1436
      if (message.name != null && message.hasOwnProperty('name'))
1437
        if (!$util.isString(message.name)) return 'name: string expected';
1438
      if (message.opType != null && message.hasOwnProperty('opType'))
1439
        if (!$util.isString(message.opType)) return 'opType: string expected';
1440
      if (message.domain != null && message.hasOwnProperty('domain'))
1441
        if (!$util.isString(message.domain)) return 'domain: string expected';
1442
      if (message.attribute != null && message.hasOwnProperty('attribute')) {
1443
        if (!Array.isArray(message.attribute)) return 'attribute: array expected';
1444
        for (var i = 0; i < message.attribute.length; ++i) {
1445
          var error = $root.onnx.AttributeProto.verify(message.attribute[i]);
1446
          if (error) return 'attribute.' + error;
1447
        }
1448
      }
1449
      if (message.docString != null && message.hasOwnProperty('docString'))
1450
        if (!$util.isString(message.docString)) return 'docString: string expected';
1451
      return null;
1452
    };
1453

1454
    /**
1455
     * Creates a NodeProto message from a plain object. Also converts values to their respective internal types.
1456
     * @function fromObject
1457
     * @memberof onnx.NodeProto
1458
     * @static
1459
     * @param {Object.<string,*>} object Plain object
1460
     * @returns {onnx.NodeProto} NodeProto
1461
     */
1462
    NodeProto.fromObject = function fromObject(object) {
1463
      if (object instanceof $root.onnx.NodeProto) return object;
1464
      var message = new $root.onnx.NodeProto();
1465
      if (object.input) {
1466
        if (!Array.isArray(object.input)) throw TypeError('.onnx.NodeProto.input: array expected');
1467
        message.input = [];
1468
        for (var i = 0; i < object.input.length; ++i) message.input[i] = String(object.input[i]);
1469
      }
1470
      if (object.output) {
1471
        if (!Array.isArray(object.output)) throw TypeError('.onnx.NodeProto.output: array expected');
1472
        message.output = [];
1473
        for (var i = 0; i < object.output.length; ++i) message.output[i] = String(object.output[i]);
1474
      }
1475
      if (object.name != null) message.name = String(object.name);
1476
      if (object.opType != null) message.opType = String(object.opType);
1477
      if (object.domain != null) message.domain = String(object.domain);
1478
      if (object.attribute) {
1479
        if (!Array.isArray(object.attribute)) throw TypeError('.onnx.NodeProto.attribute: array expected');
1480
        message.attribute = [];
1481
        for (var i = 0; i < object.attribute.length; ++i) {
1482
          if (typeof object.attribute[i] !== 'object') throw TypeError('.onnx.NodeProto.attribute: object expected');
1483
          message.attribute[i] = $root.onnx.AttributeProto.fromObject(object.attribute[i]);
1484
        }
1485
      }
1486
      if (object.docString != null) message.docString = String(object.docString);
1487
      return message;
1488
    };
1489

1490
    /**
1491
     * Creates a plain object from a NodeProto message. Also converts values to other types if specified.
1492
     * @function toObject
1493
     * @memberof onnx.NodeProto
1494
     * @static
1495
     * @param {onnx.NodeProto} message NodeProto
1496
     * @param {$protobuf.IConversionOptions} [options] Conversion options
1497
     * @returns {Object.<string,*>} Plain object
1498
     */
1499
    NodeProto.toObject = function toObject(message, options) {
1500
      if (!options) options = {};
1501
      var object = {};
1502
      if (options.arrays || options.defaults) {
1503
        object.input = [];
1504
        object.output = [];
1505
        object.attribute = [];
1506
      }
1507
      if (options.defaults) {
1508
        object.name = '';
1509
        object.opType = '';
1510
        object.docString = '';
1511
        object.domain = '';
1512
      }
1513
      if (message.input && message.input.length) {
1514
        object.input = [];
1515
        for (var j = 0; j < message.input.length; ++j) object.input[j] = message.input[j];
1516
      }
1517
      if (message.output && message.output.length) {
1518
        object.output = [];
1519
        for (var j = 0; j < message.output.length; ++j) object.output[j] = message.output[j];
1520
      }
1521
      if (message.name != null && message.hasOwnProperty('name')) object.name = message.name;
1522
      if (message.opType != null && message.hasOwnProperty('opType')) object.opType = message.opType;
1523
      if (message.attribute && message.attribute.length) {
1524
        object.attribute = [];
1525
        for (var j = 0; j < message.attribute.length; ++j)
1526
          object.attribute[j] = $root.onnx.AttributeProto.toObject(message.attribute[j], options);
1527
      }
1528
      if (message.docString != null && message.hasOwnProperty('docString')) object.docString = message.docString;
1529
      if (message.domain != null && message.hasOwnProperty('domain')) object.domain = message.domain;
1530
      return object;
1531
    };
1532

1533
    /**
1534
     * Converts this NodeProto to JSON.
1535
     * @function toJSON
1536
     * @memberof onnx.NodeProto
1537
     * @instance
1538
     * @returns {Object.<string,*>} JSON object
1539
     */
1540
    NodeProto.prototype.toJSON = function toJSON() {
1541
      return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1542
    };
1543

1544
    /**
1545
     * Gets the default type url for NodeProto
1546
     * @function getTypeUrl
1547
     * @memberof onnx.NodeProto
1548
     * @static
1549
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1550
     * @returns {string} The default type url
1551
     */
1552
    NodeProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1553
      if (typeUrlPrefix === undefined) {
1554
        typeUrlPrefix = 'type.googleapis.com';
1555
      }
1556
      return typeUrlPrefix + '/onnx.NodeProto';
1557
    };
1558

1559
    return NodeProto;
1560
  })();
1561

1562
  onnx.TrainingInfoProto = (function () {
1563
    /**
1564
     * Properties of a TrainingInfoProto.
1565
     * @memberof onnx
1566
     * @interface ITrainingInfoProto
1567
     * @property {onnx.IGraphProto|null} [initialization] TrainingInfoProto initialization
1568
     * @property {onnx.IGraphProto|null} [algorithm] TrainingInfoProto algorithm
1569
     * @property {Array.<onnx.IStringStringEntryProto>|null} [initializationBinding] TrainingInfoProto initializationBinding
1570
     * @property {Array.<onnx.IStringStringEntryProto>|null} [updateBinding] TrainingInfoProto updateBinding
1571
     */
1572

1573
    /**
1574
     * Constructs a new TrainingInfoProto.
1575
     * @memberof onnx
1576
     * @classdesc Represents a TrainingInfoProto.
1577
     * @implements ITrainingInfoProto
1578
     * @constructor
1579
     * @param {onnx.ITrainingInfoProto=} [properties] Properties to set
1580
     */
1581
    function TrainingInfoProto(properties) {
1582
      this.initializationBinding = [];
1583
      this.updateBinding = [];
1584
      if (properties)
1585
        for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1586
          if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
1587
    }
1588

1589
    /**
1590
     * TrainingInfoProto initialization.
1591
     * @member {onnx.IGraphProto|null|undefined} initialization
1592
     * @memberof onnx.TrainingInfoProto
1593
     * @instance
1594
     */
1595
    TrainingInfoProto.prototype.initialization = null;
1596

1597
    /**
1598
     * TrainingInfoProto algorithm.
1599
     * @member {onnx.IGraphProto|null|undefined} algorithm
1600
     * @memberof onnx.TrainingInfoProto
1601
     * @instance
1602
     */
1603
    TrainingInfoProto.prototype.algorithm = null;
1604

1605
    /**
1606
     * TrainingInfoProto initializationBinding.
1607
     * @member {Array.<onnx.IStringStringEntryProto>} initializationBinding
1608
     * @memberof onnx.TrainingInfoProto
1609
     * @instance
1610
     */
1611
    TrainingInfoProto.prototype.initializationBinding = $util.emptyArray;
1612

1613
    /**
1614
     * TrainingInfoProto updateBinding.
1615
     * @member {Array.<onnx.IStringStringEntryProto>} updateBinding
1616
     * @memberof onnx.TrainingInfoProto
1617
     * @instance
1618
     */
1619
    TrainingInfoProto.prototype.updateBinding = $util.emptyArray;
1620

1621
    /**
1622
     * Creates a new TrainingInfoProto instance using the specified properties.
1623
     * @function create
1624
     * @memberof onnx.TrainingInfoProto
1625
     * @static
1626
     * @param {onnx.ITrainingInfoProto=} [properties] Properties to set
1627
     * @returns {onnx.TrainingInfoProto} TrainingInfoProto instance
1628
     */
1629
    TrainingInfoProto.create = function create(properties) {
1630
      return new TrainingInfoProto(properties);
1631
    };
1632

1633
    /**
1634
     * Encodes the specified TrainingInfoProto message. Does not implicitly {@link onnx.TrainingInfoProto.verify|verify} messages.
1635
     * @function encode
1636
     * @memberof onnx.TrainingInfoProto
1637
     * @static
1638
     * @param {onnx.ITrainingInfoProto} message TrainingInfoProto message or plain object to encode
1639
     * @param {$protobuf.Writer} [writer] Writer to encode to
1640
     * @returns {$protobuf.Writer} Writer
1641
     */
1642
    TrainingInfoProto.encode = function encode(message, writer) {
1643
      if (!writer) writer = $Writer.create();
1644
      if (message.initialization != null && Object.hasOwnProperty.call(message, 'initialization'))
1645
        $root.onnx.GraphProto.encode(message.initialization, writer.uint32(/* id 1, wireType 2 =*/ 10).fork()).ldelim();
1646
      if (message.algorithm != null && Object.hasOwnProperty.call(message, 'algorithm'))
1647
        $root.onnx.GraphProto.encode(message.algorithm, writer.uint32(/* id 2, wireType 2 =*/ 18).fork()).ldelim();
1648
      if (message.initializationBinding != null && message.initializationBinding.length)
1649
        for (var i = 0; i < message.initializationBinding.length; ++i)
1650
          $root.onnx.StringStringEntryProto.encode(
1651
            message.initializationBinding[i],
1652
            writer.uint32(/* id 3, wireType 2 =*/ 26).fork(),
1653
          ).ldelim();
1654
      if (message.updateBinding != null && message.updateBinding.length)
1655
        for (var i = 0; i < message.updateBinding.length; ++i)
1656
          $root.onnx.StringStringEntryProto.encode(
1657
            message.updateBinding[i],
1658
            writer.uint32(/* id 4, wireType 2 =*/ 34).fork(),
1659
          ).ldelim();
1660
      return writer;
1661
    };
1662

1663
    /**
1664
     * Encodes the specified TrainingInfoProto message, length delimited. Does not implicitly {@link onnx.TrainingInfoProto.verify|verify} messages.
1665
     * @function encodeDelimited
1666
     * @memberof onnx.TrainingInfoProto
1667
     * @static
1668
     * @param {onnx.ITrainingInfoProto} message TrainingInfoProto message or plain object to encode
1669
     * @param {$protobuf.Writer} [writer] Writer to encode to
1670
     * @returns {$protobuf.Writer} Writer
1671
     */
1672
    TrainingInfoProto.encodeDelimited = function encodeDelimited(message, writer) {
1673
      return this.encode(message, writer).ldelim();
1674
    };
1675

1676
    /**
1677
     * Decodes a TrainingInfoProto message from the specified reader or buffer.
1678
     * @function decode
1679
     * @memberof onnx.TrainingInfoProto
1680
     * @static
1681
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1682
     * @param {number} [length] Message length if known beforehand
1683
     * @returns {onnx.TrainingInfoProto} TrainingInfoProto
1684
     * @throws {Error} If the payload is not a reader or valid buffer
1685
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
1686
     */
1687
    TrainingInfoProto.decode = function decode(reader, length) {
1688
      if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
1689
      var end = length === undefined ? reader.len : reader.pos + length,
1690
        message = new $root.onnx.TrainingInfoProto();
1691
      while (reader.pos < end) {
1692
        var tag = reader.uint32();
1693
        switch (tag >>> 3) {
1694
          case 1: {
1695
            message.initialization = $root.onnx.GraphProto.decode(reader, reader.uint32());
1696
            break;
1697
          }
1698
          case 2: {
1699
            message.algorithm = $root.onnx.GraphProto.decode(reader, reader.uint32());
1700
            break;
1701
          }
1702
          case 3: {
1703
            if (!(message.initializationBinding && message.initializationBinding.length))
1704
              message.initializationBinding = [];
1705
            message.initializationBinding.push($root.onnx.StringStringEntryProto.decode(reader, reader.uint32()));
1706
            break;
1707
          }
1708
          case 4: {
1709
            if (!(message.updateBinding && message.updateBinding.length)) message.updateBinding = [];
1710
            message.updateBinding.push($root.onnx.StringStringEntryProto.decode(reader, reader.uint32()));
1711
            break;
1712
          }
1713
          default:
1714
            reader.skipType(tag & 7);
1715
            break;
1716
        }
1717
      }
1718
      return message;
1719
    };
1720

1721
    /**
1722
     * Decodes a TrainingInfoProto message from the specified reader or buffer, length delimited.
1723
     * @function decodeDelimited
1724
     * @memberof onnx.TrainingInfoProto
1725
     * @static
1726
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1727
     * @returns {onnx.TrainingInfoProto} TrainingInfoProto
1728
     * @throws {Error} If the payload is not a reader or valid buffer
1729
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
1730
     */
1731
    TrainingInfoProto.decodeDelimited = function decodeDelimited(reader) {
1732
      if (!(reader instanceof $Reader)) reader = new $Reader(reader);
1733
      return this.decode(reader, reader.uint32());
1734
    };
1735

1736
    /**
1737
     * Verifies a TrainingInfoProto message.
1738
     * @function verify
1739
     * @memberof onnx.TrainingInfoProto
1740
     * @static
1741
     * @param {Object.<string,*>} message Plain object to verify
1742
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
1743
     */
1744
    TrainingInfoProto.verify = function verify(message) {
1745
      if (typeof message !== 'object' || message === null) return 'object expected';
1746
      if (message.initialization != null && message.hasOwnProperty('initialization')) {
1747
        var error = $root.onnx.GraphProto.verify(message.initialization);
1748
        if (error) return 'initialization.' + error;
1749
      }
1750
      if (message.algorithm != null && message.hasOwnProperty('algorithm')) {
1751
        var error = $root.onnx.GraphProto.verify(message.algorithm);
1752
        if (error) return 'algorithm.' + error;
1753
      }
1754
      if (message.initializationBinding != null && message.hasOwnProperty('initializationBinding')) {
1755
        if (!Array.isArray(message.initializationBinding)) return 'initializationBinding: array expected';
1756
        for (var i = 0; i < message.initializationBinding.length; ++i) {
1757
          var error = $root.onnx.StringStringEntryProto.verify(message.initializationBinding[i]);
1758
          if (error) return 'initializationBinding.' + error;
1759
        }
1760
      }
1761
      if (message.updateBinding != null && message.hasOwnProperty('updateBinding')) {
1762
        if (!Array.isArray(message.updateBinding)) return 'updateBinding: array expected';
1763
        for (var i = 0; i < message.updateBinding.length; ++i) {
1764
          var error = $root.onnx.StringStringEntryProto.verify(message.updateBinding[i]);
1765
          if (error) return 'updateBinding.' + error;
1766
        }
1767
      }
1768
      return null;
1769
    };
1770

1771
    /**
1772
     * Creates a TrainingInfoProto message from a plain object. Also converts values to their respective internal types.
1773
     * @function fromObject
1774
     * @memberof onnx.TrainingInfoProto
1775
     * @static
1776
     * @param {Object.<string,*>} object Plain object
1777
     * @returns {onnx.TrainingInfoProto} TrainingInfoProto
1778
     */
1779
    TrainingInfoProto.fromObject = function fromObject(object) {
1780
      if (object instanceof $root.onnx.TrainingInfoProto) return object;
1781
      var message = new $root.onnx.TrainingInfoProto();
1782
      if (object.initialization != null) {
1783
        if (typeof object.initialization !== 'object')
1784
          throw TypeError('.onnx.TrainingInfoProto.initialization: object expected');
1785
        message.initialization = $root.onnx.GraphProto.fromObject(object.initialization);
1786
      }
1787
      if (object.algorithm != null) {
1788
        if (typeof object.algorithm !== 'object') throw TypeError('.onnx.TrainingInfoProto.algorithm: object expected');
1789
        message.algorithm = $root.onnx.GraphProto.fromObject(object.algorithm);
1790
      }
1791
      if (object.initializationBinding) {
1792
        if (!Array.isArray(object.initializationBinding))
1793
          throw TypeError('.onnx.TrainingInfoProto.initializationBinding: array expected');
1794
        message.initializationBinding = [];
1795
        for (var i = 0; i < object.initializationBinding.length; ++i) {
1796
          if (typeof object.initializationBinding[i] !== 'object')
1797
            throw TypeError('.onnx.TrainingInfoProto.initializationBinding: object expected');
1798
          message.initializationBinding[i] = $root.onnx.StringStringEntryProto.fromObject(
1799
            object.initializationBinding[i],
1800
          );
1801
        }
1802
      }
1803
      if (object.updateBinding) {
1804
        if (!Array.isArray(object.updateBinding))
1805
          throw TypeError('.onnx.TrainingInfoProto.updateBinding: array expected');
1806
        message.updateBinding = [];
1807
        for (var i = 0; i < object.updateBinding.length; ++i) {
1808
          if (typeof object.updateBinding[i] !== 'object')
1809
            throw TypeError('.onnx.TrainingInfoProto.updateBinding: object expected');
1810
          message.updateBinding[i] = $root.onnx.StringStringEntryProto.fromObject(object.updateBinding[i]);
1811
        }
1812
      }
1813
      return message;
1814
    };
1815

1816
    /**
1817
     * Creates a plain object from a TrainingInfoProto message. Also converts values to other types if specified.
1818
     * @function toObject
1819
     * @memberof onnx.TrainingInfoProto
1820
     * @static
1821
     * @param {onnx.TrainingInfoProto} message TrainingInfoProto
1822
     * @param {$protobuf.IConversionOptions} [options] Conversion options
1823
     * @returns {Object.<string,*>} Plain object
1824
     */
1825
    TrainingInfoProto.toObject = function toObject(message, options) {
1826
      if (!options) options = {};
1827
      var object = {};
1828
      if (options.arrays || options.defaults) {
1829
        object.initializationBinding = [];
1830
        object.updateBinding = [];
1831
      }
1832
      if (options.defaults) {
1833
        object.initialization = null;
1834
        object.algorithm = null;
1835
      }
1836
      if (message.initialization != null && message.hasOwnProperty('initialization'))
1837
        object.initialization = $root.onnx.GraphProto.toObject(message.initialization, options);
1838
      if (message.algorithm != null && message.hasOwnProperty('algorithm'))
1839
        object.algorithm = $root.onnx.GraphProto.toObject(message.algorithm, options);
1840
      if (message.initializationBinding && message.initializationBinding.length) {
1841
        object.initializationBinding = [];
1842
        for (var j = 0; j < message.initializationBinding.length; ++j)
1843
          object.initializationBinding[j] = $root.onnx.StringStringEntryProto.toObject(
1844
            message.initializationBinding[j],
1845
            options,
1846
          );
1847
      }
1848
      if (message.updateBinding && message.updateBinding.length) {
1849
        object.updateBinding = [];
1850
        for (var j = 0; j < message.updateBinding.length; ++j)
1851
          object.updateBinding[j] = $root.onnx.StringStringEntryProto.toObject(message.updateBinding[j], options);
1852
      }
1853
      return object;
1854
    };
1855

1856
    /**
1857
     * Converts this TrainingInfoProto to JSON.
1858
     * @function toJSON
1859
     * @memberof onnx.TrainingInfoProto
1860
     * @instance
1861
     * @returns {Object.<string,*>} JSON object
1862
     */
1863
    TrainingInfoProto.prototype.toJSON = function toJSON() {
1864
      return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1865
    };
1866

1867
    /**
1868
     * Gets the default type url for TrainingInfoProto
1869
     * @function getTypeUrl
1870
     * @memberof onnx.TrainingInfoProto
1871
     * @static
1872
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1873
     * @returns {string} The default type url
1874
     */
1875
    TrainingInfoProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1876
      if (typeUrlPrefix === undefined) {
1877
        typeUrlPrefix = 'type.googleapis.com';
1878
      }
1879
      return typeUrlPrefix + '/onnx.TrainingInfoProto';
1880
    };
1881

1882
    return TrainingInfoProto;
1883
  })();
1884

1885
  onnx.ModelProto = (function () {
1886
    /**
1887
     * Properties of a ModelProto.
1888
     * @memberof onnx
1889
     * @interface IModelProto
1890
     * @property {number|Long|null} [irVersion] ModelProto irVersion
1891
     * @property {Array.<onnx.IOperatorSetIdProto>|null} [opsetImport] ModelProto opsetImport
1892
     * @property {string|null} [producerName] ModelProto producerName
1893
     * @property {string|null} [producerVersion] ModelProto producerVersion
1894
     * @property {string|null} [domain] ModelProto domain
1895
     * @property {number|Long|null} [modelVersion] ModelProto modelVersion
1896
     * @property {string|null} [docString] ModelProto docString
1897
     * @property {onnx.IGraphProto|null} [graph] ModelProto graph
1898
     * @property {Array.<onnx.IStringStringEntryProto>|null} [metadataProps] ModelProto metadataProps
1899
     * @property {Array.<onnx.ITrainingInfoProto>|null} [trainingInfo] ModelProto trainingInfo
1900
     * @property {Array.<onnx.IFunctionProto>|null} [functions] ModelProto functions
1901
     */
1902

1903
    /**
1904
     * Constructs a new ModelProto.
1905
     * @memberof onnx
1906
     * @classdesc Represents a ModelProto.
1907
     * @implements IModelProto
1908
     * @constructor
1909
     * @param {onnx.IModelProto=} [properties] Properties to set
1910
     */
1911
    function ModelProto(properties) {
1912
      this.opsetImport = [];
1913
      this.metadataProps = [];
1914
      this.trainingInfo = [];
1915
      this.functions = [];
1916
      if (properties)
1917
        for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1918
          if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
1919
    }
1920

1921
    /**
1922
     * ModelProto irVersion.
1923
     * @member {number|Long} irVersion
1924
     * @memberof onnx.ModelProto
1925
     * @instance
1926
     */
1927
    ModelProto.prototype.irVersion = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
1928

1929
    /**
1930
     * ModelProto opsetImport.
1931
     * @member {Array.<onnx.IOperatorSetIdProto>} opsetImport
1932
     * @memberof onnx.ModelProto
1933
     * @instance
1934
     */
1935
    ModelProto.prototype.opsetImport = $util.emptyArray;
1936

1937
    /**
1938
     * ModelProto producerName.
1939
     * @member {string} producerName
1940
     * @memberof onnx.ModelProto
1941
     * @instance
1942
     */
1943
    ModelProto.prototype.producerName = '';
1944

1945
    /**
1946
     * ModelProto producerVersion.
1947
     * @member {string} producerVersion
1948
     * @memberof onnx.ModelProto
1949
     * @instance
1950
     */
1951
    ModelProto.prototype.producerVersion = '';
1952

1953
    /**
1954
     * ModelProto domain.
1955
     * @member {string} domain
1956
     * @memberof onnx.ModelProto
1957
     * @instance
1958
     */
1959
    ModelProto.prototype.domain = '';
1960

1961
    /**
1962
     * ModelProto modelVersion.
1963
     * @member {number|Long} modelVersion
1964
     * @memberof onnx.ModelProto
1965
     * @instance
1966
     */
1967
    ModelProto.prototype.modelVersion = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
1968

1969
    /**
1970
     * ModelProto docString.
1971
     * @member {string} docString
1972
     * @memberof onnx.ModelProto
1973
     * @instance
1974
     */
1975
    ModelProto.prototype.docString = '';
1976

1977
    /**
1978
     * ModelProto graph.
1979
     * @member {onnx.IGraphProto|null|undefined} graph
1980
     * @memberof onnx.ModelProto
1981
     * @instance
1982
     */
1983
    ModelProto.prototype.graph = null;
1984

1985
    /**
1986
     * ModelProto metadataProps.
1987
     * @member {Array.<onnx.IStringStringEntryProto>} metadataProps
1988
     * @memberof onnx.ModelProto
1989
     * @instance
1990
     */
1991
    ModelProto.prototype.metadataProps = $util.emptyArray;
1992

1993
    /**
1994
     * ModelProto trainingInfo.
1995
     * @member {Array.<onnx.ITrainingInfoProto>} trainingInfo
1996
     * @memberof onnx.ModelProto
1997
     * @instance
1998
     */
1999
    ModelProto.prototype.trainingInfo = $util.emptyArray;
2000

2001
    /**
2002
     * ModelProto functions.
2003
     * @member {Array.<onnx.IFunctionProto>} functions
2004
     * @memberof onnx.ModelProto
2005
     * @instance
2006
     */
2007
    ModelProto.prototype.functions = $util.emptyArray;
2008

2009
    /**
2010
     * Creates a new ModelProto instance using the specified properties.
2011
     * @function create
2012
     * @memberof onnx.ModelProto
2013
     * @static
2014
     * @param {onnx.IModelProto=} [properties] Properties to set
2015
     * @returns {onnx.ModelProto} ModelProto instance
2016
     */
2017
    ModelProto.create = function create(properties) {
2018
      return new ModelProto(properties);
2019
    };
2020

2021
    /**
2022
     * Encodes the specified ModelProto message. Does not implicitly {@link onnx.ModelProto.verify|verify} messages.
2023
     * @function encode
2024
     * @memberof onnx.ModelProto
2025
     * @static
2026
     * @param {onnx.IModelProto} message ModelProto message or plain object to encode
2027
     * @param {$protobuf.Writer} [writer] Writer to encode to
2028
     * @returns {$protobuf.Writer} Writer
2029
     */
2030
    ModelProto.encode = function encode(message, writer) {
2031
      if (!writer) writer = $Writer.create();
2032
      if (message.irVersion != null && Object.hasOwnProperty.call(message, 'irVersion'))
2033
        writer.uint32(/* id 1, wireType 0 =*/ 8).int64(message.irVersion);
2034
      if (message.producerName != null && Object.hasOwnProperty.call(message, 'producerName'))
2035
        writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.producerName);
2036
      if (message.producerVersion != null && Object.hasOwnProperty.call(message, 'producerVersion'))
2037
        writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.producerVersion);
2038
      if (message.domain != null && Object.hasOwnProperty.call(message, 'domain'))
2039
        writer.uint32(/* id 4, wireType 2 =*/ 34).string(message.domain);
2040
      if (message.modelVersion != null && Object.hasOwnProperty.call(message, 'modelVersion'))
2041
        writer.uint32(/* id 5, wireType 0 =*/ 40).int64(message.modelVersion);
2042
      if (message.docString != null && Object.hasOwnProperty.call(message, 'docString'))
2043
        writer.uint32(/* id 6, wireType 2 =*/ 50).string(message.docString);
2044
      if (message.graph != null && Object.hasOwnProperty.call(message, 'graph'))
2045
        $root.onnx.GraphProto.encode(message.graph, writer.uint32(/* id 7, wireType 2 =*/ 58).fork()).ldelim();
2046
      if (message.opsetImport != null && message.opsetImport.length)
2047
        for (var i = 0; i < message.opsetImport.length; ++i)
2048
          $root.onnx.OperatorSetIdProto.encode(
2049
            message.opsetImport[i],
2050
            writer.uint32(/* id 8, wireType 2 =*/ 66).fork(),
2051
          ).ldelim();
2052
      if (message.metadataProps != null && message.metadataProps.length)
2053
        for (var i = 0; i < message.metadataProps.length; ++i)
2054
          $root.onnx.StringStringEntryProto.encode(
2055
            message.metadataProps[i],
2056
            writer.uint32(/* id 14, wireType 2 =*/ 114).fork(),
2057
          ).ldelim();
2058
      if (message.trainingInfo != null && message.trainingInfo.length)
2059
        for (var i = 0; i < message.trainingInfo.length; ++i)
2060
          $root.onnx.TrainingInfoProto.encode(
2061
            message.trainingInfo[i],
2062
            writer.uint32(/* id 20, wireType 2 =*/ 162).fork(),
2063
          ).ldelim();
2064
      if (message.functions != null && message.functions.length)
2065
        for (var i = 0; i < message.functions.length; ++i)
2066
          $root.onnx.FunctionProto.encode(
2067
            message.functions[i],
2068
            writer.uint32(/* id 25, wireType 2 =*/ 202).fork(),
2069
          ).ldelim();
2070
      return writer;
2071
    };
2072

2073
    /**
2074
     * Encodes the specified ModelProto message, length delimited. Does not implicitly {@link onnx.ModelProto.verify|verify} messages.
2075
     * @function encodeDelimited
2076
     * @memberof onnx.ModelProto
2077
     * @static
2078
     * @param {onnx.IModelProto} message ModelProto message or plain object to encode
2079
     * @param {$protobuf.Writer} [writer] Writer to encode to
2080
     * @returns {$protobuf.Writer} Writer
2081
     */
2082
    ModelProto.encodeDelimited = function encodeDelimited(message, writer) {
2083
      return this.encode(message, writer).ldelim();
2084
    };
2085

2086
    /**
2087
     * Decodes a ModelProto message from the specified reader or buffer.
2088
     * @function decode
2089
     * @memberof onnx.ModelProto
2090
     * @static
2091
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2092
     * @param {number} [length] Message length if known beforehand
2093
     * @returns {onnx.ModelProto} ModelProto
2094
     * @throws {Error} If the payload is not a reader or valid buffer
2095
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
2096
     */
2097
    ModelProto.decode = function decode(reader, length) {
2098
      if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
2099
      var end = length === undefined ? reader.len : reader.pos + length,
2100
        message = new $root.onnx.ModelProto();
2101
      while (reader.pos < end) {
2102
        var tag = reader.uint32();
2103
        switch (tag >>> 3) {
2104
          case 1: {
2105
            message.irVersion = reader.int64();
2106
            break;
2107
          }
2108
          case 8: {
2109
            if (!(message.opsetImport && message.opsetImport.length)) message.opsetImport = [];
2110
            message.opsetImport.push($root.onnx.OperatorSetIdProto.decode(reader, reader.uint32()));
2111
            break;
2112
          }
2113
          case 2: {
2114
            message.producerName = reader.string();
2115
            break;
2116
          }
2117
          case 3: {
2118
            message.producerVersion = reader.string();
2119
            break;
2120
          }
2121
          case 4: {
2122
            message.domain = reader.string();
2123
            break;
2124
          }
2125
          case 5: {
2126
            message.modelVersion = reader.int64();
2127
            break;
2128
          }
2129
          case 6: {
2130
            message.docString = reader.string();
2131
            break;
2132
          }
2133
          case 7: {
2134
            message.graph = $root.onnx.GraphProto.decode(reader, reader.uint32());
2135
            break;
2136
          }
2137
          case 14: {
2138
            if (!(message.metadataProps && message.metadataProps.length)) message.metadataProps = [];
2139
            message.metadataProps.push($root.onnx.StringStringEntryProto.decode(reader, reader.uint32()));
2140
            break;
2141
          }
2142
          case 20: {
2143
            if (!(message.trainingInfo && message.trainingInfo.length)) message.trainingInfo = [];
2144
            message.trainingInfo.push($root.onnx.TrainingInfoProto.decode(reader, reader.uint32()));
2145
            break;
2146
          }
2147
          case 25: {
2148
            if (!(message.functions && message.functions.length)) message.functions = [];
2149
            message.functions.push($root.onnx.FunctionProto.decode(reader, reader.uint32()));
2150
            break;
2151
          }
2152
          default:
2153
            reader.skipType(tag & 7);
2154
            break;
2155
        }
2156
      }
2157
      return message;
2158
    };
2159

2160
    /**
2161
     * Decodes a ModelProto message from the specified reader or buffer, length delimited.
2162
     * @function decodeDelimited
2163
     * @memberof onnx.ModelProto
2164
     * @static
2165
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2166
     * @returns {onnx.ModelProto} ModelProto
2167
     * @throws {Error} If the payload is not a reader or valid buffer
2168
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
2169
     */
2170
    ModelProto.decodeDelimited = function decodeDelimited(reader) {
2171
      if (!(reader instanceof $Reader)) reader = new $Reader(reader);
2172
      return this.decode(reader, reader.uint32());
2173
    };
2174

2175
    /**
2176
     * Verifies a ModelProto message.
2177
     * @function verify
2178
     * @memberof onnx.ModelProto
2179
     * @static
2180
     * @param {Object.<string,*>} message Plain object to verify
2181
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
2182
     */
2183
    ModelProto.verify = function verify(message) {
2184
      if (typeof message !== 'object' || message === null) return 'object expected';
2185
      if (message.irVersion != null && message.hasOwnProperty('irVersion'))
2186
        if (
2187
          !$util.isInteger(message.irVersion) &&
2188
          !(message.irVersion && $util.isInteger(message.irVersion.low) && $util.isInteger(message.irVersion.high))
2189
        )
2190
          return 'irVersion: integer|Long expected';
2191
      if (message.opsetImport != null && message.hasOwnProperty('opsetImport')) {
2192
        if (!Array.isArray(message.opsetImport)) return 'opsetImport: array expected';
2193
        for (var i = 0; i < message.opsetImport.length; ++i) {
2194
          var error = $root.onnx.OperatorSetIdProto.verify(message.opsetImport[i]);
2195
          if (error) return 'opsetImport.' + error;
2196
        }
2197
      }
2198
      if (message.producerName != null && message.hasOwnProperty('producerName'))
2199
        if (!$util.isString(message.producerName)) return 'producerName: string expected';
2200
      if (message.producerVersion != null && message.hasOwnProperty('producerVersion'))
2201
        if (!$util.isString(message.producerVersion)) return 'producerVersion: string expected';
2202
      if (message.domain != null && message.hasOwnProperty('domain'))
2203
        if (!$util.isString(message.domain)) return 'domain: string expected';
2204
      if (message.modelVersion != null && message.hasOwnProperty('modelVersion'))
2205
        if (
2206
          !$util.isInteger(message.modelVersion) &&
2207
          !(
2208
            message.modelVersion &&
2209
            $util.isInteger(message.modelVersion.low) &&
2210
            $util.isInteger(message.modelVersion.high)
2211
          )
2212
        )
2213
          return 'modelVersion: integer|Long expected';
2214
      if (message.docString != null && message.hasOwnProperty('docString'))
2215
        if (!$util.isString(message.docString)) return 'docString: string expected';
2216
      if (message.graph != null && message.hasOwnProperty('graph')) {
2217
        var error = $root.onnx.GraphProto.verify(message.graph);
2218
        if (error) return 'graph.' + error;
2219
      }
2220
      if (message.metadataProps != null && message.hasOwnProperty('metadataProps')) {
2221
        if (!Array.isArray(message.metadataProps)) return 'metadataProps: array expected';
2222
        for (var i = 0; i < message.metadataProps.length; ++i) {
2223
          var error = $root.onnx.StringStringEntryProto.verify(message.metadataProps[i]);
2224
          if (error) return 'metadataProps.' + error;
2225
        }
2226
      }
2227
      if (message.trainingInfo != null && message.hasOwnProperty('trainingInfo')) {
2228
        if (!Array.isArray(message.trainingInfo)) return 'trainingInfo: array expected';
2229
        for (var i = 0; i < message.trainingInfo.length; ++i) {
2230
          var error = $root.onnx.TrainingInfoProto.verify(message.trainingInfo[i]);
2231
          if (error) return 'trainingInfo.' + error;
2232
        }
2233
      }
2234
      if (message.functions != null && message.hasOwnProperty('functions')) {
2235
        if (!Array.isArray(message.functions)) return 'functions: array expected';
2236
        for (var i = 0; i < message.functions.length; ++i) {
2237
          var error = $root.onnx.FunctionProto.verify(message.functions[i]);
2238
          if (error) return 'functions.' + error;
2239
        }
2240
      }
2241
      return null;
2242
    };
2243

2244
    /**
2245
     * Creates a ModelProto message from a plain object. Also converts values to their respective internal types.
2246
     * @function fromObject
2247
     * @memberof onnx.ModelProto
2248
     * @static
2249
     * @param {Object.<string,*>} object Plain object
2250
     * @returns {onnx.ModelProto} ModelProto
2251
     */
2252
    ModelProto.fromObject = function fromObject(object) {
2253
      if (object instanceof $root.onnx.ModelProto) return object;
2254
      var message = new $root.onnx.ModelProto();
2255
      if (object.irVersion != null)
2256
        if ($util.Long) (message.irVersion = $util.Long.fromValue(object.irVersion)).unsigned = false;
2257
        else if (typeof object.irVersion === 'string') message.irVersion = parseInt(object.irVersion, 10);
2258
        else if (typeof object.irVersion === 'number') message.irVersion = object.irVersion;
2259
        else if (typeof object.irVersion === 'object')
2260
          message.irVersion = new $util.LongBits(object.irVersion.low >>> 0, object.irVersion.high >>> 0).toNumber();
2261
      if (object.opsetImport) {
2262
        if (!Array.isArray(object.opsetImport)) throw TypeError('.onnx.ModelProto.opsetImport: array expected');
2263
        message.opsetImport = [];
2264
        for (var i = 0; i < object.opsetImport.length; ++i) {
2265
          if (typeof object.opsetImport[i] !== 'object')
2266
            throw TypeError('.onnx.ModelProto.opsetImport: object expected');
2267
          message.opsetImport[i] = $root.onnx.OperatorSetIdProto.fromObject(object.opsetImport[i]);
2268
        }
2269
      }
2270
      if (object.producerName != null) message.producerName = String(object.producerName);
2271
      if (object.producerVersion != null) message.producerVersion = String(object.producerVersion);
2272
      if (object.domain != null) message.domain = String(object.domain);
2273
      if (object.modelVersion != null)
2274
        if ($util.Long) (message.modelVersion = $util.Long.fromValue(object.modelVersion)).unsigned = false;
2275
        else if (typeof object.modelVersion === 'string') message.modelVersion = parseInt(object.modelVersion, 10);
2276
        else if (typeof object.modelVersion === 'number') message.modelVersion = object.modelVersion;
2277
        else if (typeof object.modelVersion === 'object')
2278
          message.modelVersion = new $util.LongBits(
2279
            object.modelVersion.low >>> 0,
2280
            object.modelVersion.high >>> 0,
2281
          ).toNumber();
2282
      if (object.docString != null) message.docString = String(object.docString);
2283
      if (object.graph != null) {
2284
        if (typeof object.graph !== 'object') throw TypeError('.onnx.ModelProto.graph: object expected');
2285
        message.graph = $root.onnx.GraphProto.fromObject(object.graph);
2286
      }
2287
      if (object.metadataProps) {
2288
        if (!Array.isArray(object.metadataProps)) throw TypeError('.onnx.ModelProto.metadataProps: array expected');
2289
        message.metadataProps = [];
2290
        for (var i = 0; i < object.metadataProps.length; ++i) {
2291
          if (typeof object.metadataProps[i] !== 'object')
2292
            throw TypeError('.onnx.ModelProto.metadataProps: object expected');
2293
          message.metadataProps[i] = $root.onnx.StringStringEntryProto.fromObject(object.metadataProps[i]);
2294
        }
2295
      }
2296
      if (object.trainingInfo) {
2297
        if (!Array.isArray(object.trainingInfo)) throw TypeError('.onnx.ModelProto.trainingInfo: array expected');
2298
        message.trainingInfo = [];
2299
        for (var i = 0; i < object.trainingInfo.length; ++i) {
2300
          if (typeof object.trainingInfo[i] !== 'object')
2301
            throw TypeError('.onnx.ModelProto.trainingInfo: object expected');
2302
          message.trainingInfo[i] = $root.onnx.TrainingInfoProto.fromObject(object.trainingInfo[i]);
2303
        }
2304
      }
2305
      if (object.functions) {
2306
        if (!Array.isArray(object.functions)) throw TypeError('.onnx.ModelProto.functions: array expected');
2307
        message.functions = [];
2308
        for (var i = 0; i < object.functions.length; ++i) {
2309
          if (typeof object.functions[i] !== 'object') throw TypeError('.onnx.ModelProto.functions: object expected');
2310
          message.functions[i] = $root.onnx.FunctionProto.fromObject(object.functions[i]);
2311
        }
2312
      }
2313
      return message;
2314
    };
2315

2316
    /**
2317
     * Creates a plain object from a ModelProto message. Also converts values to other types if specified.
2318
     * @function toObject
2319
     * @memberof onnx.ModelProto
2320
     * @static
2321
     * @param {onnx.ModelProto} message ModelProto
2322
     * @param {$protobuf.IConversionOptions} [options] Conversion options
2323
     * @returns {Object.<string,*>} Plain object
2324
     */
2325
    ModelProto.toObject = function toObject(message, options) {
2326
      if (!options) options = {};
2327
      var object = {};
2328
      if (options.arrays || options.defaults) {
2329
        object.opsetImport = [];
2330
        object.metadataProps = [];
2331
        object.trainingInfo = [];
2332
        object.functions = [];
2333
      }
2334
      if (options.defaults) {
2335
        if ($util.Long) {
2336
          var long = new $util.Long(0, 0, false);
2337
          object.irVersion =
2338
            options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
2339
        } else object.irVersion = options.longs === String ? '0' : 0;
2340
        object.producerName = '';
2341
        object.producerVersion = '';
2342
        object.domain = '';
2343
        if ($util.Long) {
2344
          var long = new $util.Long(0, 0, false);
2345
          object.modelVersion =
2346
            options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
2347
        } else object.modelVersion = options.longs === String ? '0' : 0;
2348
        object.docString = '';
2349
        object.graph = null;
2350
      }
2351
      if (message.irVersion != null && message.hasOwnProperty('irVersion'))
2352
        if (typeof message.irVersion === 'number')
2353
          object.irVersion = options.longs === String ? String(message.irVersion) : message.irVersion;
2354
        else
2355
          object.irVersion =
2356
            options.longs === String
2357
              ? $util.Long.prototype.toString.call(message.irVersion)
2358
              : options.longs === Number
2359
                ? new $util.LongBits(message.irVersion.low >>> 0, message.irVersion.high >>> 0).toNumber()
2360
                : message.irVersion;
2361
      if (message.producerName != null && message.hasOwnProperty('producerName'))
2362
        object.producerName = message.producerName;
2363
      if (message.producerVersion != null && message.hasOwnProperty('producerVersion'))
2364
        object.producerVersion = message.producerVersion;
2365
      if (message.domain != null && message.hasOwnProperty('domain')) object.domain = message.domain;
2366
      if (message.modelVersion != null && message.hasOwnProperty('modelVersion'))
2367
        if (typeof message.modelVersion === 'number')
2368
          object.modelVersion = options.longs === String ? String(message.modelVersion) : message.modelVersion;
2369
        else
2370
          object.modelVersion =
2371
            options.longs === String
2372
              ? $util.Long.prototype.toString.call(message.modelVersion)
2373
              : options.longs === Number
2374
                ? new $util.LongBits(message.modelVersion.low >>> 0, message.modelVersion.high >>> 0).toNumber()
2375
                : message.modelVersion;
2376
      if (message.docString != null && message.hasOwnProperty('docString')) object.docString = message.docString;
2377
      if (message.graph != null && message.hasOwnProperty('graph'))
2378
        object.graph = $root.onnx.GraphProto.toObject(message.graph, options);
2379
      if (message.opsetImport && message.opsetImport.length) {
2380
        object.opsetImport = [];
2381
        for (var j = 0; j < message.opsetImport.length; ++j)
2382
          object.opsetImport[j] = $root.onnx.OperatorSetIdProto.toObject(message.opsetImport[j], options);
2383
      }
2384
      if (message.metadataProps && message.metadataProps.length) {
2385
        object.metadataProps = [];
2386
        for (var j = 0; j < message.metadataProps.length; ++j)
2387
          object.metadataProps[j] = $root.onnx.StringStringEntryProto.toObject(message.metadataProps[j], options);
2388
      }
2389
      if (message.trainingInfo && message.trainingInfo.length) {
2390
        object.trainingInfo = [];
2391
        for (var j = 0; j < message.trainingInfo.length; ++j)
2392
          object.trainingInfo[j] = $root.onnx.TrainingInfoProto.toObject(message.trainingInfo[j], options);
2393
      }
2394
      if (message.functions && message.functions.length) {
2395
        object.functions = [];
2396
        for (var j = 0; j < message.functions.length; ++j)
2397
          object.functions[j] = $root.onnx.FunctionProto.toObject(message.functions[j], options);
2398
      }
2399
      return object;
2400
    };
2401

2402
    /**
2403
     * Converts this ModelProto to JSON.
2404
     * @function toJSON
2405
     * @memberof onnx.ModelProto
2406
     * @instance
2407
     * @returns {Object.<string,*>} JSON object
2408
     */
2409
    ModelProto.prototype.toJSON = function toJSON() {
2410
      return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2411
    };
2412

2413
    /**
2414
     * Gets the default type url for ModelProto
2415
     * @function getTypeUrl
2416
     * @memberof onnx.ModelProto
2417
     * @static
2418
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
2419
     * @returns {string} The default type url
2420
     */
2421
    ModelProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
2422
      if (typeUrlPrefix === undefined) {
2423
        typeUrlPrefix = 'type.googleapis.com';
2424
      }
2425
      return typeUrlPrefix + '/onnx.ModelProto';
2426
    };
2427

2428
    return ModelProto;
2429
  })();
2430

2431
  onnx.StringStringEntryProto = (function () {
2432
    /**
2433
     * Properties of a StringStringEntryProto.
2434
     * @memberof onnx
2435
     * @interface IStringStringEntryProto
2436
     * @property {string|null} [key] StringStringEntryProto key
2437
     * @property {string|null} [value] StringStringEntryProto value
2438
     */
2439

2440
    /**
2441
     * Constructs a new StringStringEntryProto.
2442
     * @memberof onnx
2443
     * @classdesc Represents a StringStringEntryProto.
2444
     * @implements IStringStringEntryProto
2445
     * @constructor
2446
     * @param {onnx.IStringStringEntryProto=} [properties] Properties to set
2447
     */
2448
    function StringStringEntryProto(properties) {
2449
      if (properties)
2450
        for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
2451
          if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
2452
    }
2453

2454
    /**
2455
     * StringStringEntryProto key.
2456
     * @member {string} key
2457
     * @memberof onnx.StringStringEntryProto
2458
     * @instance
2459
     */
2460
    StringStringEntryProto.prototype.key = '';
2461

2462
    /**
2463
     * StringStringEntryProto value.
2464
     * @member {string} value
2465
     * @memberof onnx.StringStringEntryProto
2466
     * @instance
2467
     */
2468
    StringStringEntryProto.prototype.value = '';
2469

2470
    /**
2471
     * Creates a new StringStringEntryProto instance using the specified properties.
2472
     * @function create
2473
     * @memberof onnx.StringStringEntryProto
2474
     * @static
2475
     * @param {onnx.IStringStringEntryProto=} [properties] Properties to set
2476
     * @returns {onnx.StringStringEntryProto} StringStringEntryProto instance
2477
     */
2478
    StringStringEntryProto.create = function create(properties) {
2479
      return new StringStringEntryProto(properties);
2480
    };
2481

2482
    /**
2483
     * Encodes the specified StringStringEntryProto message. Does not implicitly {@link onnx.StringStringEntryProto.verify|verify} messages.
2484
     * @function encode
2485
     * @memberof onnx.StringStringEntryProto
2486
     * @static
2487
     * @param {onnx.IStringStringEntryProto} message StringStringEntryProto message or plain object to encode
2488
     * @param {$protobuf.Writer} [writer] Writer to encode to
2489
     * @returns {$protobuf.Writer} Writer
2490
     */
2491
    StringStringEntryProto.encode = function encode(message, writer) {
2492
      if (!writer) writer = $Writer.create();
2493
      if (message.key != null && Object.hasOwnProperty.call(message, 'key'))
2494
        writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.key);
2495
      if (message.value != null && Object.hasOwnProperty.call(message, 'value'))
2496
        writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.value);
2497
      return writer;
2498
    };
2499

2500
    /**
2501
     * Encodes the specified StringStringEntryProto message, length delimited. Does not implicitly {@link onnx.StringStringEntryProto.verify|verify} messages.
2502
     * @function encodeDelimited
2503
     * @memberof onnx.StringStringEntryProto
2504
     * @static
2505
     * @param {onnx.IStringStringEntryProto} message StringStringEntryProto message or plain object to encode
2506
     * @param {$protobuf.Writer} [writer] Writer to encode to
2507
     * @returns {$protobuf.Writer} Writer
2508
     */
2509
    StringStringEntryProto.encodeDelimited = function encodeDelimited(message, writer) {
2510
      return this.encode(message, writer).ldelim();
2511
    };
2512

2513
    /**
2514
     * Decodes a StringStringEntryProto message from the specified reader or buffer.
2515
     * @function decode
2516
     * @memberof onnx.StringStringEntryProto
2517
     * @static
2518
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2519
     * @param {number} [length] Message length if known beforehand
2520
     * @returns {onnx.StringStringEntryProto} StringStringEntryProto
2521
     * @throws {Error} If the payload is not a reader or valid buffer
2522
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
2523
     */
2524
    StringStringEntryProto.decode = function decode(reader, length) {
2525
      if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
2526
      var end = length === undefined ? reader.len : reader.pos + length,
2527
        message = new $root.onnx.StringStringEntryProto();
2528
      while (reader.pos < end) {
2529
        var tag = reader.uint32();
2530
        switch (tag >>> 3) {
2531
          case 1: {
2532
            message.key = reader.string();
2533
            break;
2534
          }
2535
          case 2: {
2536
            message.value = reader.string();
2537
            break;
2538
          }
2539
          default:
2540
            reader.skipType(tag & 7);
2541
            break;
2542
        }
2543
      }
2544
      return message;
2545
    };
2546

2547
    /**
2548
     * Decodes a StringStringEntryProto message from the specified reader or buffer, length delimited.
2549
     * @function decodeDelimited
2550
     * @memberof onnx.StringStringEntryProto
2551
     * @static
2552
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2553
     * @returns {onnx.StringStringEntryProto} StringStringEntryProto
2554
     * @throws {Error} If the payload is not a reader or valid buffer
2555
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
2556
     */
2557
    StringStringEntryProto.decodeDelimited = function decodeDelimited(reader) {
2558
      if (!(reader instanceof $Reader)) reader = new $Reader(reader);
2559
      return this.decode(reader, reader.uint32());
2560
    };
2561

2562
    /**
2563
     * Verifies a StringStringEntryProto message.
2564
     * @function verify
2565
     * @memberof onnx.StringStringEntryProto
2566
     * @static
2567
     * @param {Object.<string,*>} message Plain object to verify
2568
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
2569
     */
2570
    StringStringEntryProto.verify = function verify(message) {
2571
      if (typeof message !== 'object' || message === null) return 'object expected';
2572
      if (message.key != null && message.hasOwnProperty('key'))
2573
        if (!$util.isString(message.key)) return 'key: string expected';
2574
      if (message.value != null && message.hasOwnProperty('value'))
2575
        if (!$util.isString(message.value)) return 'value: string expected';
2576
      return null;
2577
    };
2578

2579
    /**
2580
     * Creates a StringStringEntryProto message from a plain object. Also converts values to their respective internal types.
2581
     * @function fromObject
2582
     * @memberof onnx.StringStringEntryProto
2583
     * @static
2584
     * @param {Object.<string,*>} object Plain object
2585
     * @returns {onnx.StringStringEntryProto} StringStringEntryProto
2586
     */
2587
    StringStringEntryProto.fromObject = function fromObject(object) {
2588
      if (object instanceof $root.onnx.StringStringEntryProto) return object;
2589
      var message = new $root.onnx.StringStringEntryProto();
2590
      if (object.key != null) message.key = String(object.key);
2591
      if (object.value != null) message.value = String(object.value);
2592
      return message;
2593
    };
2594

2595
    /**
2596
     * Creates a plain object from a StringStringEntryProto message. Also converts values to other types if specified.
2597
     * @function toObject
2598
     * @memberof onnx.StringStringEntryProto
2599
     * @static
2600
     * @param {onnx.StringStringEntryProto} message StringStringEntryProto
2601
     * @param {$protobuf.IConversionOptions} [options] Conversion options
2602
     * @returns {Object.<string,*>} Plain object
2603
     */
2604
    StringStringEntryProto.toObject = function toObject(message, options) {
2605
      if (!options) options = {};
2606
      var object = {};
2607
      if (options.defaults) {
2608
        object.key = '';
2609
        object.value = '';
2610
      }
2611
      if (message.key != null && message.hasOwnProperty('key')) object.key = message.key;
2612
      if (message.value != null && message.hasOwnProperty('value')) object.value = message.value;
2613
      return object;
2614
    };
2615

2616
    /**
2617
     * Converts this StringStringEntryProto to JSON.
2618
     * @function toJSON
2619
     * @memberof onnx.StringStringEntryProto
2620
     * @instance
2621
     * @returns {Object.<string,*>} JSON object
2622
     */
2623
    StringStringEntryProto.prototype.toJSON = function toJSON() {
2624
      return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2625
    };
2626

2627
    /**
2628
     * Gets the default type url for StringStringEntryProto
2629
     * @function getTypeUrl
2630
     * @memberof onnx.StringStringEntryProto
2631
     * @static
2632
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
2633
     * @returns {string} The default type url
2634
     */
2635
    StringStringEntryProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
2636
      if (typeUrlPrefix === undefined) {
2637
        typeUrlPrefix = 'type.googleapis.com';
2638
      }
2639
      return typeUrlPrefix + '/onnx.StringStringEntryProto';
2640
    };
2641

2642
    return StringStringEntryProto;
2643
  })();
2644

2645
  onnx.TensorAnnotation = (function () {
2646
    /**
2647
     * Properties of a TensorAnnotation.
2648
     * @memberof onnx
2649
     * @interface ITensorAnnotation
2650
     * @property {string|null} [tensorName] TensorAnnotation tensorName
2651
     * @property {Array.<onnx.IStringStringEntryProto>|null} [quantParameterTensorNames] TensorAnnotation quantParameterTensorNames
2652
     */
2653

2654
    /**
2655
     * Constructs a new TensorAnnotation.
2656
     * @memberof onnx
2657
     * @classdesc Represents a TensorAnnotation.
2658
     * @implements ITensorAnnotation
2659
     * @constructor
2660
     * @param {onnx.ITensorAnnotation=} [properties] Properties to set
2661
     */
2662
    function TensorAnnotation(properties) {
2663
      this.quantParameterTensorNames = [];
2664
      if (properties)
2665
        for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
2666
          if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
2667
    }
2668

2669
    /**
2670
     * TensorAnnotation tensorName.
2671
     * @member {string} tensorName
2672
     * @memberof onnx.TensorAnnotation
2673
     * @instance
2674
     */
2675
    TensorAnnotation.prototype.tensorName = '';
2676

2677
    /**
2678
     * TensorAnnotation quantParameterTensorNames.
2679
     * @member {Array.<onnx.IStringStringEntryProto>} quantParameterTensorNames
2680
     * @memberof onnx.TensorAnnotation
2681
     * @instance
2682
     */
2683
    TensorAnnotation.prototype.quantParameterTensorNames = $util.emptyArray;
2684

2685
    /**
2686
     * Creates a new TensorAnnotation instance using the specified properties.
2687
     * @function create
2688
     * @memberof onnx.TensorAnnotation
2689
     * @static
2690
     * @param {onnx.ITensorAnnotation=} [properties] Properties to set
2691
     * @returns {onnx.TensorAnnotation} TensorAnnotation instance
2692
     */
2693
    TensorAnnotation.create = function create(properties) {
2694
      return new TensorAnnotation(properties);
2695
    };
2696

2697
    /**
2698
     * Encodes the specified TensorAnnotation message. Does not implicitly {@link onnx.TensorAnnotation.verify|verify} messages.
2699
     * @function encode
2700
     * @memberof onnx.TensorAnnotation
2701
     * @static
2702
     * @param {onnx.ITensorAnnotation} message TensorAnnotation message or plain object to encode
2703
     * @param {$protobuf.Writer} [writer] Writer to encode to
2704
     * @returns {$protobuf.Writer} Writer
2705
     */
2706
    TensorAnnotation.encode = function encode(message, writer) {
2707
      if (!writer) writer = $Writer.create();
2708
      if (message.tensorName != null && Object.hasOwnProperty.call(message, 'tensorName'))
2709
        writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.tensorName);
2710
      if (message.quantParameterTensorNames != null && message.quantParameterTensorNames.length)
2711
        for (var i = 0; i < message.quantParameterTensorNames.length; ++i)
2712
          $root.onnx.StringStringEntryProto.encode(
2713
            message.quantParameterTensorNames[i],
2714
            writer.uint32(/* id 2, wireType 2 =*/ 18).fork(),
2715
          ).ldelim();
2716
      return writer;
2717
    };
2718

2719
    /**
2720
     * Encodes the specified TensorAnnotation message, length delimited. Does not implicitly {@link onnx.TensorAnnotation.verify|verify} messages.
2721
     * @function encodeDelimited
2722
     * @memberof onnx.TensorAnnotation
2723
     * @static
2724
     * @param {onnx.ITensorAnnotation} message TensorAnnotation message or plain object to encode
2725
     * @param {$protobuf.Writer} [writer] Writer to encode to
2726
     * @returns {$protobuf.Writer} Writer
2727
     */
2728
    TensorAnnotation.encodeDelimited = function encodeDelimited(message, writer) {
2729
      return this.encode(message, writer).ldelim();
2730
    };
2731

2732
    /**
2733
     * Decodes a TensorAnnotation message from the specified reader or buffer.
2734
     * @function decode
2735
     * @memberof onnx.TensorAnnotation
2736
     * @static
2737
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2738
     * @param {number} [length] Message length if known beforehand
2739
     * @returns {onnx.TensorAnnotation} TensorAnnotation
2740
     * @throws {Error} If the payload is not a reader or valid buffer
2741
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
2742
     */
2743
    TensorAnnotation.decode = function decode(reader, length) {
2744
      if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
2745
      var end = length === undefined ? reader.len : reader.pos + length,
2746
        message = new $root.onnx.TensorAnnotation();
2747
      while (reader.pos < end) {
2748
        var tag = reader.uint32();
2749
        switch (tag >>> 3) {
2750
          case 1: {
2751
            message.tensorName = reader.string();
2752
            break;
2753
          }
2754
          case 2: {
2755
            if (!(message.quantParameterTensorNames && message.quantParameterTensorNames.length))
2756
              message.quantParameterTensorNames = [];
2757
            message.quantParameterTensorNames.push($root.onnx.StringStringEntryProto.decode(reader, reader.uint32()));
2758
            break;
2759
          }
2760
          default:
2761
            reader.skipType(tag & 7);
2762
            break;
2763
        }
2764
      }
2765
      return message;
2766
    };
2767

2768
    /**
2769
     * Decodes a TensorAnnotation message from the specified reader or buffer, length delimited.
2770
     * @function decodeDelimited
2771
     * @memberof onnx.TensorAnnotation
2772
     * @static
2773
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2774
     * @returns {onnx.TensorAnnotation} TensorAnnotation
2775
     * @throws {Error} If the payload is not a reader or valid buffer
2776
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
2777
     */
2778
    TensorAnnotation.decodeDelimited = function decodeDelimited(reader) {
2779
      if (!(reader instanceof $Reader)) reader = new $Reader(reader);
2780
      return this.decode(reader, reader.uint32());
2781
    };
2782

2783
    /**
2784
     * Verifies a TensorAnnotation message.
2785
     * @function verify
2786
     * @memberof onnx.TensorAnnotation
2787
     * @static
2788
     * @param {Object.<string,*>} message Plain object to verify
2789
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
2790
     */
2791
    TensorAnnotation.verify = function verify(message) {
2792
      if (typeof message !== 'object' || message === null) return 'object expected';
2793
      if (message.tensorName != null && message.hasOwnProperty('tensorName'))
2794
        if (!$util.isString(message.tensorName)) return 'tensorName: string expected';
2795
      if (message.quantParameterTensorNames != null && message.hasOwnProperty('quantParameterTensorNames')) {
2796
        if (!Array.isArray(message.quantParameterTensorNames)) return 'quantParameterTensorNames: array expected';
2797
        for (var i = 0; i < message.quantParameterTensorNames.length; ++i) {
2798
          var error = $root.onnx.StringStringEntryProto.verify(message.quantParameterTensorNames[i]);
2799
          if (error) return 'quantParameterTensorNames.' + error;
2800
        }
2801
      }
2802
      return null;
2803
    };
2804

2805
    /**
2806
     * Creates a TensorAnnotation message from a plain object. Also converts values to their respective internal types.
2807
     * @function fromObject
2808
     * @memberof onnx.TensorAnnotation
2809
     * @static
2810
     * @param {Object.<string,*>} object Plain object
2811
     * @returns {onnx.TensorAnnotation} TensorAnnotation
2812
     */
2813
    TensorAnnotation.fromObject = function fromObject(object) {
2814
      if (object instanceof $root.onnx.TensorAnnotation) return object;
2815
      var message = new $root.onnx.TensorAnnotation();
2816
      if (object.tensorName != null) message.tensorName = String(object.tensorName);
2817
      if (object.quantParameterTensorNames) {
2818
        if (!Array.isArray(object.quantParameterTensorNames))
2819
          throw TypeError('.onnx.TensorAnnotation.quantParameterTensorNames: array expected');
2820
        message.quantParameterTensorNames = [];
2821
        for (var i = 0; i < object.quantParameterTensorNames.length; ++i) {
2822
          if (typeof object.quantParameterTensorNames[i] !== 'object')
2823
            throw TypeError('.onnx.TensorAnnotation.quantParameterTensorNames: object expected');
2824
          message.quantParameterTensorNames[i] = $root.onnx.StringStringEntryProto.fromObject(
2825
            object.quantParameterTensorNames[i],
2826
          );
2827
        }
2828
      }
2829
      return message;
2830
    };
2831

2832
    /**
2833
     * Creates a plain object from a TensorAnnotation message. Also converts values to other types if specified.
2834
     * @function toObject
2835
     * @memberof onnx.TensorAnnotation
2836
     * @static
2837
     * @param {onnx.TensorAnnotation} message TensorAnnotation
2838
     * @param {$protobuf.IConversionOptions} [options] Conversion options
2839
     * @returns {Object.<string,*>} Plain object
2840
     */
2841
    TensorAnnotation.toObject = function toObject(message, options) {
2842
      if (!options) options = {};
2843
      var object = {};
2844
      if (options.arrays || options.defaults) object.quantParameterTensorNames = [];
2845
      if (options.defaults) object.tensorName = '';
2846
      if (message.tensorName != null && message.hasOwnProperty('tensorName')) object.tensorName = message.tensorName;
2847
      if (message.quantParameterTensorNames && message.quantParameterTensorNames.length) {
2848
        object.quantParameterTensorNames = [];
2849
        for (var j = 0; j < message.quantParameterTensorNames.length; ++j)
2850
          object.quantParameterTensorNames[j] = $root.onnx.StringStringEntryProto.toObject(
2851
            message.quantParameterTensorNames[j],
2852
            options,
2853
          );
2854
      }
2855
      return object;
2856
    };
2857

2858
    /**
2859
     * Converts this TensorAnnotation to JSON.
2860
     * @function toJSON
2861
     * @memberof onnx.TensorAnnotation
2862
     * @instance
2863
     * @returns {Object.<string,*>} JSON object
2864
     */
2865
    TensorAnnotation.prototype.toJSON = function toJSON() {
2866
      return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2867
    };
2868

2869
    /**
2870
     * Gets the default type url for TensorAnnotation
2871
     * @function getTypeUrl
2872
     * @memberof onnx.TensorAnnotation
2873
     * @static
2874
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
2875
     * @returns {string} The default type url
2876
     */
2877
    TensorAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
2878
      if (typeUrlPrefix === undefined) {
2879
        typeUrlPrefix = 'type.googleapis.com';
2880
      }
2881
      return typeUrlPrefix + '/onnx.TensorAnnotation';
2882
    };
2883

2884
    return TensorAnnotation;
2885
  })();
2886

2887
  onnx.GraphProto = (function () {
2888
    /**
2889
     * Properties of a GraphProto.
2890
     * @memberof onnx
2891
     * @interface IGraphProto
2892
     * @property {Array.<onnx.INodeProto>|null} [node] GraphProto node
2893
     * @property {string|null} [name] GraphProto name
2894
     * @property {Array.<onnx.ITensorProto>|null} [initializer] GraphProto initializer
2895
     * @property {Array.<onnx.ISparseTensorProto>|null} [sparseInitializer] GraphProto sparseInitializer
2896
     * @property {string|null} [docString] GraphProto docString
2897
     * @property {Array.<onnx.IValueInfoProto>|null} [input] GraphProto input
2898
     * @property {Array.<onnx.IValueInfoProto>|null} [output] GraphProto output
2899
     * @property {Array.<onnx.IValueInfoProto>|null} [valueInfo] GraphProto valueInfo
2900
     * @property {Array.<onnx.ITensorAnnotation>|null} [quantizationAnnotation] GraphProto quantizationAnnotation
2901
     */
2902

2903
    /**
2904
     * Constructs a new GraphProto.
2905
     * @memberof onnx
2906
     * @classdesc Represents a GraphProto.
2907
     * @implements IGraphProto
2908
     * @constructor
2909
     * @param {onnx.IGraphProto=} [properties] Properties to set
2910
     */
2911
    function GraphProto(properties) {
2912
      this.node = [];
2913
      this.initializer = [];
2914
      this.sparseInitializer = [];
2915
      this.input = [];
2916
      this.output = [];
2917
      this.valueInfo = [];
2918
      this.quantizationAnnotation = [];
2919
      if (properties)
2920
        for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
2921
          if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
2922
    }
2923

2924
    /**
2925
     * GraphProto node.
2926
     * @member {Array.<onnx.INodeProto>} node
2927
     * @memberof onnx.GraphProto
2928
     * @instance
2929
     */
2930
    GraphProto.prototype.node = $util.emptyArray;
2931

2932
    /**
2933
     * GraphProto name.
2934
     * @member {string} name
2935
     * @memberof onnx.GraphProto
2936
     * @instance
2937
     */
2938
    GraphProto.prototype.name = '';
2939

2940
    /**
2941
     * GraphProto initializer.
2942
     * @member {Array.<onnx.ITensorProto>} initializer
2943
     * @memberof onnx.GraphProto
2944
     * @instance
2945
     */
2946
    GraphProto.prototype.initializer = $util.emptyArray;
2947

2948
    /**
2949
     * GraphProto sparseInitializer.
2950
     * @member {Array.<onnx.ISparseTensorProto>} sparseInitializer
2951
     * @memberof onnx.GraphProto
2952
     * @instance
2953
     */
2954
    GraphProto.prototype.sparseInitializer = $util.emptyArray;
2955

2956
    /**
2957
     * GraphProto docString.
2958
     * @member {string} docString
2959
     * @memberof onnx.GraphProto
2960
     * @instance
2961
     */
2962
    GraphProto.prototype.docString = '';
2963

2964
    /**
2965
     * GraphProto input.
2966
     * @member {Array.<onnx.IValueInfoProto>} input
2967
     * @memberof onnx.GraphProto
2968
     * @instance
2969
     */
2970
    GraphProto.prototype.input = $util.emptyArray;
2971

2972
    /**
2973
     * GraphProto output.
2974
     * @member {Array.<onnx.IValueInfoProto>} output
2975
     * @memberof onnx.GraphProto
2976
     * @instance
2977
     */
2978
    GraphProto.prototype.output = $util.emptyArray;
2979

2980
    /**
2981
     * GraphProto valueInfo.
2982
     * @member {Array.<onnx.IValueInfoProto>} valueInfo
2983
     * @memberof onnx.GraphProto
2984
     * @instance
2985
     */
2986
    GraphProto.prototype.valueInfo = $util.emptyArray;
2987

2988
    /**
2989
     * GraphProto quantizationAnnotation.
2990
     * @member {Array.<onnx.ITensorAnnotation>} quantizationAnnotation
2991
     * @memberof onnx.GraphProto
2992
     * @instance
2993
     */
2994
    GraphProto.prototype.quantizationAnnotation = $util.emptyArray;
2995

2996
    /**
2997
     * Creates a new GraphProto instance using the specified properties.
2998
     * @function create
2999
     * @memberof onnx.GraphProto
3000
     * @static
3001
     * @param {onnx.IGraphProto=} [properties] Properties to set
3002
     * @returns {onnx.GraphProto} GraphProto instance
3003
     */
3004
    GraphProto.create = function create(properties) {
3005
      return new GraphProto(properties);
3006
    };
3007

3008
    /**
3009
     * Encodes the specified GraphProto message. Does not implicitly {@link onnx.GraphProto.verify|verify} messages.
3010
     * @function encode
3011
     * @memberof onnx.GraphProto
3012
     * @static
3013
     * @param {onnx.IGraphProto} message GraphProto message or plain object to encode
3014
     * @param {$protobuf.Writer} [writer] Writer to encode to
3015
     * @returns {$protobuf.Writer} Writer
3016
     */
3017
    GraphProto.encode = function encode(message, writer) {
3018
      if (!writer) writer = $Writer.create();
3019
      if (message.node != null && message.node.length)
3020
        for (var i = 0; i < message.node.length; ++i)
3021
          $root.onnx.NodeProto.encode(message.node[i], writer.uint32(/* id 1, wireType 2 =*/ 10).fork()).ldelim();
3022
      if (message.name != null && Object.hasOwnProperty.call(message, 'name'))
3023
        writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.name);
3024
      if (message.initializer != null && message.initializer.length)
3025
        for (var i = 0; i < message.initializer.length; ++i)
3026
          $root.onnx.TensorProto.encode(
3027
            message.initializer[i],
3028
            writer.uint32(/* id 5, wireType 2 =*/ 42).fork(),
3029
          ).ldelim();
3030
      if (message.docString != null && Object.hasOwnProperty.call(message, 'docString'))
3031
        writer.uint32(/* id 10, wireType 2 =*/ 82).string(message.docString);
3032
      if (message.input != null && message.input.length)
3033
        for (var i = 0; i < message.input.length; ++i)
3034
          $root.onnx.ValueInfoProto.encode(
3035
            message.input[i],
3036
            writer.uint32(/* id 11, wireType 2 =*/ 90).fork(),
3037
          ).ldelim();
3038
      if (message.output != null && message.output.length)
3039
        for (var i = 0; i < message.output.length; ++i)
3040
          $root.onnx.ValueInfoProto.encode(
3041
            message.output[i],
3042
            writer.uint32(/* id 12, wireType 2 =*/ 98).fork(),
3043
          ).ldelim();
3044
      if (message.valueInfo != null && message.valueInfo.length)
3045
        for (var i = 0; i < message.valueInfo.length; ++i)
3046
          $root.onnx.ValueInfoProto.encode(
3047
            message.valueInfo[i],
3048
            writer.uint32(/* id 13, wireType 2 =*/ 106).fork(),
3049
          ).ldelim();
3050
      if (message.quantizationAnnotation != null && message.quantizationAnnotation.length)
3051
        for (var i = 0; i < message.quantizationAnnotation.length; ++i)
3052
          $root.onnx.TensorAnnotation.encode(
3053
            message.quantizationAnnotation[i],
3054
            writer.uint32(/* id 14, wireType 2 =*/ 114).fork(),
3055
          ).ldelim();
3056
      if (message.sparseInitializer != null && message.sparseInitializer.length)
3057
        for (var i = 0; i < message.sparseInitializer.length; ++i)
3058
          $root.onnx.SparseTensorProto.encode(
3059
            message.sparseInitializer[i],
3060
            writer.uint32(/* id 15, wireType 2 =*/ 122).fork(),
3061
          ).ldelim();
3062
      return writer;
3063
    };
3064

3065
    /**
3066
     * Encodes the specified GraphProto message, length delimited. Does not implicitly {@link onnx.GraphProto.verify|verify} messages.
3067
     * @function encodeDelimited
3068
     * @memberof onnx.GraphProto
3069
     * @static
3070
     * @param {onnx.IGraphProto} message GraphProto message or plain object to encode
3071
     * @param {$protobuf.Writer} [writer] Writer to encode to
3072
     * @returns {$protobuf.Writer} Writer
3073
     */
3074
    GraphProto.encodeDelimited = function encodeDelimited(message, writer) {
3075
      return this.encode(message, writer).ldelim();
3076
    };
3077

3078
    /**
3079
     * Decodes a GraphProto message from the specified reader or buffer.
3080
     * @function decode
3081
     * @memberof onnx.GraphProto
3082
     * @static
3083
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3084
     * @param {number} [length] Message length if known beforehand
3085
     * @returns {onnx.GraphProto} GraphProto
3086
     * @throws {Error} If the payload is not a reader or valid buffer
3087
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
3088
     */
3089
    GraphProto.decode = function decode(reader, length) {
3090
      if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
3091
      var end = length === undefined ? reader.len : reader.pos + length,
3092
        message = new $root.onnx.GraphProto();
3093
      while (reader.pos < end) {
3094
        var tag = reader.uint32();
3095
        switch (tag >>> 3) {
3096
          case 1: {
3097
            if (!(message.node && message.node.length)) message.node = [];
3098
            message.node.push($root.onnx.NodeProto.decode(reader, reader.uint32()));
3099
            break;
3100
          }
3101
          case 2: {
3102
            message.name = reader.string();
3103
            break;
3104
          }
3105
          case 5: {
3106
            if (!(message.initializer && message.initializer.length)) message.initializer = [];
3107
            message.initializer.push($root.onnx.TensorProto.decode(reader, reader.uint32()));
3108
            break;
3109
          }
3110
          case 15: {
3111
            if (!(message.sparseInitializer && message.sparseInitializer.length)) message.sparseInitializer = [];
3112
            message.sparseInitializer.push($root.onnx.SparseTensorProto.decode(reader, reader.uint32()));
3113
            break;
3114
          }
3115
          case 10: {
3116
            message.docString = reader.string();
3117
            break;
3118
          }
3119
          case 11: {
3120
            if (!(message.input && message.input.length)) message.input = [];
3121
            message.input.push($root.onnx.ValueInfoProto.decode(reader, reader.uint32()));
3122
            break;
3123
          }
3124
          case 12: {
3125
            if (!(message.output && message.output.length)) message.output = [];
3126
            message.output.push($root.onnx.ValueInfoProto.decode(reader, reader.uint32()));
3127
            break;
3128
          }
3129
          case 13: {
3130
            if (!(message.valueInfo && message.valueInfo.length)) message.valueInfo = [];
3131
            message.valueInfo.push($root.onnx.ValueInfoProto.decode(reader, reader.uint32()));
3132
            break;
3133
          }
3134
          case 14: {
3135
            if (!(message.quantizationAnnotation && message.quantizationAnnotation.length))
3136
              message.quantizationAnnotation = [];
3137
            message.quantizationAnnotation.push($root.onnx.TensorAnnotation.decode(reader, reader.uint32()));
3138
            break;
3139
          }
3140
          default:
3141
            reader.skipType(tag & 7);
3142
            break;
3143
        }
3144
      }
3145
      return message;
3146
    };
3147

3148
    /**
3149
     * Decodes a GraphProto message from the specified reader or buffer, length delimited.
3150
     * @function decodeDelimited
3151
     * @memberof onnx.GraphProto
3152
     * @static
3153
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3154
     * @returns {onnx.GraphProto} GraphProto
3155
     * @throws {Error} If the payload is not a reader or valid buffer
3156
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
3157
     */
3158
    GraphProto.decodeDelimited = function decodeDelimited(reader) {
3159
      if (!(reader instanceof $Reader)) reader = new $Reader(reader);
3160
      return this.decode(reader, reader.uint32());
3161
    };
3162

3163
    /**
3164
     * Verifies a GraphProto message.
3165
     * @function verify
3166
     * @memberof onnx.GraphProto
3167
     * @static
3168
     * @param {Object.<string,*>} message Plain object to verify
3169
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
3170
     */
3171
    GraphProto.verify = function verify(message) {
3172
      if (typeof message !== 'object' || message === null) return 'object expected';
3173
      if (message.node != null && message.hasOwnProperty('node')) {
3174
        if (!Array.isArray(message.node)) return 'node: array expected';
3175
        for (var i = 0; i < message.node.length; ++i) {
3176
          var error = $root.onnx.NodeProto.verify(message.node[i]);
3177
          if (error) return 'node.' + error;
3178
        }
3179
      }
3180
      if (message.name != null && message.hasOwnProperty('name'))
3181
        if (!$util.isString(message.name)) return 'name: string expected';
3182
      if (message.initializer != null && message.hasOwnProperty('initializer')) {
3183
        if (!Array.isArray(message.initializer)) return 'initializer: array expected';
3184
        for (var i = 0; i < message.initializer.length; ++i) {
3185
          var error = $root.onnx.TensorProto.verify(message.initializer[i]);
3186
          if (error) return 'initializer.' + error;
3187
        }
3188
      }
3189
      if (message.sparseInitializer != null && message.hasOwnProperty('sparseInitializer')) {
3190
        if (!Array.isArray(message.sparseInitializer)) return 'sparseInitializer: array expected';
3191
        for (var i = 0; i < message.sparseInitializer.length; ++i) {
3192
          var error = $root.onnx.SparseTensorProto.verify(message.sparseInitializer[i]);
3193
          if (error) return 'sparseInitializer.' + error;
3194
        }
3195
      }
3196
      if (message.docString != null && message.hasOwnProperty('docString'))
3197
        if (!$util.isString(message.docString)) return 'docString: string expected';
3198
      if (message.input != null && message.hasOwnProperty('input')) {
3199
        if (!Array.isArray(message.input)) return 'input: array expected';
3200
        for (var i = 0; i < message.input.length; ++i) {
3201
          var error = $root.onnx.ValueInfoProto.verify(message.input[i]);
3202
          if (error) return 'input.' + error;
3203
        }
3204
      }
3205
      if (message.output != null && message.hasOwnProperty('output')) {
3206
        if (!Array.isArray(message.output)) return 'output: array expected';
3207
        for (var i = 0; i < message.output.length; ++i) {
3208
          var error = $root.onnx.ValueInfoProto.verify(message.output[i]);
3209
          if (error) return 'output.' + error;
3210
        }
3211
      }
3212
      if (message.valueInfo != null && message.hasOwnProperty('valueInfo')) {
3213
        if (!Array.isArray(message.valueInfo)) return 'valueInfo: array expected';
3214
        for (var i = 0; i < message.valueInfo.length; ++i) {
3215
          var error = $root.onnx.ValueInfoProto.verify(message.valueInfo[i]);
3216
          if (error) return 'valueInfo.' + error;
3217
        }
3218
      }
3219
      if (message.quantizationAnnotation != null && message.hasOwnProperty('quantizationAnnotation')) {
3220
        if (!Array.isArray(message.quantizationAnnotation)) return 'quantizationAnnotation: array expected';
3221
        for (var i = 0; i < message.quantizationAnnotation.length; ++i) {
3222
          var error = $root.onnx.TensorAnnotation.verify(message.quantizationAnnotation[i]);
3223
          if (error) return 'quantizationAnnotation.' + error;
3224
        }
3225
      }
3226
      return null;
3227
    };
3228

3229
    /**
3230
     * Creates a GraphProto message from a plain object. Also converts values to their respective internal types.
3231
     * @function fromObject
3232
     * @memberof onnx.GraphProto
3233
     * @static
3234
     * @param {Object.<string,*>} object Plain object
3235
     * @returns {onnx.GraphProto} GraphProto
3236
     */
3237
    GraphProto.fromObject = function fromObject(object) {
3238
      if (object instanceof $root.onnx.GraphProto) return object;
3239
      var message = new $root.onnx.GraphProto();
3240
      if (object.node) {
3241
        if (!Array.isArray(object.node)) throw TypeError('.onnx.GraphProto.node: array expected');
3242
        message.node = [];
3243
        for (var i = 0; i < object.node.length; ++i) {
3244
          if (typeof object.node[i] !== 'object') throw TypeError('.onnx.GraphProto.node: object expected');
3245
          message.node[i] = $root.onnx.NodeProto.fromObject(object.node[i]);
3246
        }
3247
      }
3248
      if (object.name != null) message.name = String(object.name);
3249
      if (object.initializer) {
3250
        if (!Array.isArray(object.initializer)) throw TypeError('.onnx.GraphProto.initializer: array expected');
3251
        message.initializer = [];
3252
        for (var i = 0; i < object.initializer.length; ++i) {
3253
          if (typeof object.initializer[i] !== 'object')
3254
            throw TypeError('.onnx.GraphProto.initializer: object expected');
3255
          message.initializer[i] = $root.onnx.TensorProto.fromObject(object.initializer[i]);
3256
        }
3257
      }
3258
      if (object.sparseInitializer) {
3259
        if (!Array.isArray(object.sparseInitializer))
3260
          throw TypeError('.onnx.GraphProto.sparseInitializer: array expected');
3261
        message.sparseInitializer = [];
3262
        for (var i = 0; i < object.sparseInitializer.length; ++i) {
3263
          if (typeof object.sparseInitializer[i] !== 'object')
3264
            throw TypeError('.onnx.GraphProto.sparseInitializer: object expected');
3265
          message.sparseInitializer[i] = $root.onnx.SparseTensorProto.fromObject(object.sparseInitializer[i]);
3266
        }
3267
      }
3268
      if (object.docString != null) message.docString = String(object.docString);
3269
      if (object.input) {
3270
        if (!Array.isArray(object.input)) throw TypeError('.onnx.GraphProto.input: array expected');
3271
        message.input = [];
3272
        for (var i = 0; i < object.input.length; ++i) {
3273
          if (typeof object.input[i] !== 'object') throw TypeError('.onnx.GraphProto.input: object expected');
3274
          message.input[i] = $root.onnx.ValueInfoProto.fromObject(object.input[i]);
3275
        }
3276
      }
3277
      if (object.output) {
3278
        if (!Array.isArray(object.output)) throw TypeError('.onnx.GraphProto.output: array expected');
3279
        message.output = [];
3280
        for (var i = 0; i < object.output.length; ++i) {
3281
          if (typeof object.output[i] !== 'object') throw TypeError('.onnx.GraphProto.output: object expected');
3282
          message.output[i] = $root.onnx.ValueInfoProto.fromObject(object.output[i]);
3283
        }
3284
      }
3285
      if (object.valueInfo) {
3286
        if (!Array.isArray(object.valueInfo)) throw TypeError('.onnx.GraphProto.valueInfo: array expected');
3287
        message.valueInfo = [];
3288
        for (var i = 0; i < object.valueInfo.length; ++i) {
3289
          if (typeof object.valueInfo[i] !== 'object') throw TypeError('.onnx.GraphProto.valueInfo: object expected');
3290
          message.valueInfo[i] = $root.onnx.ValueInfoProto.fromObject(object.valueInfo[i]);
3291
        }
3292
      }
3293
      if (object.quantizationAnnotation) {
3294
        if (!Array.isArray(object.quantizationAnnotation))
3295
          throw TypeError('.onnx.GraphProto.quantizationAnnotation: array expected');
3296
        message.quantizationAnnotation = [];
3297
        for (var i = 0; i < object.quantizationAnnotation.length; ++i) {
3298
          if (typeof object.quantizationAnnotation[i] !== 'object')
3299
            throw TypeError('.onnx.GraphProto.quantizationAnnotation: object expected');
3300
          message.quantizationAnnotation[i] = $root.onnx.TensorAnnotation.fromObject(object.quantizationAnnotation[i]);
3301
        }
3302
      }
3303
      return message;
3304
    };
3305

3306
    /**
3307
     * Creates a plain object from a GraphProto message. Also converts values to other types if specified.
3308
     * @function toObject
3309
     * @memberof onnx.GraphProto
3310
     * @static
3311
     * @param {onnx.GraphProto} message GraphProto
3312
     * @param {$protobuf.IConversionOptions} [options] Conversion options
3313
     * @returns {Object.<string,*>} Plain object
3314
     */
3315
    GraphProto.toObject = function toObject(message, options) {
3316
      if (!options) options = {};
3317
      var object = {};
3318
      if (options.arrays || options.defaults) {
3319
        object.node = [];
3320
        object.initializer = [];
3321
        object.input = [];
3322
        object.output = [];
3323
        object.valueInfo = [];
3324
        object.quantizationAnnotation = [];
3325
        object.sparseInitializer = [];
3326
      }
3327
      if (options.defaults) {
3328
        object.name = '';
3329
        object.docString = '';
3330
      }
3331
      if (message.node && message.node.length) {
3332
        object.node = [];
3333
        for (var j = 0; j < message.node.length; ++j)
3334
          object.node[j] = $root.onnx.NodeProto.toObject(message.node[j], options);
3335
      }
3336
      if (message.name != null && message.hasOwnProperty('name')) object.name = message.name;
3337
      if (message.initializer && message.initializer.length) {
3338
        object.initializer = [];
3339
        for (var j = 0; j < message.initializer.length; ++j)
3340
          object.initializer[j] = $root.onnx.TensorProto.toObject(message.initializer[j], options);
3341
      }
3342
      if (message.docString != null && message.hasOwnProperty('docString')) object.docString = message.docString;
3343
      if (message.input && message.input.length) {
3344
        object.input = [];
3345
        for (var j = 0; j < message.input.length; ++j)
3346
          object.input[j] = $root.onnx.ValueInfoProto.toObject(message.input[j], options);
3347
      }
3348
      if (message.output && message.output.length) {
3349
        object.output = [];
3350
        for (var j = 0; j < message.output.length; ++j)
3351
          object.output[j] = $root.onnx.ValueInfoProto.toObject(message.output[j], options);
3352
      }
3353
      if (message.valueInfo && message.valueInfo.length) {
3354
        object.valueInfo = [];
3355
        for (var j = 0; j < message.valueInfo.length; ++j)
3356
          object.valueInfo[j] = $root.onnx.ValueInfoProto.toObject(message.valueInfo[j], options);
3357
      }
3358
      if (message.quantizationAnnotation && message.quantizationAnnotation.length) {
3359
        object.quantizationAnnotation = [];
3360
        for (var j = 0; j < message.quantizationAnnotation.length; ++j)
3361
          object.quantizationAnnotation[j] = $root.onnx.TensorAnnotation.toObject(
3362
            message.quantizationAnnotation[j],
3363
            options,
3364
          );
3365
      }
3366
      if (message.sparseInitializer && message.sparseInitializer.length) {
3367
        object.sparseInitializer = [];
3368
        for (var j = 0; j < message.sparseInitializer.length; ++j)
3369
          object.sparseInitializer[j] = $root.onnx.SparseTensorProto.toObject(message.sparseInitializer[j], options);
3370
      }
3371
      return object;
3372
    };
3373

3374
    /**
3375
     * Converts this GraphProto to JSON.
3376
     * @function toJSON
3377
     * @memberof onnx.GraphProto
3378
     * @instance
3379
     * @returns {Object.<string,*>} JSON object
3380
     */
3381
    GraphProto.prototype.toJSON = function toJSON() {
3382
      return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
3383
    };
3384

3385
    /**
3386
     * Gets the default type url for GraphProto
3387
     * @function getTypeUrl
3388
     * @memberof onnx.GraphProto
3389
     * @static
3390
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
3391
     * @returns {string} The default type url
3392
     */
3393
    GraphProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
3394
      if (typeUrlPrefix === undefined) {
3395
        typeUrlPrefix = 'type.googleapis.com';
3396
      }
3397
      return typeUrlPrefix + '/onnx.GraphProto';
3398
    };
3399

3400
    return GraphProto;
3401
  })();
3402

3403
  onnx.TensorProto = (function () {
3404
    /**
3405
     * Properties of a TensorProto.
3406
     * @memberof onnx
3407
     * @interface ITensorProto
3408
     * @property {Array.<number|Long>|null} [dims] TensorProto dims
3409
     * @property {number|null} [dataType] TensorProto dataType
3410
     * @property {onnx.TensorProto.ISegment|null} [segment] TensorProto segment
3411
     * @property {Array.<number>|null} [floatData] TensorProto floatData
3412
     * @property {Array.<number>|null} [int32Data] TensorProto int32Data
3413
     * @property {Array.<Uint8Array>|null} [stringData] TensorProto stringData
3414
     * @property {Array.<number|Long>|null} [int64Data] TensorProto int64Data
3415
     * @property {string|null} [name] TensorProto name
3416
     * @property {string|null} [docString] TensorProto docString
3417
     * @property {Uint8Array|null} [rawData] TensorProto rawData
3418
     * @property {Array.<onnx.IStringStringEntryProto>|null} [externalData] TensorProto externalData
3419
     * @property {onnx.TensorProto.DataLocation|null} [dataLocation] TensorProto dataLocation
3420
     * @property {Array.<number>|null} [doubleData] TensorProto doubleData
3421
     * @property {Array.<number|Long>|null} [uint64Data] TensorProto uint64Data
3422
     */
3423

3424
    /**
3425
     * Constructs a new TensorProto.
3426
     * @memberof onnx
3427
     * @classdesc Represents a TensorProto.
3428
     * @implements ITensorProto
3429
     * @constructor
3430
     * @param {onnx.ITensorProto=} [properties] Properties to set
3431
     */
3432
    function TensorProto(properties) {
3433
      this.dims = [];
3434
      this.floatData = [];
3435
      this.int32Data = [];
3436
      this.stringData = [];
3437
      this.int64Data = [];
3438
      this.externalData = [];
3439
      this.doubleData = [];
3440
      this.uint64Data = [];
3441
      if (properties)
3442
        for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
3443
          if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
3444
    }
3445

3446
    /**
3447
     * TensorProto dims.
3448
     * @member {Array.<number|Long>} dims
3449
     * @memberof onnx.TensorProto
3450
     * @instance
3451
     */
3452
    TensorProto.prototype.dims = $util.emptyArray;
3453

3454
    /**
3455
     * TensorProto dataType.
3456
     * @member {number} dataType
3457
     * @memberof onnx.TensorProto
3458
     * @instance
3459
     */
3460
    TensorProto.prototype.dataType = 0;
3461

3462
    /**
3463
     * TensorProto segment.
3464
     * @member {onnx.TensorProto.ISegment|null|undefined} segment
3465
     * @memberof onnx.TensorProto
3466
     * @instance
3467
     */
3468
    TensorProto.prototype.segment = null;
3469

3470
    /**
3471
     * TensorProto floatData.
3472
     * @member {Array.<number>} floatData
3473
     * @memberof onnx.TensorProto
3474
     * @instance
3475
     */
3476
    TensorProto.prototype.floatData = $util.emptyArray;
3477

3478
    /**
3479
     * TensorProto int32Data.
3480
     * @member {Array.<number>} int32Data
3481
     * @memberof onnx.TensorProto
3482
     * @instance
3483
     */
3484
    TensorProto.prototype.int32Data = $util.emptyArray;
3485

3486
    /**
3487
     * TensorProto stringData.
3488
     * @member {Array.<Uint8Array>} stringData
3489
     * @memberof onnx.TensorProto
3490
     * @instance
3491
     */
3492
    TensorProto.prototype.stringData = $util.emptyArray;
3493

3494
    /**
3495
     * TensorProto int64Data.
3496
     * @member {Array.<number|Long>} int64Data
3497
     * @memberof onnx.TensorProto
3498
     * @instance
3499
     */
3500
    TensorProto.prototype.int64Data = $util.emptyArray;
3501

3502
    /**
3503
     * TensorProto name.
3504
     * @member {string} name
3505
     * @memberof onnx.TensorProto
3506
     * @instance
3507
     */
3508
    TensorProto.prototype.name = '';
3509

3510
    /**
3511
     * TensorProto docString.
3512
     * @member {string} docString
3513
     * @memberof onnx.TensorProto
3514
     * @instance
3515
     */
3516
    TensorProto.prototype.docString = '';
3517

3518
    /**
3519
     * TensorProto rawData.
3520
     * @member {Uint8Array} rawData
3521
     * @memberof onnx.TensorProto
3522
     * @instance
3523
     */
3524
    TensorProto.prototype.rawData = $util.newBuffer([]);
3525

3526
    /**
3527
     * TensorProto externalData.
3528
     * @member {Array.<onnx.IStringStringEntryProto>} externalData
3529
     * @memberof onnx.TensorProto
3530
     * @instance
3531
     */
3532
    TensorProto.prototype.externalData = $util.emptyArray;
3533

3534
    /**
3535
     * TensorProto dataLocation.
3536
     * @member {onnx.TensorProto.DataLocation} dataLocation
3537
     * @memberof onnx.TensorProto
3538
     * @instance
3539
     */
3540
    TensorProto.prototype.dataLocation = 0;
3541

3542
    /**
3543
     * TensorProto doubleData.
3544
     * @member {Array.<number>} doubleData
3545
     * @memberof onnx.TensorProto
3546
     * @instance
3547
     */
3548
    TensorProto.prototype.doubleData = $util.emptyArray;
3549

3550
    /**
3551
     * TensorProto uint64Data.
3552
     * @member {Array.<number|Long>} uint64Data
3553
     * @memberof onnx.TensorProto
3554
     * @instance
3555
     */
3556
    TensorProto.prototype.uint64Data = $util.emptyArray;
3557

3558
    /**
3559
     * Creates a new TensorProto instance using the specified properties.
3560
     * @function create
3561
     * @memberof onnx.TensorProto
3562
     * @static
3563
     * @param {onnx.ITensorProto=} [properties] Properties to set
3564
     * @returns {onnx.TensorProto} TensorProto instance
3565
     */
3566
    TensorProto.create = function create(properties) {
3567
      return new TensorProto(properties);
3568
    };
3569

3570
    /**
3571
     * Encodes the specified TensorProto message. Does not implicitly {@link onnx.TensorProto.verify|verify} messages.
3572
     * @function encode
3573
     * @memberof onnx.TensorProto
3574
     * @static
3575
     * @param {onnx.ITensorProto} message TensorProto message or plain object to encode
3576
     * @param {$protobuf.Writer} [writer] Writer to encode to
3577
     * @returns {$protobuf.Writer} Writer
3578
     */
3579
    TensorProto.encode = function encode(message, writer) {
3580
      if (!writer) writer = $Writer.create();
3581
      if (message.dims != null && message.dims.length) {
3582
        writer.uint32(/* id 1, wireType 2 =*/ 10).fork();
3583
        for (var i = 0; i < message.dims.length; ++i) writer.int64(message.dims[i]);
3584
        writer.ldelim();
3585
      }
3586
      if (message.dataType != null && Object.hasOwnProperty.call(message, 'dataType'))
3587
        writer.uint32(/* id 2, wireType 0 =*/ 16).int32(message.dataType);
3588
      if (message.segment != null && Object.hasOwnProperty.call(message, 'segment'))
3589
        $root.onnx.TensorProto.Segment.encode(
3590
          message.segment,
3591
          writer.uint32(/* id 3, wireType 2 =*/ 26).fork(),
3592
        ).ldelim();
3593
      if (message.floatData != null && message.floatData.length) {
3594
        writer.uint32(/* id 4, wireType 2 =*/ 34).fork();
3595
        for (var i = 0; i < message.floatData.length; ++i) writer.float(message.floatData[i]);
3596
        writer.ldelim();
3597
      }
3598
      if (message.int32Data != null && message.int32Data.length) {
3599
        writer.uint32(/* id 5, wireType 2 =*/ 42).fork();
3600
        for (var i = 0; i < message.int32Data.length; ++i) writer.int32(message.int32Data[i]);
3601
        writer.ldelim();
3602
      }
3603
      if (message.stringData != null && message.stringData.length)
3604
        for (var i = 0; i < message.stringData.length; ++i)
3605
          writer.uint32(/* id 6, wireType 2 =*/ 50).bytes(message.stringData[i]);
3606
      if (message.int64Data != null && message.int64Data.length) {
3607
        writer.uint32(/* id 7, wireType 2 =*/ 58).fork();
3608
        for (var i = 0; i < message.int64Data.length; ++i) writer.int64(message.int64Data[i]);
3609
        writer.ldelim();
3610
      }
3611
      if (message.name != null && Object.hasOwnProperty.call(message, 'name'))
3612
        writer.uint32(/* id 8, wireType 2 =*/ 66).string(message.name);
3613
      if (message.rawData != null && Object.hasOwnProperty.call(message, 'rawData'))
3614
        writer.uint32(/* id 9, wireType 2 =*/ 74).bytes(message.rawData);
3615
      if (message.doubleData != null && message.doubleData.length) {
3616
        writer.uint32(/* id 10, wireType 2 =*/ 82).fork();
3617
        for (var i = 0; i < message.doubleData.length; ++i) writer.double(message.doubleData[i]);
3618
        writer.ldelim();
3619
      }
3620
      if (message.uint64Data != null && message.uint64Data.length) {
3621
        writer.uint32(/* id 11, wireType 2 =*/ 90).fork();
3622
        for (var i = 0; i < message.uint64Data.length; ++i) writer.uint64(message.uint64Data[i]);
3623
        writer.ldelim();
3624
      }
3625
      if (message.docString != null && Object.hasOwnProperty.call(message, 'docString'))
3626
        writer.uint32(/* id 12, wireType 2 =*/ 98).string(message.docString);
3627
      if (message.externalData != null && message.externalData.length)
3628
        for (var i = 0; i < message.externalData.length; ++i)
3629
          $root.onnx.StringStringEntryProto.encode(
3630
            message.externalData[i],
3631
            writer.uint32(/* id 13, wireType 2 =*/ 106).fork(),
3632
          ).ldelim();
3633
      if (message.dataLocation != null && Object.hasOwnProperty.call(message, 'dataLocation'))
3634
        writer.uint32(/* id 14, wireType 0 =*/ 112).int32(message.dataLocation);
3635
      return writer;
3636
    };
3637

3638
    /**
3639
     * Encodes the specified TensorProto message, length delimited. Does not implicitly {@link onnx.TensorProto.verify|verify} messages.
3640
     * @function encodeDelimited
3641
     * @memberof onnx.TensorProto
3642
     * @static
3643
     * @param {onnx.ITensorProto} message TensorProto message or plain object to encode
3644
     * @param {$protobuf.Writer} [writer] Writer to encode to
3645
     * @returns {$protobuf.Writer} Writer
3646
     */
3647
    TensorProto.encodeDelimited = function encodeDelimited(message, writer) {
3648
      return this.encode(message, writer).ldelim();
3649
    };
3650

3651
    /**
3652
     * Decodes a TensorProto message from the specified reader or buffer.
3653
     * @function decode
3654
     * @memberof onnx.TensorProto
3655
     * @static
3656
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3657
     * @param {number} [length] Message length if known beforehand
3658
     * @returns {onnx.TensorProto} TensorProto
3659
     * @throws {Error} If the payload is not a reader or valid buffer
3660
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
3661
     */
3662
    TensorProto.decode = function decode(reader, length) {
3663
      if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
3664
      var end = length === undefined ? reader.len : reader.pos + length,
3665
        message = new $root.onnx.TensorProto();
3666
      while (reader.pos < end) {
3667
        var tag = reader.uint32();
3668
        switch (tag >>> 3) {
3669
          case 1: {
3670
            if (!(message.dims && message.dims.length)) message.dims = [];
3671
            if ((tag & 7) === 2) {
3672
              var end2 = reader.uint32() + reader.pos;
3673
              while (reader.pos < end2) message.dims.push(reader.int64());
3674
            } else message.dims.push(reader.int64());
3675
            break;
3676
          }
3677
          case 2: {
3678
            message.dataType = reader.int32();
3679
            break;
3680
          }
3681
          case 3: {
3682
            message.segment = $root.onnx.TensorProto.Segment.decode(reader, reader.uint32());
3683
            break;
3684
          }
3685
          case 4: {
3686
            if (!(message.floatData && message.floatData.length)) message.floatData = [];
3687
            if ((tag & 7) === 2) {
3688
              var end2 = reader.uint32() + reader.pos;
3689
              while (reader.pos < end2) message.floatData.push(reader.float());
3690
            } else message.floatData.push(reader.float());
3691
            break;
3692
          }
3693
          case 5: {
3694
            if (!(message.int32Data && message.int32Data.length)) message.int32Data = [];
3695
            if ((tag & 7) === 2) {
3696
              var end2 = reader.uint32() + reader.pos;
3697
              while (reader.pos < end2) message.int32Data.push(reader.int32());
3698
            } else message.int32Data.push(reader.int32());
3699
            break;
3700
          }
3701
          case 6: {
3702
            if (!(message.stringData && message.stringData.length)) message.stringData = [];
3703
            message.stringData.push(reader.bytes());
3704
            break;
3705
          }
3706
          case 7: {
3707
            if (!(message.int64Data && message.int64Data.length)) message.int64Data = [];
3708
            if ((tag & 7) === 2) {
3709
              var end2 = reader.uint32() + reader.pos;
3710
              while (reader.pos < end2) message.int64Data.push(reader.int64());
3711
            } else message.int64Data.push(reader.int64());
3712
            break;
3713
          }
3714
          case 8: {
3715
            message.name = reader.string();
3716
            break;
3717
          }
3718
          case 12: {
3719
            message.docString = reader.string();
3720
            break;
3721
          }
3722
          case 9: {
3723
            message.rawData = reader.bytes();
3724
            break;
3725
          }
3726
          case 13: {
3727
            if (!(message.externalData && message.externalData.length)) message.externalData = [];
3728
            message.externalData.push($root.onnx.StringStringEntryProto.decode(reader, reader.uint32()));
3729
            break;
3730
          }
3731
          case 14: {
3732
            message.dataLocation = reader.int32();
3733
            break;
3734
          }
3735
          case 10: {
3736
            if (!(message.doubleData && message.doubleData.length)) message.doubleData = [];
3737
            if ((tag & 7) === 2) {
3738
              var end2 = reader.uint32() + reader.pos;
3739
              while (reader.pos < end2) message.doubleData.push(reader.double());
3740
            } else message.doubleData.push(reader.double());
3741
            break;
3742
          }
3743
          case 11: {
3744
            if (!(message.uint64Data && message.uint64Data.length)) message.uint64Data = [];
3745
            if ((tag & 7) === 2) {
3746
              var end2 = reader.uint32() + reader.pos;
3747
              while (reader.pos < end2) message.uint64Data.push(reader.uint64());
3748
            } else message.uint64Data.push(reader.uint64());
3749
            break;
3750
          }
3751
          default:
3752
            reader.skipType(tag & 7);
3753
            break;
3754
        }
3755
      }
3756
      return message;
3757
    };
3758

3759
    /**
3760
     * Decodes a TensorProto message from the specified reader or buffer, length delimited.
3761
     * @function decodeDelimited
3762
     * @memberof onnx.TensorProto
3763
     * @static
3764
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3765
     * @returns {onnx.TensorProto} TensorProto
3766
     * @throws {Error} If the payload is not a reader or valid buffer
3767
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
3768
     */
3769
    TensorProto.decodeDelimited = function decodeDelimited(reader) {
3770
      if (!(reader instanceof $Reader)) reader = new $Reader(reader);
3771
      return this.decode(reader, reader.uint32());
3772
    };
3773

3774
    /**
3775
     * Verifies a TensorProto message.
3776
     * @function verify
3777
     * @memberof onnx.TensorProto
3778
     * @static
3779
     * @param {Object.<string,*>} message Plain object to verify
3780
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
3781
     */
3782
    TensorProto.verify = function verify(message) {
3783
      if (typeof message !== 'object' || message === null) return 'object expected';
3784
      if (message.dims != null && message.hasOwnProperty('dims')) {
3785
        if (!Array.isArray(message.dims)) return 'dims: array expected';
3786
        for (var i = 0; i < message.dims.length; ++i)
3787
          if (
3788
            !$util.isInteger(message.dims[i]) &&
3789
            !(message.dims[i] && $util.isInteger(message.dims[i].low) && $util.isInteger(message.dims[i].high))
3790
          )
3791
            return 'dims: integer|Long[] expected';
3792
      }
3793
      if (message.dataType != null && message.hasOwnProperty('dataType'))
3794
        if (!$util.isInteger(message.dataType)) return 'dataType: integer expected';
3795
      if (message.segment != null && message.hasOwnProperty('segment')) {
3796
        var error = $root.onnx.TensorProto.Segment.verify(message.segment);
3797
        if (error) return 'segment.' + error;
3798
      }
3799
      if (message.floatData != null && message.hasOwnProperty('floatData')) {
3800
        if (!Array.isArray(message.floatData)) return 'floatData: array expected';
3801
        for (var i = 0; i < message.floatData.length; ++i)
3802
          if (typeof message.floatData[i] !== 'number') return 'floatData: number[] expected';
3803
      }
3804
      if (message.int32Data != null && message.hasOwnProperty('int32Data')) {
3805
        if (!Array.isArray(message.int32Data)) return 'int32Data: array expected';
3806
        for (var i = 0; i < message.int32Data.length; ++i)
3807
          if (!$util.isInteger(message.int32Data[i])) return 'int32Data: integer[] expected';
3808
      }
3809
      if (message.stringData != null && message.hasOwnProperty('stringData')) {
3810
        if (!Array.isArray(message.stringData)) return 'stringData: array expected';
3811
        for (var i = 0; i < message.stringData.length; ++i)
3812
          if (
3813
            !(
3814
              (message.stringData[i] && typeof message.stringData[i].length === 'number') ||
3815
              $util.isString(message.stringData[i])
3816
            )
3817
          )
3818
            return 'stringData: buffer[] expected';
3819
      }
3820
      if (message.int64Data != null && message.hasOwnProperty('int64Data')) {
3821
        if (!Array.isArray(message.int64Data)) return 'int64Data: array expected';
3822
        for (var i = 0; i < message.int64Data.length; ++i)
3823
          if (
3824
            !$util.isInteger(message.int64Data[i]) &&
3825
            !(
3826
              message.int64Data[i] &&
3827
              $util.isInteger(message.int64Data[i].low) &&
3828
              $util.isInteger(message.int64Data[i].high)
3829
            )
3830
          )
3831
            return 'int64Data: integer|Long[] expected';
3832
      }
3833
      if (message.name != null && message.hasOwnProperty('name'))
3834
        if (!$util.isString(message.name)) return 'name: string expected';
3835
      if (message.docString != null && message.hasOwnProperty('docString'))
3836
        if (!$util.isString(message.docString)) return 'docString: string expected';
3837
      if (message.rawData != null && message.hasOwnProperty('rawData'))
3838
        if (!((message.rawData && typeof message.rawData.length === 'number') || $util.isString(message.rawData)))
3839
          return 'rawData: buffer expected';
3840
      if (message.externalData != null && message.hasOwnProperty('externalData')) {
3841
        if (!Array.isArray(message.externalData)) return 'externalData: array expected';
3842
        for (var i = 0; i < message.externalData.length; ++i) {
3843
          var error = $root.onnx.StringStringEntryProto.verify(message.externalData[i]);
3844
          if (error) return 'externalData.' + error;
3845
        }
3846
      }
3847
      if (message.dataLocation != null && message.hasOwnProperty('dataLocation'))
3848
        switch (message.dataLocation) {
3849
          default:
3850
            return 'dataLocation: enum value expected';
3851
          case 0:
3852
          case 1:
3853
            break;
3854
        }
3855
      if (message.doubleData != null && message.hasOwnProperty('doubleData')) {
3856
        if (!Array.isArray(message.doubleData)) return 'doubleData: array expected';
3857
        for (var i = 0; i < message.doubleData.length; ++i)
3858
          if (typeof message.doubleData[i] !== 'number') return 'doubleData: number[] expected';
3859
      }
3860
      if (message.uint64Data != null && message.hasOwnProperty('uint64Data')) {
3861
        if (!Array.isArray(message.uint64Data)) return 'uint64Data: array expected';
3862
        for (var i = 0; i < message.uint64Data.length; ++i)
3863
          if (
3864
            !$util.isInteger(message.uint64Data[i]) &&
3865
            !(
3866
              message.uint64Data[i] &&
3867
              $util.isInteger(message.uint64Data[i].low) &&
3868
              $util.isInteger(message.uint64Data[i].high)
3869
            )
3870
          )
3871
            return 'uint64Data: integer|Long[] expected';
3872
      }
3873
      return null;
3874
    };
3875

3876
    /**
3877
     * Creates a TensorProto message from a plain object. Also converts values to their respective internal types.
3878
     * @function fromObject
3879
     * @memberof onnx.TensorProto
3880
     * @static
3881
     * @param {Object.<string,*>} object Plain object
3882
     * @returns {onnx.TensorProto} TensorProto
3883
     */
3884
    TensorProto.fromObject = function fromObject(object) {
3885
      if (object instanceof $root.onnx.TensorProto) return object;
3886
      var message = new $root.onnx.TensorProto();
3887
      if (object.dims) {
3888
        if (!Array.isArray(object.dims)) throw TypeError('.onnx.TensorProto.dims: array expected');
3889
        message.dims = [];
3890
        for (var i = 0; i < object.dims.length; ++i)
3891
          if ($util.Long) (message.dims[i] = $util.Long.fromValue(object.dims[i])).unsigned = false;
3892
          else if (typeof object.dims[i] === 'string') message.dims[i] = parseInt(object.dims[i], 10);
3893
          else if (typeof object.dims[i] === 'number') message.dims[i] = object.dims[i];
3894
          else if (typeof object.dims[i] === 'object')
3895
            message.dims[i] = new $util.LongBits(object.dims[i].low >>> 0, object.dims[i].high >>> 0).toNumber();
3896
      }
3897
      if (object.dataType != null) message.dataType = object.dataType | 0;
3898
      if (object.segment != null) {
3899
        if (typeof object.segment !== 'object') throw TypeError('.onnx.TensorProto.segment: object expected');
3900
        message.segment = $root.onnx.TensorProto.Segment.fromObject(object.segment);
3901
      }
3902
      if (object.floatData) {
3903
        if (!Array.isArray(object.floatData)) throw TypeError('.onnx.TensorProto.floatData: array expected');
3904
        message.floatData = [];
3905
        for (var i = 0; i < object.floatData.length; ++i) message.floatData[i] = Number(object.floatData[i]);
3906
      }
3907
      if (object.int32Data) {
3908
        if (!Array.isArray(object.int32Data)) throw TypeError('.onnx.TensorProto.int32Data: array expected');
3909
        message.int32Data = [];
3910
        for (var i = 0; i < object.int32Data.length; ++i) message.int32Data[i] = object.int32Data[i] | 0;
3911
      }
3912
      if (object.stringData) {
3913
        if (!Array.isArray(object.stringData)) throw TypeError('.onnx.TensorProto.stringData: array expected');
3914
        message.stringData = [];
3915
        for (var i = 0; i < object.stringData.length; ++i)
3916
          if (typeof object.stringData[i] === 'string')
3917
            $util.base64.decode(
3918
              object.stringData[i],
3919
              (message.stringData[i] = $util.newBuffer($util.base64.length(object.stringData[i]))),
3920
              0,
3921
            );
3922
          else if (object.stringData[i].length >= 0) message.stringData[i] = object.stringData[i];
3923
      }
3924
      if (object.int64Data) {
3925
        if (!Array.isArray(object.int64Data)) throw TypeError('.onnx.TensorProto.int64Data: array expected');
3926
        message.int64Data = [];
3927
        for (var i = 0; i < object.int64Data.length; ++i)
3928
          if ($util.Long) (message.int64Data[i] = $util.Long.fromValue(object.int64Data[i])).unsigned = false;
3929
          else if (typeof object.int64Data[i] === 'string') message.int64Data[i] = parseInt(object.int64Data[i], 10);
3930
          else if (typeof object.int64Data[i] === 'number') message.int64Data[i] = object.int64Data[i];
3931
          else if (typeof object.int64Data[i] === 'object')
3932
            message.int64Data[i] = new $util.LongBits(
3933
              object.int64Data[i].low >>> 0,
3934
              object.int64Data[i].high >>> 0,
3935
            ).toNumber();
3936
      }
3937
      if (object.name != null) message.name = String(object.name);
3938
      if (object.docString != null) message.docString = String(object.docString);
3939
      if (object.rawData != null)
3940
        if (typeof object.rawData === 'string')
3941
          $util.base64.decode(
3942
            object.rawData,
3943
            (message.rawData = $util.newBuffer($util.base64.length(object.rawData))),
3944
            0,
3945
          );
3946
        else if (object.rawData.length >= 0) message.rawData = object.rawData;
3947
      if (object.externalData) {
3948
        if (!Array.isArray(object.externalData)) throw TypeError('.onnx.TensorProto.externalData: array expected');
3949
        message.externalData = [];
3950
        for (var i = 0; i < object.externalData.length; ++i) {
3951
          if (typeof object.externalData[i] !== 'object')
3952
            throw TypeError('.onnx.TensorProto.externalData: object expected');
3953
          message.externalData[i] = $root.onnx.StringStringEntryProto.fromObject(object.externalData[i]);
3954
        }
3955
      }
3956
      switch (object.dataLocation) {
3957
        default:
3958
          if (typeof object.dataLocation === 'number') {
3959
            message.dataLocation = object.dataLocation;
3960
            break;
3961
          }
3962
          break;
3963
        case 'DEFAULT':
3964
        case 0:
3965
          message.dataLocation = 0;
3966
          break;
3967
        case 'EXTERNAL':
3968
        case 1:
3969
          message.dataLocation = 1;
3970
          break;
3971
      }
3972
      if (object.doubleData) {
3973
        if (!Array.isArray(object.doubleData)) throw TypeError('.onnx.TensorProto.doubleData: array expected');
3974
        message.doubleData = [];
3975
        for (var i = 0; i < object.doubleData.length; ++i) message.doubleData[i] = Number(object.doubleData[i]);
3976
      }
3977
      if (object.uint64Data) {
3978
        if (!Array.isArray(object.uint64Data)) throw TypeError('.onnx.TensorProto.uint64Data: array expected');
3979
        message.uint64Data = [];
3980
        for (var i = 0; i < object.uint64Data.length; ++i)
3981
          if ($util.Long) (message.uint64Data[i] = $util.Long.fromValue(object.uint64Data[i])).unsigned = true;
3982
          else if (typeof object.uint64Data[i] === 'string') message.uint64Data[i] = parseInt(object.uint64Data[i], 10);
3983
          else if (typeof object.uint64Data[i] === 'number') message.uint64Data[i] = object.uint64Data[i];
3984
          else if (typeof object.uint64Data[i] === 'object')
3985
            message.uint64Data[i] = new $util.LongBits(
3986
              object.uint64Data[i].low >>> 0,
3987
              object.uint64Data[i].high >>> 0,
3988
            ).toNumber(true);
3989
      }
3990
      return message;
3991
    };
3992

3993
    /**
3994
     * Creates a plain object from a TensorProto message. Also converts values to other types if specified.
3995
     * @function toObject
3996
     * @memberof onnx.TensorProto
3997
     * @static
3998
     * @param {onnx.TensorProto} message TensorProto
3999
     * @param {$protobuf.IConversionOptions} [options] Conversion options
4000
     * @returns {Object.<string,*>} Plain object
4001
     */
4002
    TensorProto.toObject = function toObject(message, options) {
4003
      if (!options) options = {};
4004
      var object = {};
4005
      if (options.arrays || options.defaults) {
4006
        object.dims = [];
4007
        object.floatData = [];
4008
        object.int32Data = [];
4009
        object.stringData = [];
4010
        object.int64Data = [];
4011
        object.doubleData = [];
4012
        object.uint64Data = [];
4013
        object.externalData = [];
4014
      }
4015
      if (options.defaults) {
4016
        object.dataType = 0;
4017
        object.segment = null;
4018
        object.name = '';
4019
        if (options.bytes === String) object.rawData = '';
4020
        else {
4021
          object.rawData = [];
4022
          if (options.bytes !== Array) object.rawData = $util.newBuffer(object.rawData);
4023
        }
4024
        object.docString = '';
4025
        object.dataLocation = options.enums === String ? 'DEFAULT' : 0;
4026
      }
4027
      if (message.dims && message.dims.length) {
4028
        object.dims = [];
4029
        for (var j = 0; j < message.dims.length; ++j)
4030
          if (typeof message.dims[j] === 'number')
4031
            object.dims[j] = options.longs === String ? String(message.dims[j]) : message.dims[j];
4032
          else
4033
            object.dims[j] =
4034
              options.longs === String
4035
                ? $util.Long.prototype.toString.call(message.dims[j])
4036
                : options.longs === Number
4037
                  ? new $util.LongBits(message.dims[j].low >>> 0, message.dims[j].high >>> 0).toNumber()
4038
                  : message.dims[j];
4039
      }
4040
      if (message.dataType != null && message.hasOwnProperty('dataType')) object.dataType = message.dataType;
4041
      if (message.segment != null && message.hasOwnProperty('segment'))
4042
        object.segment = $root.onnx.TensorProto.Segment.toObject(message.segment, options);
4043
      if (message.floatData && message.floatData.length) {
4044
        object.floatData = [];
4045
        for (var j = 0; j < message.floatData.length; ++j)
4046
          object.floatData[j] =
4047
            options.json && !isFinite(message.floatData[j]) ? String(message.floatData[j]) : message.floatData[j];
4048
      }
4049
      if (message.int32Data && message.int32Data.length) {
4050
        object.int32Data = [];
4051
        for (var j = 0; j < message.int32Data.length; ++j) object.int32Data[j] = message.int32Data[j];
4052
      }
4053
      if (message.stringData && message.stringData.length) {
4054
        object.stringData = [];
4055
        for (var j = 0; j < message.stringData.length; ++j)
4056
          object.stringData[j] =
4057
            options.bytes === String
4058
              ? $util.base64.encode(message.stringData[j], 0, message.stringData[j].length)
4059
              : options.bytes === Array
4060
                ? Array.prototype.slice.call(message.stringData[j])
4061
                : message.stringData[j];
4062
      }
4063
      if (message.int64Data && message.int64Data.length) {
4064
        object.int64Data = [];
4065
        for (var j = 0; j < message.int64Data.length; ++j)
4066
          if (typeof message.int64Data[j] === 'number')
4067
            object.int64Data[j] = options.longs === String ? String(message.int64Data[j]) : message.int64Data[j];
4068
          else
4069
            object.int64Data[j] =
4070
              options.longs === String
4071
                ? $util.Long.prototype.toString.call(message.int64Data[j])
4072
                : options.longs === Number
4073
                  ? new $util.LongBits(message.int64Data[j].low >>> 0, message.int64Data[j].high >>> 0).toNumber()
4074
                  : message.int64Data[j];
4075
      }
4076
      if (message.name != null && message.hasOwnProperty('name')) object.name = message.name;
4077
      if (message.rawData != null && message.hasOwnProperty('rawData'))
4078
        object.rawData =
4079
          options.bytes === String
4080
            ? $util.base64.encode(message.rawData, 0, message.rawData.length)
4081
            : options.bytes === Array
4082
              ? Array.prototype.slice.call(message.rawData)
4083
              : message.rawData;
4084
      if (message.doubleData && message.doubleData.length) {
4085
        object.doubleData = [];
4086
        for (var j = 0; j < message.doubleData.length; ++j)
4087
          object.doubleData[j] =
4088
            options.json && !isFinite(message.doubleData[j]) ? String(message.doubleData[j]) : message.doubleData[j];
4089
      }
4090
      if (message.uint64Data && message.uint64Data.length) {
4091
        object.uint64Data = [];
4092
        for (var j = 0; j < message.uint64Data.length; ++j)
4093
          if (typeof message.uint64Data[j] === 'number')
4094
            object.uint64Data[j] = options.longs === String ? String(message.uint64Data[j]) : message.uint64Data[j];
4095
          else
4096
            object.uint64Data[j] =
4097
              options.longs === String
4098
                ? $util.Long.prototype.toString.call(message.uint64Data[j])
4099
                : options.longs === Number
4100
                  ? new $util.LongBits(message.uint64Data[j].low >>> 0, message.uint64Data[j].high >>> 0).toNumber(true)
4101
                  : message.uint64Data[j];
4102
      }
4103
      if (message.docString != null && message.hasOwnProperty('docString')) object.docString = message.docString;
4104
      if (message.externalData && message.externalData.length) {
4105
        object.externalData = [];
4106
        for (var j = 0; j < message.externalData.length; ++j)
4107
          object.externalData[j] = $root.onnx.StringStringEntryProto.toObject(message.externalData[j], options);
4108
      }
4109
      if (message.dataLocation != null && message.hasOwnProperty('dataLocation'))
4110
        object.dataLocation =
4111
          options.enums === String
4112
            ? $root.onnx.TensorProto.DataLocation[message.dataLocation] === undefined
4113
              ? message.dataLocation
4114
              : $root.onnx.TensorProto.DataLocation[message.dataLocation]
4115
            : message.dataLocation;
4116
      return object;
4117
    };
4118

4119
    /**
4120
     * Converts this TensorProto to JSON.
4121
     * @function toJSON
4122
     * @memberof onnx.TensorProto
4123
     * @instance
4124
     * @returns {Object.<string,*>} JSON object
4125
     */
4126
    TensorProto.prototype.toJSON = function toJSON() {
4127
      return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
4128
    };
4129

4130
    /**
4131
     * Gets the default type url for TensorProto
4132
     * @function getTypeUrl
4133
     * @memberof onnx.TensorProto
4134
     * @static
4135
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
4136
     * @returns {string} The default type url
4137
     */
4138
    TensorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
4139
      if (typeUrlPrefix === undefined) {
4140
        typeUrlPrefix = 'type.googleapis.com';
4141
      }
4142
      return typeUrlPrefix + '/onnx.TensorProto';
4143
    };
4144

4145
    /**
4146
     * DataType enum.
4147
     * @name onnx.TensorProto.DataType
4148
     * @enum {number}
4149
     * @property {number} UNDEFINED=0 UNDEFINED value
4150
     * @property {number} FLOAT=1 FLOAT value
4151
     * @property {number} UINT8=2 UINT8 value
4152
     * @property {number} INT8=3 INT8 value
4153
     * @property {number} UINT16=4 UINT16 value
4154
     * @property {number} INT16=5 INT16 value
4155
     * @property {number} INT32=6 INT32 value
4156
     * @property {number} INT64=7 INT64 value
4157
     * @property {number} STRING=8 STRING value
4158
     * @property {number} BOOL=9 BOOL value
4159
     * @property {number} FLOAT16=10 FLOAT16 value
4160
     * @property {number} DOUBLE=11 DOUBLE value
4161
     * @property {number} UINT32=12 UINT32 value
4162
     * @property {number} UINT64=13 UINT64 value
4163
     * @property {number} COMPLEX64=14 COMPLEX64 value
4164
     * @property {number} COMPLEX128=15 COMPLEX128 value
4165
     * @property {number} BFLOAT16=16 BFLOAT16 value
4166
     * @property {number} FLOAT8E4M3FN=17 FLOAT8E4M3FN value
4167
     * @property {number} FLOAT8E4M3FNUZ=18 FLOAT8E4M3FNUZ value
4168
     * @property {number} FLOAT8E5M2=19 FLOAT8E5M2 value
4169
     * @property {number} FLOAT8E5M2FNUZ=20 FLOAT8E5M2FNUZ value
4170
     */
4171
    TensorProto.DataType = (function () {
4172
      var valuesById = {},
4173
        values = Object.create(valuesById);
4174
      values[(valuesById[0] = 'UNDEFINED')] = 0;
4175
      values[(valuesById[1] = 'FLOAT')] = 1;
4176
      values[(valuesById[2] = 'UINT8')] = 2;
4177
      values[(valuesById[3] = 'INT8')] = 3;
4178
      values[(valuesById[4] = 'UINT16')] = 4;
4179
      values[(valuesById[5] = 'INT16')] = 5;
4180
      values[(valuesById[6] = 'INT32')] = 6;
4181
      values[(valuesById[7] = 'INT64')] = 7;
4182
      values[(valuesById[8] = 'STRING')] = 8;
4183
      values[(valuesById[9] = 'BOOL')] = 9;
4184
      values[(valuesById[10] = 'FLOAT16')] = 10;
4185
      values[(valuesById[11] = 'DOUBLE')] = 11;
4186
      values[(valuesById[12] = 'UINT32')] = 12;
4187
      values[(valuesById[13] = 'UINT64')] = 13;
4188
      values[(valuesById[14] = 'COMPLEX64')] = 14;
4189
      values[(valuesById[15] = 'COMPLEX128')] = 15;
4190
      values[(valuesById[16] = 'BFLOAT16')] = 16;
4191
      values[(valuesById[17] = 'FLOAT8E4M3FN')] = 17;
4192
      values[(valuesById[18] = 'FLOAT8E4M3FNUZ')] = 18;
4193
      values[(valuesById[19] = 'FLOAT8E5M2')] = 19;
4194
      values[(valuesById[20] = 'FLOAT8E5M2FNUZ')] = 20;
4195
      return values;
4196
    })();
4197

4198
    TensorProto.Segment = (function () {
4199
      /**
4200
       * Properties of a Segment.
4201
       * @memberof onnx.TensorProto
4202
       * @interface ISegment
4203
       * @property {number|Long|null} [begin] Segment begin
4204
       * @property {number|Long|null} [end] Segment end
4205
       */
4206

4207
      /**
4208
       * Constructs a new Segment.
4209
       * @memberof onnx.TensorProto
4210
       * @classdesc Represents a Segment.
4211
       * @implements ISegment
4212
       * @constructor
4213
       * @param {onnx.TensorProto.ISegment=} [properties] Properties to set
4214
       */
4215
      function Segment(properties) {
4216
        if (properties)
4217
          for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
4218
            if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
4219
      }
4220

4221
      /**
4222
       * Segment begin.
4223
       * @member {number|Long} begin
4224
       * @memberof onnx.TensorProto.Segment
4225
       * @instance
4226
       */
4227
      Segment.prototype.begin = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
4228

4229
      /**
4230
       * Segment end.
4231
       * @member {number|Long} end
4232
       * @memberof onnx.TensorProto.Segment
4233
       * @instance
4234
       */
4235
      Segment.prototype.end = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
4236

4237
      /**
4238
       * Creates a new Segment instance using the specified properties.
4239
       * @function create
4240
       * @memberof onnx.TensorProto.Segment
4241
       * @static
4242
       * @param {onnx.TensorProto.ISegment=} [properties] Properties to set
4243
       * @returns {onnx.TensorProto.Segment} Segment instance
4244
       */
4245
      Segment.create = function create(properties) {
4246
        return new Segment(properties);
4247
      };
4248

4249
      /**
4250
       * Encodes the specified Segment message. Does not implicitly {@link onnx.TensorProto.Segment.verify|verify} messages.
4251
       * @function encode
4252
       * @memberof onnx.TensorProto.Segment
4253
       * @static
4254
       * @param {onnx.TensorProto.ISegment} message Segment message or plain object to encode
4255
       * @param {$protobuf.Writer} [writer] Writer to encode to
4256
       * @returns {$protobuf.Writer} Writer
4257
       */
4258
      Segment.encode = function encode(message, writer) {
4259
        if (!writer) writer = $Writer.create();
4260
        if (message.begin != null && Object.hasOwnProperty.call(message, 'begin'))
4261
          writer.uint32(/* id 1, wireType 0 =*/ 8).int64(message.begin);
4262
        if (message.end != null && Object.hasOwnProperty.call(message, 'end'))
4263
          writer.uint32(/* id 2, wireType 0 =*/ 16).int64(message.end);
4264
        return writer;
4265
      };
4266

4267
      /**
4268
       * Encodes the specified Segment message, length delimited. Does not implicitly {@link onnx.TensorProto.Segment.verify|verify} messages.
4269
       * @function encodeDelimited
4270
       * @memberof onnx.TensorProto.Segment
4271
       * @static
4272
       * @param {onnx.TensorProto.ISegment} message Segment message or plain object to encode
4273
       * @param {$protobuf.Writer} [writer] Writer to encode to
4274
       * @returns {$protobuf.Writer} Writer
4275
       */
4276
      Segment.encodeDelimited = function encodeDelimited(message, writer) {
4277
        return this.encode(message, writer).ldelim();
4278
      };
4279

4280
      /**
4281
       * Decodes a Segment message from the specified reader or buffer.
4282
       * @function decode
4283
       * @memberof onnx.TensorProto.Segment
4284
       * @static
4285
       * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
4286
       * @param {number} [length] Message length if known beforehand
4287
       * @returns {onnx.TensorProto.Segment} Segment
4288
       * @throws {Error} If the payload is not a reader or valid buffer
4289
       * @throws {$protobuf.util.ProtocolError} If required fields are missing
4290
       */
4291
      Segment.decode = function decode(reader, length) {
4292
        if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
4293
        var end = length === undefined ? reader.len : reader.pos + length,
4294
          message = new $root.onnx.TensorProto.Segment();
4295
        while (reader.pos < end) {
4296
          var tag = reader.uint32();
4297
          switch (tag >>> 3) {
4298
            case 1: {
4299
              message.begin = reader.int64();
4300
              break;
4301
            }
4302
            case 2: {
4303
              message.end = reader.int64();
4304
              break;
4305
            }
4306
            default:
4307
              reader.skipType(tag & 7);
4308
              break;
4309
          }
4310
        }
4311
        return message;
4312
      };
4313

4314
      /**
4315
       * Decodes a Segment message from the specified reader or buffer, length delimited.
4316
       * @function decodeDelimited
4317
       * @memberof onnx.TensorProto.Segment
4318
       * @static
4319
       * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
4320
       * @returns {onnx.TensorProto.Segment} Segment
4321
       * @throws {Error} If the payload is not a reader or valid buffer
4322
       * @throws {$protobuf.util.ProtocolError} If required fields are missing
4323
       */
4324
      Segment.decodeDelimited = function decodeDelimited(reader) {
4325
        if (!(reader instanceof $Reader)) reader = new $Reader(reader);
4326
        return this.decode(reader, reader.uint32());
4327
      };
4328

4329
      /**
4330
       * Verifies a Segment message.
4331
       * @function verify
4332
       * @memberof onnx.TensorProto.Segment
4333
       * @static
4334
       * @param {Object.<string,*>} message Plain object to verify
4335
       * @returns {string|null} `null` if valid, otherwise the reason why it is not
4336
       */
4337
      Segment.verify = function verify(message) {
4338
        if (typeof message !== 'object' || message === null) return 'object expected';
4339
        if (message.begin != null && message.hasOwnProperty('begin'))
4340
          if (
4341
            !$util.isInteger(message.begin) &&
4342
            !(message.begin && $util.isInteger(message.begin.low) && $util.isInteger(message.begin.high))
4343
          )
4344
            return 'begin: integer|Long expected';
4345
        if (message.end != null && message.hasOwnProperty('end'))
4346
          if (
4347
            !$util.isInteger(message.end) &&
4348
            !(message.end && $util.isInteger(message.end.low) && $util.isInteger(message.end.high))
4349
          )
4350
            return 'end: integer|Long expected';
4351
        return null;
4352
      };
4353

4354
      /**
4355
       * Creates a Segment message from a plain object. Also converts values to their respective internal types.
4356
       * @function fromObject
4357
       * @memberof onnx.TensorProto.Segment
4358
       * @static
4359
       * @param {Object.<string,*>} object Plain object
4360
       * @returns {onnx.TensorProto.Segment} Segment
4361
       */
4362
      Segment.fromObject = function fromObject(object) {
4363
        if (object instanceof $root.onnx.TensorProto.Segment) return object;
4364
        var message = new $root.onnx.TensorProto.Segment();
4365
        if (object.begin != null)
4366
          if ($util.Long) (message.begin = $util.Long.fromValue(object.begin)).unsigned = false;
4367
          else if (typeof object.begin === 'string') message.begin = parseInt(object.begin, 10);
4368
          else if (typeof object.begin === 'number') message.begin = object.begin;
4369
          else if (typeof object.begin === 'object')
4370
            message.begin = new $util.LongBits(object.begin.low >>> 0, object.begin.high >>> 0).toNumber();
4371
        if (object.end != null)
4372
          if ($util.Long) (message.end = $util.Long.fromValue(object.end)).unsigned = false;
4373
          else if (typeof object.end === 'string') message.end = parseInt(object.end, 10);
4374
          else if (typeof object.end === 'number') message.end = object.end;
4375
          else if (typeof object.end === 'object')
4376
            message.end = new $util.LongBits(object.end.low >>> 0, object.end.high >>> 0).toNumber();
4377
        return message;
4378
      };
4379

4380
      /**
4381
       * Creates a plain object from a Segment message. Also converts values to other types if specified.
4382
       * @function toObject
4383
       * @memberof onnx.TensorProto.Segment
4384
       * @static
4385
       * @param {onnx.TensorProto.Segment} message Segment
4386
       * @param {$protobuf.IConversionOptions} [options] Conversion options
4387
       * @returns {Object.<string,*>} Plain object
4388
       */
4389
      Segment.toObject = function toObject(message, options) {
4390
        if (!options) options = {};
4391
        var object = {};
4392
        if (options.defaults) {
4393
          if ($util.Long) {
4394
            var long = new $util.Long(0, 0, false);
4395
            object.begin =
4396
              options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
4397
          } else object.begin = options.longs === String ? '0' : 0;
4398
          if ($util.Long) {
4399
            var long = new $util.Long(0, 0, false);
4400
            object.end = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
4401
          } else object.end = options.longs === String ? '0' : 0;
4402
        }
4403
        if (message.begin != null && message.hasOwnProperty('begin'))
4404
          if (typeof message.begin === 'number')
4405
            object.begin = options.longs === String ? String(message.begin) : message.begin;
4406
          else
4407
            object.begin =
4408
              options.longs === String
4409
                ? $util.Long.prototype.toString.call(message.begin)
4410
                : options.longs === Number
4411
                  ? new $util.LongBits(message.begin.low >>> 0, message.begin.high >>> 0).toNumber()
4412
                  : message.begin;
4413
        if (message.end != null && message.hasOwnProperty('end'))
4414
          if (typeof message.end === 'number')
4415
            object.end = options.longs === String ? String(message.end) : message.end;
4416
          else
4417
            object.end =
4418
              options.longs === String
4419
                ? $util.Long.prototype.toString.call(message.end)
4420
                : options.longs === Number
4421
                  ? new $util.LongBits(message.end.low >>> 0, message.end.high >>> 0).toNumber()
4422
                  : message.end;
4423
        return object;
4424
      };
4425

4426
      /**
4427
       * Converts this Segment to JSON.
4428
       * @function toJSON
4429
       * @memberof onnx.TensorProto.Segment
4430
       * @instance
4431
       * @returns {Object.<string,*>} JSON object
4432
       */
4433
      Segment.prototype.toJSON = function toJSON() {
4434
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
4435
      };
4436

4437
      /**
4438
       * Gets the default type url for Segment
4439
       * @function getTypeUrl
4440
       * @memberof onnx.TensorProto.Segment
4441
       * @static
4442
       * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
4443
       * @returns {string} The default type url
4444
       */
4445
      Segment.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
4446
        if (typeUrlPrefix === undefined) {
4447
          typeUrlPrefix = 'type.googleapis.com';
4448
        }
4449
        return typeUrlPrefix + '/onnx.TensorProto.Segment';
4450
      };
4451

4452
      return Segment;
4453
    })();
4454

4455
    /**
4456
     * DataLocation enum.
4457
     * @name onnx.TensorProto.DataLocation
4458
     * @enum {number}
4459
     * @property {number} DEFAULT=0 DEFAULT value
4460
     * @property {number} EXTERNAL=1 EXTERNAL value
4461
     */
4462
    TensorProto.DataLocation = (function () {
4463
      var valuesById = {},
4464
        values = Object.create(valuesById);
4465
      values[(valuesById[0] = 'DEFAULT')] = 0;
4466
      values[(valuesById[1] = 'EXTERNAL')] = 1;
4467
      return values;
4468
    })();
4469

4470
    return TensorProto;
4471
  })();
4472

4473
  onnx.SparseTensorProto = (function () {
4474
    /**
4475
     * Properties of a SparseTensorProto.
4476
     * @memberof onnx
4477
     * @interface ISparseTensorProto
4478
     * @property {onnx.ITensorProto|null} [values] SparseTensorProto values
4479
     * @property {onnx.ITensorProto|null} [indices] SparseTensorProto indices
4480
     * @property {Array.<number|Long>|null} [dims] SparseTensorProto dims
4481
     */
4482

4483
    /**
4484
     * Constructs a new SparseTensorProto.
4485
     * @memberof onnx
4486
     * @classdesc Represents a SparseTensorProto.
4487
     * @implements ISparseTensorProto
4488
     * @constructor
4489
     * @param {onnx.ISparseTensorProto=} [properties] Properties to set
4490
     */
4491
    function SparseTensorProto(properties) {
4492
      this.dims = [];
4493
      if (properties)
4494
        for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
4495
          if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
4496
    }
4497

4498
    /**
4499
     * SparseTensorProto values.
4500
     * @member {onnx.ITensorProto|null|undefined} values
4501
     * @memberof onnx.SparseTensorProto
4502
     * @instance
4503
     */
4504
    SparseTensorProto.prototype.values = null;
4505

4506
    /**
4507
     * SparseTensorProto indices.
4508
     * @member {onnx.ITensorProto|null|undefined} indices
4509
     * @memberof onnx.SparseTensorProto
4510
     * @instance
4511
     */
4512
    SparseTensorProto.prototype.indices = null;
4513

4514
    /**
4515
     * SparseTensorProto dims.
4516
     * @member {Array.<number|Long>} dims
4517
     * @memberof onnx.SparseTensorProto
4518
     * @instance
4519
     */
4520
    SparseTensorProto.prototype.dims = $util.emptyArray;
4521

4522
    /**
4523
     * Creates a new SparseTensorProto instance using the specified properties.
4524
     * @function create
4525
     * @memberof onnx.SparseTensorProto
4526
     * @static
4527
     * @param {onnx.ISparseTensorProto=} [properties] Properties to set
4528
     * @returns {onnx.SparseTensorProto} SparseTensorProto instance
4529
     */
4530
    SparseTensorProto.create = function create(properties) {
4531
      return new SparseTensorProto(properties);
4532
    };
4533

4534
    /**
4535
     * Encodes the specified SparseTensorProto message. Does not implicitly {@link onnx.SparseTensorProto.verify|verify} messages.
4536
     * @function encode
4537
     * @memberof onnx.SparseTensorProto
4538
     * @static
4539
     * @param {onnx.ISparseTensorProto} message SparseTensorProto message or plain object to encode
4540
     * @param {$protobuf.Writer} [writer] Writer to encode to
4541
     * @returns {$protobuf.Writer} Writer
4542
     */
4543
    SparseTensorProto.encode = function encode(message, writer) {
4544
      if (!writer) writer = $Writer.create();
4545
      if (message.values != null && Object.hasOwnProperty.call(message, 'values'))
4546
        $root.onnx.TensorProto.encode(message.values, writer.uint32(/* id 1, wireType 2 =*/ 10).fork()).ldelim();
4547
      if (message.indices != null && Object.hasOwnProperty.call(message, 'indices'))
4548
        $root.onnx.TensorProto.encode(message.indices, writer.uint32(/* id 2, wireType 2 =*/ 18).fork()).ldelim();
4549
      if (message.dims != null && message.dims.length) {
4550
        writer.uint32(/* id 3, wireType 2 =*/ 26).fork();
4551
        for (var i = 0; i < message.dims.length; ++i) writer.int64(message.dims[i]);
4552
        writer.ldelim();
4553
      }
4554
      return writer;
4555
    };
4556

4557
    /**
4558
     * Encodes the specified SparseTensorProto message, length delimited. Does not implicitly {@link onnx.SparseTensorProto.verify|verify} messages.
4559
     * @function encodeDelimited
4560
     * @memberof onnx.SparseTensorProto
4561
     * @static
4562
     * @param {onnx.ISparseTensorProto} message SparseTensorProto message or plain object to encode
4563
     * @param {$protobuf.Writer} [writer] Writer to encode to
4564
     * @returns {$protobuf.Writer} Writer
4565
     */
4566
    SparseTensorProto.encodeDelimited = function encodeDelimited(message, writer) {
4567
      return this.encode(message, writer).ldelim();
4568
    };
4569

4570
    /**
4571
     * Decodes a SparseTensorProto message from the specified reader or buffer.
4572
     * @function decode
4573
     * @memberof onnx.SparseTensorProto
4574
     * @static
4575
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
4576
     * @param {number} [length] Message length if known beforehand
4577
     * @returns {onnx.SparseTensorProto} SparseTensorProto
4578
     * @throws {Error} If the payload is not a reader or valid buffer
4579
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
4580
     */
4581
    SparseTensorProto.decode = function decode(reader, length) {
4582
      if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
4583
      var end = length === undefined ? reader.len : reader.pos + length,
4584
        message = new $root.onnx.SparseTensorProto();
4585
      while (reader.pos < end) {
4586
        var tag = reader.uint32();
4587
        switch (tag >>> 3) {
4588
          case 1: {
4589
            message.values = $root.onnx.TensorProto.decode(reader, reader.uint32());
4590
            break;
4591
          }
4592
          case 2: {
4593
            message.indices = $root.onnx.TensorProto.decode(reader, reader.uint32());
4594
            break;
4595
          }
4596
          case 3: {
4597
            if (!(message.dims && message.dims.length)) message.dims = [];
4598
            if ((tag & 7) === 2) {
4599
              var end2 = reader.uint32() + reader.pos;
4600
              while (reader.pos < end2) message.dims.push(reader.int64());
4601
            } else message.dims.push(reader.int64());
4602
            break;
4603
          }
4604
          default:
4605
            reader.skipType(tag & 7);
4606
            break;
4607
        }
4608
      }
4609
      return message;
4610
    };
4611

4612
    /**
4613
     * Decodes a SparseTensorProto message from the specified reader or buffer, length delimited.
4614
     * @function decodeDelimited
4615
     * @memberof onnx.SparseTensorProto
4616
     * @static
4617
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
4618
     * @returns {onnx.SparseTensorProto} SparseTensorProto
4619
     * @throws {Error} If the payload is not a reader or valid buffer
4620
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
4621
     */
4622
    SparseTensorProto.decodeDelimited = function decodeDelimited(reader) {
4623
      if (!(reader instanceof $Reader)) reader = new $Reader(reader);
4624
      return this.decode(reader, reader.uint32());
4625
    };
4626

4627
    /**
4628
     * Verifies a SparseTensorProto message.
4629
     * @function verify
4630
     * @memberof onnx.SparseTensorProto
4631
     * @static
4632
     * @param {Object.<string,*>} message Plain object to verify
4633
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
4634
     */
4635
    SparseTensorProto.verify = function verify(message) {
4636
      if (typeof message !== 'object' || message === null) return 'object expected';
4637
      if (message.values != null && message.hasOwnProperty('values')) {
4638
        var error = $root.onnx.TensorProto.verify(message.values);
4639
        if (error) return 'values.' + error;
4640
      }
4641
      if (message.indices != null && message.hasOwnProperty('indices')) {
4642
        var error = $root.onnx.TensorProto.verify(message.indices);
4643
        if (error) return 'indices.' + error;
4644
      }
4645
      if (message.dims != null && message.hasOwnProperty('dims')) {
4646
        if (!Array.isArray(message.dims)) return 'dims: array expected';
4647
        for (var i = 0; i < message.dims.length; ++i)
4648
          if (
4649
            !$util.isInteger(message.dims[i]) &&
4650
            !(message.dims[i] && $util.isInteger(message.dims[i].low) && $util.isInteger(message.dims[i].high))
4651
          )
4652
            return 'dims: integer|Long[] expected';
4653
      }
4654
      return null;
4655
    };
4656

4657
    /**
4658
     * Creates a SparseTensorProto message from a plain object. Also converts values to their respective internal types.
4659
     * @function fromObject
4660
     * @memberof onnx.SparseTensorProto
4661
     * @static
4662
     * @param {Object.<string,*>} object Plain object
4663
     * @returns {onnx.SparseTensorProto} SparseTensorProto
4664
     */
4665
    SparseTensorProto.fromObject = function fromObject(object) {
4666
      if (object instanceof $root.onnx.SparseTensorProto) return object;
4667
      var message = new $root.onnx.SparseTensorProto();
4668
      if (object.values != null) {
4669
        if (typeof object.values !== 'object') throw TypeError('.onnx.SparseTensorProto.values: object expected');
4670
        message.values = $root.onnx.TensorProto.fromObject(object.values);
4671
      }
4672
      if (object.indices != null) {
4673
        if (typeof object.indices !== 'object') throw TypeError('.onnx.SparseTensorProto.indices: object expected');
4674
        message.indices = $root.onnx.TensorProto.fromObject(object.indices);
4675
      }
4676
      if (object.dims) {
4677
        if (!Array.isArray(object.dims)) throw TypeError('.onnx.SparseTensorProto.dims: array expected');
4678
        message.dims = [];
4679
        for (var i = 0; i < object.dims.length; ++i)
4680
          if ($util.Long) (message.dims[i] = $util.Long.fromValue(object.dims[i])).unsigned = false;
4681
          else if (typeof object.dims[i] === 'string') message.dims[i] = parseInt(object.dims[i], 10);
4682
          else if (typeof object.dims[i] === 'number') message.dims[i] = object.dims[i];
4683
          else if (typeof object.dims[i] === 'object')
4684
            message.dims[i] = new $util.LongBits(object.dims[i].low >>> 0, object.dims[i].high >>> 0).toNumber();
4685
      }
4686
      return message;
4687
    };
4688

4689
    /**
4690
     * Creates a plain object from a SparseTensorProto message. Also converts values to other types if specified.
4691
     * @function toObject
4692
     * @memberof onnx.SparseTensorProto
4693
     * @static
4694
     * @param {onnx.SparseTensorProto} message SparseTensorProto
4695
     * @param {$protobuf.IConversionOptions} [options] Conversion options
4696
     * @returns {Object.<string,*>} Plain object
4697
     */
4698
    SparseTensorProto.toObject = function toObject(message, options) {
4699
      if (!options) options = {};
4700
      var object = {};
4701
      if (options.arrays || options.defaults) object.dims = [];
4702
      if (options.defaults) {
4703
        object.values = null;
4704
        object.indices = null;
4705
      }
4706
      if (message.values != null && message.hasOwnProperty('values'))
4707
        object.values = $root.onnx.TensorProto.toObject(message.values, options);
4708
      if (message.indices != null && message.hasOwnProperty('indices'))
4709
        object.indices = $root.onnx.TensorProto.toObject(message.indices, options);
4710
      if (message.dims && message.dims.length) {
4711
        object.dims = [];
4712
        for (var j = 0; j < message.dims.length; ++j)
4713
          if (typeof message.dims[j] === 'number')
4714
            object.dims[j] = options.longs === String ? String(message.dims[j]) : message.dims[j];
4715
          else
4716
            object.dims[j] =
4717
              options.longs === String
4718
                ? $util.Long.prototype.toString.call(message.dims[j])
4719
                : options.longs === Number
4720
                  ? new $util.LongBits(message.dims[j].low >>> 0, message.dims[j].high >>> 0).toNumber()
4721
                  : message.dims[j];
4722
      }
4723
      return object;
4724
    };
4725

4726
    /**
4727
     * Converts this SparseTensorProto to JSON.
4728
     * @function toJSON
4729
     * @memberof onnx.SparseTensorProto
4730
     * @instance
4731
     * @returns {Object.<string,*>} JSON object
4732
     */
4733
    SparseTensorProto.prototype.toJSON = function toJSON() {
4734
      return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
4735
    };
4736

4737
    /**
4738
     * Gets the default type url for SparseTensorProto
4739
     * @function getTypeUrl
4740
     * @memberof onnx.SparseTensorProto
4741
     * @static
4742
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
4743
     * @returns {string} The default type url
4744
     */
4745
    SparseTensorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
4746
      if (typeUrlPrefix === undefined) {
4747
        typeUrlPrefix = 'type.googleapis.com';
4748
      }
4749
      return typeUrlPrefix + '/onnx.SparseTensorProto';
4750
    };
4751

4752
    return SparseTensorProto;
4753
  })();
4754

4755
  onnx.TensorShapeProto = (function () {
4756
    /**
4757
     * Properties of a TensorShapeProto.
4758
     * @memberof onnx
4759
     * @interface ITensorShapeProto
4760
     * @property {Array.<onnx.TensorShapeProto.IDimension>|null} [dim] TensorShapeProto dim
4761
     */
4762

4763
    /**
4764
     * Constructs a new TensorShapeProto.
4765
     * @memberof onnx
4766
     * @classdesc Represents a TensorShapeProto.
4767
     * @implements ITensorShapeProto
4768
     * @constructor
4769
     * @param {onnx.ITensorShapeProto=} [properties] Properties to set
4770
     */
4771
    function TensorShapeProto(properties) {
4772
      this.dim = [];
4773
      if (properties)
4774
        for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
4775
          if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
4776
    }
4777

4778
    /**
4779
     * TensorShapeProto dim.
4780
     * @member {Array.<onnx.TensorShapeProto.IDimension>} dim
4781
     * @memberof onnx.TensorShapeProto
4782
     * @instance
4783
     */
4784
    TensorShapeProto.prototype.dim = $util.emptyArray;
4785

4786
    /**
4787
     * Creates a new TensorShapeProto instance using the specified properties.
4788
     * @function create
4789
     * @memberof onnx.TensorShapeProto
4790
     * @static
4791
     * @param {onnx.ITensorShapeProto=} [properties] Properties to set
4792
     * @returns {onnx.TensorShapeProto} TensorShapeProto instance
4793
     */
4794
    TensorShapeProto.create = function create(properties) {
4795
      return new TensorShapeProto(properties);
4796
    };
4797

4798
    /**
4799
     * Encodes the specified TensorShapeProto message. Does not implicitly {@link onnx.TensorShapeProto.verify|verify} messages.
4800
     * @function encode
4801
     * @memberof onnx.TensorShapeProto
4802
     * @static
4803
     * @param {onnx.ITensorShapeProto} message TensorShapeProto message or plain object to encode
4804
     * @param {$protobuf.Writer} [writer] Writer to encode to
4805
     * @returns {$protobuf.Writer} Writer
4806
     */
4807
    TensorShapeProto.encode = function encode(message, writer) {
4808
      if (!writer) writer = $Writer.create();
4809
      if (message.dim != null && message.dim.length)
4810
        for (var i = 0; i < message.dim.length; ++i)
4811
          $root.onnx.TensorShapeProto.Dimension.encode(
4812
            message.dim[i],
4813
            writer.uint32(/* id 1, wireType 2 =*/ 10).fork(),
4814
          ).ldelim();
4815
      return writer;
4816
    };
4817

4818
    /**
4819
     * Encodes the specified TensorShapeProto message, length delimited. Does not implicitly {@link onnx.TensorShapeProto.verify|verify} messages.
4820
     * @function encodeDelimited
4821
     * @memberof onnx.TensorShapeProto
4822
     * @static
4823
     * @param {onnx.ITensorShapeProto} message TensorShapeProto message or plain object to encode
4824
     * @param {$protobuf.Writer} [writer] Writer to encode to
4825
     * @returns {$protobuf.Writer} Writer
4826
     */
4827
    TensorShapeProto.encodeDelimited = function encodeDelimited(message, writer) {
4828
      return this.encode(message, writer).ldelim();
4829
    };
4830

4831
    /**
4832
     * Decodes a TensorShapeProto message from the specified reader or buffer.
4833
     * @function decode
4834
     * @memberof onnx.TensorShapeProto
4835
     * @static
4836
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
4837
     * @param {number} [length] Message length if known beforehand
4838
     * @returns {onnx.TensorShapeProto} TensorShapeProto
4839
     * @throws {Error} If the payload is not a reader or valid buffer
4840
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
4841
     */
4842
    TensorShapeProto.decode = function decode(reader, length) {
4843
      if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
4844
      var end = length === undefined ? reader.len : reader.pos + length,
4845
        message = new $root.onnx.TensorShapeProto();
4846
      while (reader.pos < end) {
4847
        var tag = reader.uint32();
4848
        switch (tag >>> 3) {
4849
          case 1: {
4850
            if (!(message.dim && message.dim.length)) message.dim = [];
4851
            message.dim.push($root.onnx.TensorShapeProto.Dimension.decode(reader, reader.uint32()));
4852
            break;
4853
          }
4854
          default:
4855
            reader.skipType(tag & 7);
4856
            break;
4857
        }
4858
      }
4859
      return message;
4860
    };
4861

4862
    /**
4863
     * Decodes a TensorShapeProto message from the specified reader or buffer, length delimited.
4864
     * @function decodeDelimited
4865
     * @memberof onnx.TensorShapeProto
4866
     * @static
4867
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
4868
     * @returns {onnx.TensorShapeProto} TensorShapeProto
4869
     * @throws {Error} If the payload is not a reader or valid buffer
4870
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
4871
     */
4872
    TensorShapeProto.decodeDelimited = function decodeDelimited(reader) {
4873
      if (!(reader instanceof $Reader)) reader = new $Reader(reader);
4874
      return this.decode(reader, reader.uint32());
4875
    };
4876

4877
    /**
4878
     * Verifies a TensorShapeProto message.
4879
     * @function verify
4880
     * @memberof onnx.TensorShapeProto
4881
     * @static
4882
     * @param {Object.<string,*>} message Plain object to verify
4883
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
4884
     */
4885
    TensorShapeProto.verify = function verify(message) {
4886
      if (typeof message !== 'object' || message === null) return 'object expected';
4887
      if (message.dim != null && message.hasOwnProperty('dim')) {
4888
        if (!Array.isArray(message.dim)) return 'dim: array expected';
4889
        for (var i = 0; i < message.dim.length; ++i) {
4890
          var error = $root.onnx.TensorShapeProto.Dimension.verify(message.dim[i]);
4891
          if (error) return 'dim.' + error;
4892
        }
4893
      }
4894
      return null;
4895
    };
4896

4897
    /**
4898
     * Creates a TensorShapeProto message from a plain object. Also converts values to their respective internal types.
4899
     * @function fromObject
4900
     * @memberof onnx.TensorShapeProto
4901
     * @static
4902
     * @param {Object.<string,*>} object Plain object
4903
     * @returns {onnx.TensorShapeProto} TensorShapeProto
4904
     */
4905
    TensorShapeProto.fromObject = function fromObject(object) {
4906
      if (object instanceof $root.onnx.TensorShapeProto) return object;
4907
      var message = new $root.onnx.TensorShapeProto();
4908
      if (object.dim) {
4909
        if (!Array.isArray(object.dim)) throw TypeError('.onnx.TensorShapeProto.dim: array expected');
4910
        message.dim = [];
4911
        for (var i = 0; i < object.dim.length; ++i) {
4912
          if (typeof object.dim[i] !== 'object') throw TypeError('.onnx.TensorShapeProto.dim: object expected');
4913
          message.dim[i] = $root.onnx.TensorShapeProto.Dimension.fromObject(object.dim[i]);
4914
        }
4915
      }
4916
      return message;
4917
    };
4918

4919
    /**
4920
     * Creates a plain object from a TensorShapeProto message. Also converts values to other types if specified.
4921
     * @function toObject
4922
     * @memberof onnx.TensorShapeProto
4923
     * @static
4924
     * @param {onnx.TensorShapeProto} message TensorShapeProto
4925
     * @param {$protobuf.IConversionOptions} [options] Conversion options
4926
     * @returns {Object.<string,*>} Plain object
4927
     */
4928
    TensorShapeProto.toObject = function toObject(message, options) {
4929
      if (!options) options = {};
4930
      var object = {};
4931
      if (options.arrays || options.defaults) object.dim = [];
4932
      if (message.dim && message.dim.length) {
4933
        object.dim = [];
4934
        for (var j = 0; j < message.dim.length; ++j)
4935
          object.dim[j] = $root.onnx.TensorShapeProto.Dimension.toObject(message.dim[j], options);
4936
      }
4937
      return object;
4938
    };
4939

4940
    /**
4941
     * Converts this TensorShapeProto to JSON.
4942
     * @function toJSON
4943
     * @memberof onnx.TensorShapeProto
4944
     * @instance
4945
     * @returns {Object.<string,*>} JSON object
4946
     */
4947
    TensorShapeProto.prototype.toJSON = function toJSON() {
4948
      return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
4949
    };
4950

4951
    /**
4952
     * Gets the default type url for TensorShapeProto
4953
     * @function getTypeUrl
4954
     * @memberof onnx.TensorShapeProto
4955
     * @static
4956
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
4957
     * @returns {string} The default type url
4958
     */
4959
    TensorShapeProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
4960
      if (typeUrlPrefix === undefined) {
4961
        typeUrlPrefix = 'type.googleapis.com';
4962
      }
4963
      return typeUrlPrefix + '/onnx.TensorShapeProto';
4964
    };
4965

4966
    TensorShapeProto.Dimension = (function () {
4967
      /**
4968
       * Properties of a Dimension.
4969
       * @memberof onnx.TensorShapeProto
4970
       * @interface IDimension
4971
       * @property {number|Long|null} [dimValue] Dimension dimValue
4972
       * @property {string|null} [dimParam] Dimension dimParam
4973
       * @property {string|null} [denotation] Dimension denotation
4974
       */
4975

4976
      /**
4977
       * Constructs a new Dimension.
4978
       * @memberof onnx.TensorShapeProto
4979
       * @classdesc Represents a Dimension.
4980
       * @implements IDimension
4981
       * @constructor
4982
       * @param {onnx.TensorShapeProto.IDimension=} [properties] Properties to set
4983
       */
4984
      function Dimension(properties) {
4985
        if (properties)
4986
          for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
4987
            if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
4988
      }
4989

4990
      /**
4991
       * Dimension dimValue.
4992
       * @member {number|Long|null|undefined} dimValue
4993
       * @memberof onnx.TensorShapeProto.Dimension
4994
       * @instance
4995
       */
4996
      Dimension.prototype.dimValue = null;
4997

4998
      /**
4999
       * Dimension dimParam.
5000
       * @member {string|null|undefined} dimParam
5001
       * @memberof onnx.TensorShapeProto.Dimension
5002
       * @instance
5003
       */
5004
      Dimension.prototype.dimParam = null;
5005

5006
      /**
5007
       * Dimension denotation.
5008
       * @member {string} denotation
5009
       * @memberof onnx.TensorShapeProto.Dimension
5010
       * @instance
5011
       */
5012
      Dimension.prototype.denotation = '';
5013

5014
      // OneOf field names bound to virtual getters and setters
5015
      var $oneOfFields;
5016

5017
      /**
5018
       * Dimension value.
5019
       * @member {"dimValue"|"dimParam"|undefined} value
5020
       * @memberof onnx.TensorShapeProto.Dimension
5021
       * @instance
5022
       */
5023
      Object.defineProperty(Dimension.prototype, 'value', {
5024
        get: $util.oneOfGetter(($oneOfFields = ['dimValue', 'dimParam'])),
5025
        set: $util.oneOfSetter($oneOfFields),
5026
      });
5027

5028
      /**
5029
       * Creates a new Dimension instance using the specified properties.
5030
       * @function create
5031
       * @memberof onnx.TensorShapeProto.Dimension
5032
       * @static
5033
       * @param {onnx.TensorShapeProto.IDimension=} [properties] Properties to set
5034
       * @returns {onnx.TensorShapeProto.Dimension} Dimension instance
5035
       */
5036
      Dimension.create = function create(properties) {
5037
        return new Dimension(properties);
5038
      };
5039

5040
      /**
5041
       * Encodes the specified Dimension message. Does not implicitly {@link onnx.TensorShapeProto.Dimension.verify|verify} messages.
5042
       * @function encode
5043
       * @memberof onnx.TensorShapeProto.Dimension
5044
       * @static
5045
       * @param {onnx.TensorShapeProto.IDimension} message Dimension message or plain object to encode
5046
       * @param {$protobuf.Writer} [writer] Writer to encode to
5047
       * @returns {$protobuf.Writer} Writer
5048
       */
5049
      Dimension.encode = function encode(message, writer) {
5050
        if (!writer) writer = $Writer.create();
5051
        if (message.dimValue != null && Object.hasOwnProperty.call(message, 'dimValue'))
5052
          writer.uint32(/* id 1, wireType 0 =*/ 8).int64(message.dimValue);
5053
        if (message.dimParam != null && Object.hasOwnProperty.call(message, 'dimParam'))
5054
          writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.dimParam);
5055
        if (message.denotation != null && Object.hasOwnProperty.call(message, 'denotation'))
5056
          writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.denotation);
5057
        return writer;
5058
      };
5059

5060
      /**
5061
       * Encodes the specified Dimension message, length delimited. Does not implicitly {@link onnx.TensorShapeProto.Dimension.verify|verify} messages.
5062
       * @function encodeDelimited
5063
       * @memberof onnx.TensorShapeProto.Dimension
5064
       * @static
5065
       * @param {onnx.TensorShapeProto.IDimension} message Dimension message or plain object to encode
5066
       * @param {$protobuf.Writer} [writer] Writer to encode to
5067
       * @returns {$protobuf.Writer} Writer
5068
       */
5069
      Dimension.encodeDelimited = function encodeDelimited(message, writer) {
5070
        return this.encode(message, writer).ldelim();
5071
      };
5072

5073
      /**
5074
       * Decodes a Dimension message from the specified reader or buffer.
5075
       * @function decode
5076
       * @memberof onnx.TensorShapeProto.Dimension
5077
       * @static
5078
       * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
5079
       * @param {number} [length] Message length if known beforehand
5080
       * @returns {onnx.TensorShapeProto.Dimension} Dimension
5081
       * @throws {Error} If the payload is not a reader or valid buffer
5082
       * @throws {$protobuf.util.ProtocolError} If required fields are missing
5083
       */
5084
      Dimension.decode = function decode(reader, length) {
5085
        if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
5086
        var end = length === undefined ? reader.len : reader.pos + length,
5087
          message = new $root.onnx.TensorShapeProto.Dimension();
5088
        while (reader.pos < end) {
5089
          var tag = reader.uint32();
5090
          switch (tag >>> 3) {
5091
            case 1: {
5092
              message.dimValue = reader.int64();
5093
              break;
5094
            }
5095
            case 2: {
5096
              message.dimParam = reader.string();
5097
              break;
5098
            }
5099
            case 3: {
5100
              message.denotation = reader.string();
5101
              break;
5102
            }
5103
            default:
5104
              reader.skipType(tag & 7);
5105
              break;
5106
          }
5107
        }
5108
        return message;
5109
      };
5110

5111
      /**
5112
       * Decodes a Dimension message from the specified reader or buffer, length delimited.
5113
       * @function decodeDelimited
5114
       * @memberof onnx.TensorShapeProto.Dimension
5115
       * @static
5116
       * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
5117
       * @returns {onnx.TensorShapeProto.Dimension} Dimension
5118
       * @throws {Error} If the payload is not a reader or valid buffer
5119
       * @throws {$protobuf.util.ProtocolError} If required fields are missing
5120
       */
5121
      Dimension.decodeDelimited = function decodeDelimited(reader) {
5122
        if (!(reader instanceof $Reader)) reader = new $Reader(reader);
5123
        return this.decode(reader, reader.uint32());
5124
      };
5125

5126
      /**
5127
       * Verifies a Dimension message.
5128
       * @function verify
5129
       * @memberof onnx.TensorShapeProto.Dimension
5130
       * @static
5131
       * @param {Object.<string,*>} message Plain object to verify
5132
       * @returns {string|null} `null` if valid, otherwise the reason why it is not
5133
       */
5134
      Dimension.verify = function verify(message) {
5135
        if (typeof message !== 'object' || message === null) return 'object expected';
5136
        var properties = {};
5137
        if (message.dimValue != null && message.hasOwnProperty('dimValue')) {
5138
          properties.value = 1;
5139
          if (
5140
            !$util.isInteger(message.dimValue) &&
5141
            !(message.dimValue && $util.isInteger(message.dimValue.low) && $util.isInteger(message.dimValue.high))
5142
          )
5143
            return 'dimValue: integer|Long expected';
5144
        }
5145
        if (message.dimParam != null && message.hasOwnProperty('dimParam')) {
5146
          if (properties.value === 1) return 'value: multiple values';
5147
          properties.value = 1;
5148
          if (!$util.isString(message.dimParam)) return 'dimParam: string expected';
5149
        }
5150
        if (message.denotation != null && message.hasOwnProperty('denotation'))
5151
          if (!$util.isString(message.denotation)) return 'denotation: string expected';
5152
        return null;
5153
      };
5154

5155
      /**
5156
       * Creates a Dimension message from a plain object. Also converts values to their respective internal types.
5157
       * @function fromObject
5158
       * @memberof onnx.TensorShapeProto.Dimension
5159
       * @static
5160
       * @param {Object.<string,*>} object Plain object
5161
       * @returns {onnx.TensorShapeProto.Dimension} Dimension
5162
       */
5163
      Dimension.fromObject = function fromObject(object) {
5164
        if (object instanceof $root.onnx.TensorShapeProto.Dimension) return object;
5165
        var message = new $root.onnx.TensorShapeProto.Dimension();
5166
        if (object.dimValue != null)
5167
          if ($util.Long) (message.dimValue = $util.Long.fromValue(object.dimValue)).unsigned = false;
5168
          else if (typeof object.dimValue === 'string') message.dimValue = parseInt(object.dimValue, 10);
5169
          else if (typeof object.dimValue === 'number') message.dimValue = object.dimValue;
5170
          else if (typeof object.dimValue === 'object')
5171
            message.dimValue = new $util.LongBits(object.dimValue.low >>> 0, object.dimValue.high >>> 0).toNumber();
5172
        if (object.dimParam != null) message.dimParam = String(object.dimParam);
5173
        if (object.denotation != null) message.denotation = String(object.denotation);
5174
        return message;
5175
      };
5176

5177
      /**
5178
       * Creates a plain object from a Dimension message. Also converts values to other types if specified.
5179
       * @function toObject
5180
       * @memberof onnx.TensorShapeProto.Dimension
5181
       * @static
5182
       * @param {onnx.TensorShapeProto.Dimension} message Dimension
5183
       * @param {$protobuf.IConversionOptions} [options] Conversion options
5184
       * @returns {Object.<string,*>} Plain object
5185
       */
5186
      Dimension.toObject = function toObject(message, options) {
5187
        if (!options) options = {};
5188
        var object = {};
5189
        if (options.defaults) object.denotation = '';
5190
        if (message.dimValue != null && message.hasOwnProperty('dimValue')) {
5191
          if (typeof message.dimValue === 'number')
5192
            object.dimValue = options.longs === String ? String(message.dimValue) : message.dimValue;
5193
          else
5194
            object.dimValue =
5195
              options.longs === String
5196
                ? $util.Long.prototype.toString.call(message.dimValue)
5197
                : options.longs === Number
5198
                  ? new $util.LongBits(message.dimValue.low >>> 0, message.dimValue.high >>> 0).toNumber()
5199
                  : message.dimValue;
5200
          if (options.oneofs) object.value = 'dimValue';
5201
        }
5202
        if (message.dimParam != null && message.hasOwnProperty('dimParam')) {
5203
          object.dimParam = message.dimParam;
5204
          if (options.oneofs) object.value = 'dimParam';
5205
        }
5206
        if (message.denotation != null && message.hasOwnProperty('denotation')) object.denotation = message.denotation;
5207
        return object;
5208
      };
5209

5210
      /**
5211
       * Converts this Dimension to JSON.
5212
       * @function toJSON
5213
       * @memberof onnx.TensorShapeProto.Dimension
5214
       * @instance
5215
       * @returns {Object.<string,*>} JSON object
5216
       */
5217
      Dimension.prototype.toJSON = function toJSON() {
5218
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
5219
      };
5220

5221
      /**
5222
       * Gets the default type url for Dimension
5223
       * @function getTypeUrl
5224
       * @memberof onnx.TensorShapeProto.Dimension
5225
       * @static
5226
       * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
5227
       * @returns {string} The default type url
5228
       */
5229
      Dimension.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
5230
        if (typeUrlPrefix === undefined) {
5231
          typeUrlPrefix = 'type.googleapis.com';
5232
        }
5233
        return typeUrlPrefix + '/onnx.TensorShapeProto.Dimension';
5234
      };
5235

5236
      return Dimension;
5237
    })();
5238

5239
    return TensorShapeProto;
5240
  })();
5241

5242
  onnx.TypeProto = (function () {
5243
    /**
5244
     * Properties of a TypeProto.
5245
     * @memberof onnx
5246
     * @interface ITypeProto
5247
     * @property {onnx.TypeProto.ITensor|null} [tensorType] TypeProto tensorType
5248
     * @property {onnx.TypeProto.ISequence|null} [sequenceType] TypeProto sequenceType
5249
     * @property {onnx.TypeProto.IMap|null} [mapType] TypeProto mapType
5250
     * @property {onnx.TypeProto.IOptional|null} [optionalType] TypeProto optionalType
5251
     * @property {onnx.TypeProto.ISparseTensor|null} [sparseTensorType] TypeProto sparseTensorType
5252
     * @property {string|null} [denotation] TypeProto denotation
5253
     */
5254

5255
    /**
5256
     * Constructs a new TypeProto.
5257
     * @memberof onnx
5258
     * @classdesc Represents a TypeProto.
5259
     * @implements ITypeProto
5260
     * @constructor
5261
     * @param {onnx.ITypeProto=} [properties] Properties to set
5262
     */
5263
    function TypeProto(properties) {
5264
      if (properties)
5265
        for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
5266
          if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
5267
    }
5268

5269
    /**
5270
     * TypeProto tensorType.
5271
     * @member {onnx.TypeProto.ITensor|null|undefined} tensorType
5272
     * @memberof onnx.TypeProto
5273
     * @instance
5274
     */
5275
    TypeProto.prototype.tensorType = null;
5276

5277
    /**
5278
     * TypeProto sequenceType.
5279
     * @member {onnx.TypeProto.ISequence|null|undefined} sequenceType
5280
     * @memberof onnx.TypeProto
5281
     * @instance
5282
     */
5283
    TypeProto.prototype.sequenceType = null;
5284

5285
    /**
5286
     * TypeProto mapType.
5287
     * @member {onnx.TypeProto.IMap|null|undefined} mapType
5288
     * @memberof onnx.TypeProto
5289
     * @instance
5290
     */
5291
    TypeProto.prototype.mapType = null;
5292

5293
    /**
5294
     * TypeProto optionalType.
5295
     * @member {onnx.TypeProto.IOptional|null|undefined} optionalType
5296
     * @memberof onnx.TypeProto
5297
     * @instance
5298
     */
5299
    TypeProto.prototype.optionalType = null;
5300

5301
    /**
5302
     * TypeProto sparseTensorType.
5303
     * @member {onnx.TypeProto.ISparseTensor|null|undefined} sparseTensorType
5304
     * @memberof onnx.TypeProto
5305
     * @instance
5306
     */
5307
    TypeProto.prototype.sparseTensorType = null;
5308

5309
    /**
5310
     * TypeProto denotation.
5311
     * @member {string} denotation
5312
     * @memberof onnx.TypeProto
5313
     * @instance
5314
     */
5315
    TypeProto.prototype.denotation = '';
5316

5317
    // OneOf field names bound to virtual getters and setters
5318
    var $oneOfFields;
5319

5320
    /**
5321
     * TypeProto value.
5322
     * @member {"tensorType"|"sequenceType"|"mapType"|"optionalType"|"sparseTensorType"|undefined} value
5323
     * @memberof onnx.TypeProto
5324
     * @instance
5325
     */
5326
    Object.defineProperty(TypeProto.prototype, 'value', {
5327
      get: $util.oneOfGetter(
5328
        ($oneOfFields = ['tensorType', 'sequenceType', 'mapType', 'optionalType', 'sparseTensorType']),
5329
      ),
5330
      set: $util.oneOfSetter($oneOfFields),
5331
    });
5332

5333
    /**
5334
     * Creates a new TypeProto instance using the specified properties.
5335
     * @function create
5336
     * @memberof onnx.TypeProto
5337
     * @static
5338
     * @param {onnx.ITypeProto=} [properties] Properties to set
5339
     * @returns {onnx.TypeProto} TypeProto instance
5340
     */
5341
    TypeProto.create = function create(properties) {
5342
      return new TypeProto(properties);
5343
    };
5344

5345
    /**
5346
     * Encodes the specified TypeProto message. Does not implicitly {@link onnx.TypeProto.verify|verify} messages.
5347
     * @function encode
5348
     * @memberof onnx.TypeProto
5349
     * @static
5350
     * @param {onnx.ITypeProto} message TypeProto message or plain object to encode
5351
     * @param {$protobuf.Writer} [writer] Writer to encode to
5352
     * @returns {$protobuf.Writer} Writer
5353
     */
5354
    TypeProto.encode = function encode(message, writer) {
5355
      if (!writer) writer = $Writer.create();
5356
      if (message.tensorType != null && Object.hasOwnProperty.call(message, 'tensorType'))
5357
        $root.onnx.TypeProto.Tensor.encode(
5358
          message.tensorType,
5359
          writer.uint32(/* id 1, wireType 2 =*/ 10).fork(),
5360
        ).ldelim();
5361
      if (message.sequenceType != null && Object.hasOwnProperty.call(message, 'sequenceType'))
5362
        $root.onnx.TypeProto.Sequence.encode(
5363
          message.sequenceType,
5364
          writer.uint32(/* id 4, wireType 2 =*/ 34).fork(),
5365
        ).ldelim();
5366
      if (message.mapType != null && Object.hasOwnProperty.call(message, 'mapType'))
5367
        $root.onnx.TypeProto.Map.encode(message.mapType, writer.uint32(/* id 5, wireType 2 =*/ 42).fork()).ldelim();
5368
      if (message.denotation != null && Object.hasOwnProperty.call(message, 'denotation'))
5369
        writer.uint32(/* id 6, wireType 2 =*/ 50).string(message.denotation);
5370
      if (message.sparseTensorType != null && Object.hasOwnProperty.call(message, 'sparseTensorType'))
5371
        $root.onnx.TypeProto.SparseTensor.encode(
5372
          message.sparseTensorType,
5373
          writer.uint32(/* id 8, wireType 2 =*/ 66).fork(),
5374
        ).ldelim();
5375
      if (message.optionalType != null && Object.hasOwnProperty.call(message, 'optionalType'))
5376
        $root.onnx.TypeProto.Optional.encode(
5377
          message.optionalType,
5378
          writer.uint32(/* id 9, wireType 2 =*/ 74).fork(),
5379
        ).ldelim();
5380
      return writer;
5381
    };
5382

5383
    /**
5384
     * Encodes the specified TypeProto message, length delimited. Does not implicitly {@link onnx.TypeProto.verify|verify} messages.
5385
     * @function encodeDelimited
5386
     * @memberof onnx.TypeProto
5387
     * @static
5388
     * @param {onnx.ITypeProto} message TypeProto message or plain object to encode
5389
     * @param {$protobuf.Writer} [writer] Writer to encode to
5390
     * @returns {$protobuf.Writer} Writer
5391
     */
5392
    TypeProto.encodeDelimited = function encodeDelimited(message, writer) {
5393
      return this.encode(message, writer).ldelim();
5394
    };
5395

5396
    /**
5397
     * Decodes a TypeProto message from the specified reader or buffer.
5398
     * @function decode
5399
     * @memberof onnx.TypeProto
5400
     * @static
5401
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
5402
     * @param {number} [length] Message length if known beforehand
5403
     * @returns {onnx.TypeProto} TypeProto
5404
     * @throws {Error} If the payload is not a reader or valid buffer
5405
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
5406
     */
5407
    TypeProto.decode = function decode(reader, length) {
5408
      if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
5409
      var end = length === undefined ? reader.len : reader.pos + length,
5410
        message = new $root.onnx.TypeProto();
5411
      while (reader.pos < end) {
5412
        var tag = reader.uint32();
5413
        switch (tag >>> 3) {
5414
          case 1: {
5415
            message.tensorType = $root.onnx.TypeProto.Tensor.decode(reader, reader.uint32());
5416
            break;
5417
          }
5418
          case 4: {
5419
            message.sequenceType = $root.onnx.TypeProto.Sequence.decode(reader, reader.uint32());
5420
            break;
5421
          }
5422
          case 5: {
5423
            message.mapType = $root.onnx.TypeProto.Map.decode(reader, reader.uint32());
5424
            break;
5425
          }
5426
          case 9: {
5427
            message.optionalType = $root.onnx.TypeProto.Optional.decode(reader, reader.uint32());
5428
            break;
5429
          }
5430
          case 8: {
5431
            message.sparseTensorType = $root.onnx.TypeProto.SparseTensor.decode(reader, reader.uint32());
5432
            break;
5433
          }
5434
          case 6: {
5435
            message.denotation = reader.string();
5436
            break;
5437
          }
5438
          default:
5439
            reader.skipType(tag & 7);
5440
            break;
5441
        }
5442
      }
5443
      return message;
5444
    };
5445

5446
    /**
5447
     * Decodes a TypeProto message from the specified reader or buffer, length delimited.
5448
     * @function decodeDelimited
5449
     * @memberof onnx.TypeProto
5450
     * @static
5451
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
5452
     * @returns {onnx.TypeProto} TypeProto
5453
     * @throws {Error} If the payload is not a reader or valid buffer
5454
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
5455
     */
5456
    TypeProto.decodeDelimited = function decodeDelimited(reader) {
5457
      if (!(reader instanceof $Reader)) reader = new $Reader(reader);
5458
      return this.decode(reader, reader.uint32());
5459
    };
5460

5461
    /**
5462
     * Verifies a TypeProto message.
5463
     * @function verify
5464
     * @memberof onnx.TypeProto
5465
     * @static
5466
     * @param {Object.<string,*>} message Plain object to verify
5467
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
5468
     */
5469
    TypeProto.verify = function verify(message) {
5470
      if (typeof message !== 'object' || message === null) return 'object expected';
5471
      var properties = {};
5472
      if (message.tensorType != null && message.hasOwnProperty('tensorType')) {
5473
        properties.value = 1;
5474
        {
5475
          var error = $root.onnx.TypeProto.Tensor.verify(message.tensorType);
5476
          if (error) return 'tensorType.' + error;
5477
        }
5478
      }
5479
      if (message.sequenceType != null && message.hasOwnProperty('sequenceType')) {
5480
        if (properties.value === 1) return 'value: multiple values';
5481
        properties.value = 1;
5482
        {
5483
          var error = $root.onnx.TypeProto.Sequence.verify(message.sequenceType);
5484
          if (error) return 'sequenceType.' + error;
5485
        }
5486
      }
5487
      if (message.mapType != null && message.hasOwnProperty('mapType')) {
5488
        if (properties.value === 1) return 'value: multiple values';
5489
        properties.value = 1;
5490
        {
5491
          var error = $root.onnx.TypeProto.Map.verify(message.mapType);
5492
          if (error) return 'mapType.' + error;
5493
        }
5494
      }
5495
      if (message.optionalType != null && message.hasOwnProperty('optionalType')) {
5496
        if (properties.value === 1) return 'value: multiple values';
5497
        properties.value = 1;
5498
        {
5499
          var error = $root.onnx.TypeProto.Optional.verify(message.optionalType);
5500
          if (error) return 'optionalType.' + error;
5501
        }
5502
      }
5503
      if (message.sparseTensorType != null && message.hasOwnProperty('sparseTensorType')) {
5504
        if (properties.value === 1) return 'value: multiple values';
5505
        properties.value = 1;
5506
        {
5507
          var error = $root.onnx.TypeProto.SparseTensor.verify(message.sparseTensorType);
5508
          if (error) return 'sparseTensorType.' + error;
5509
        }
5510
      }
5511
      if (message.denotation != null && message.hasOwnProperty('denotation'))
5512
        if (!$util.isString(message.denotation)) return 'denotation: string expected';
5513
      return null;
5514
    };
5515

5516
    /**
5517
     * Creates a TypeProto message from a plain object. Also converts values to their respective internal types.
5518
     * @function fromObject
5519
     * @memberof onnx.TypeProto
5520
     * @static
5521
     * @param {Object.<string,*>} object Plain object
5522
     * @returns {onnx.TypeProto} TypeProto
5523
     */
5524
    TypeProto.fromObject = function fromObject(object) {
5525
      if (object instanceof $root.onnx.TypeProto) return object;
5526
      var message = new $root.onnx.TypeProto();
5527
      if (object.tensorType != null) {
5528
        if (typeof object.tensorType !== 'object') throw TypeError('.onnx.TypeProto.tensorType: object expected');
5529
        message.tensorType = $root.onnx.TypeProto.Tensor.fromObject(object.tensorType);
5530
      }
5531
      if (object.sequenceType != null) {
5532
        if (typeof object.sequenceType !== 'object') throw TypeError('.onnx.TypeProto.sequenceType: object expected');
5533
        message.sequenceType = $root.onnx.TypeProto.Sequence.fromObject(object.sequenceType);
5534
      }
5535
      if (object.mapType != null) {
5536
        if (typeof object.mapType !== 'object') throw TypeError('.onnx.TypeProto.mapType: object expected');
5537
        message.mapType = $root.onnx.TypeProto.Map.fromObject(object.mapType);
5538
      }
5539
      if (object.optionalType != null) {
5540
        if (typeof object.optionalType !== 'object') throw TypeError('.onnx.TypeProto.optionalType: object expected');
5541
        message.optionalType = $root.onnx.TypeProto.Optional.fromObject(object.optionalType);
5542
      }
5543
      if (object.sparseTensorType != null) {
5544
        if (typeof object.sparseTensorType !== 'object')
5545
          throw TypeError('.onnx.TypeProto.sparseTensorType: object expected');
5546
        message.sparseTensorType = $root.onnx.TypeProto.SparseTensor.fromObject(object.sparseTensorType);
5547
      }
5548
      if (object.denotation != null) message.denotation = String(object.denotation);
5549
      return message;
5550
    };
5551

5552
    /**
5553
     * Creates a plain object from a TypeProto message. Also converts values to other types if specified.
5554
     * @function toObject
5555
     * @memberof onnx.TypeProto
5556
     * @static
5557
     * @param {onnx.TypeProto} message TypeProto
5558
     * @param {$protobuf.IConversionOptions} [options] Conversion options
5559
     * @returns {Object.<string,*>} Plain object
5560
     */
5561
    TypeProto.toObject = function toObject(message, options) {
5562
      if (!options) options = {};
5563
      var object = {};
5564
      if (options.defaults) object.denotation = '';
5565
      if (message.tensorType != null && message.hasOwnProperty('tensorType')) {
5566
        object.tensorType = $root.onnx.TypeProto.Tensor.toObject(message.tensorType, options);
5567
        if (options.oneofs) object.value = 'tensorType';
5568
      }
5569
      if (message.sequenceType != null && message.hasOwnProperty('sequenceType')) {
5570
        object.sequenceType = $root.onnx.TypeProto.Sequence.toObject(message.sequenceType, options);
5571
        if (options.oneofs) object.value = 'sequenceType';
5572
      }
5573
      if (message.mapType != null && message.hasOwnProperty('mapType')) {
5574
        object.mapType = $root.onnx.TypeProto.Map.toObject(message.mapType, options);
5575
        if (options.oneofs) object.value = 'mapType';
5576
      }
5577
      if (message.denotation != null && message.hasOwnProperty('denotation')) object.denotation = message.denotation;
5578
      if (message.sparseTensorType != null && message.hasOwnProperty('sparseTensorType')) {
5579
        object.sparseTensorType = $root.onnx.TypeProto.SparseTensor.toObject(message.sparseTensorType, options);
5580
        if (options.oneofs) object.value = 'sparseTensorType';
5581
      }
5582
      if (message.optionalType != null && message.hasOwnProperty('optionalType')) {
5583
        object.optionalType = $root.onnx.TypeProto.Optional.toObject(message.optionalType, options);
5584
        if (options.oneofs) object.value = 'optionalType';
5585
      }
5586
      return object;
5587
    };
5588

5589
    /**
5590
     * Converts this TypeProto to JSON.
5591
     * @function toJSON
5592
     * @memberof onnx.TypeProto
5593
     * @instance
5594
     * @returns {Object.<string,*>} JSON object
5595
     */
5596
    TypeProto.prototype.toJSON = function toJSON() {
5597
      return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
5598
    };
5599

5600
    /**
5601
     * Gets the default type url for TypeProto
5602
     * @function getTypeUrl
5603
     * @memberof onnx.TypeProto
5604
     * @static
5605
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
5606
     * @returns {string} The default type url
5607
     */
5608
    TypeProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
5609
      if (typeUrlPrefix === undefined) {
5610
        typeUrlPrefix = 'type.googleapis.com';
5611
      }
5612
      return typeUrlPrefix + '/onnx.TypeProto';
5613
    };
5614

5615
    TypeProto.Tensor = (function () {
5616
      /**
5617
       * Properties of a Tensor.
5618
       * @memberof onnx.TypeProto
5619
       * @interface ITensor
5620
       * @property {number|null} [elemType] Tensor elemType
5621
       * @property {onnx.ITensorShapeProto|null} [shape] Tensor shape
5622
       */
5623

5624
      /**
5625
       * Constructs a new Tensor.
5626
       * @memberof onnx.TypeProto
5627
       * @classdesc Represents a Tensor.
5628
       * @implements ITensor
5629
       * @constructor
5630
       * @param {onnx.TypeProto.ITensor=} [properties] Properties to set
5631
       */
5632
      function Tensor(properties) {
5633
        if (properties)
5634
          for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
5635
            if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
5636
      }
5637

5638
      /**
5639
       * Tensor elemType.
5640
       * @member {number} elemType
5641
       * @memberof onnx.TypeProto.Tensor
5642
       * @instance
5643
       */
5644
      Tensor.prototype.elemType = 0;
5645

5646
      /**
5647
       * Tensor shape.
5648
       * @member {onnx.ITensorShapeProto|null|undefined} shape
5649
       * @memberof onnx.TypeProto.Tensor
5650
       * @instance
5651
       */
5652
      Tensor.prototype.shape = null;
5653

5654
      /**
5655
       * Creates a new Tensor instance using the specified properties.
5656
       * @function create
5657
       * @memberof onnx.TypeProto.Tensor
5658
       * @static
5659
       * @param {onnx.TypeProto.ITensor=} [properties] Properties to set
5660
       * @returns {onnx.TypeProto.Tensor} Tensor instance
5661
       */
5662
      Tensor.create = function create(properties) {
5663
        return new Tensor(properties);
5664
      };
5665

5666
      /**
5667
       * Encodes the specified Tensor message. Does not implicitly {@link onnx.TypeProto.Tensor.verify|verify} messages.
5668
       * @function encode
5669
       * @memberof onnx.TypeProto.Tensor
5670
       * @static
5671
       * @param {onnx.TypeProto.ITensor} message Tensor message or plain object to encode
5672
       * @param {$protobuf.Writer} [writer] Writer to encode to
5673
       * @returns {$protobuf.Writer} Writer
5674
       */
5675
      Tensor.encode = function encode(message, writer) {
5676
        if (!writer) writer = $Writer.create();
5677
        if (message.elemType != null && Object.hasOwnProperty.call(message, 'elemType'))
5678
          writer.uint32(/* id 1, wireType 0 =*/ 8).int32(message.elemType);
5679
        if (message.shape != null && Object.hasOwnProperty.call(message, 'shape'))
5680
          $root.onnx.TensorShapeProto.encode(message.shape, writer.uint32(/* id 2, wireType 2 =*/ 18).fork()).ldelim();
5681
        return writer;
5682
      };
5683

5684
      /**
5685
       * Encodes the specified Tensor message, length delimited. Does not implicitly {@link onnx.TypeProto.Tensor.verify|verify} messages.
5686
       * @function encodeDelimited
5687
       * @memberof onnx.TypeProto.Tensor
5688
       * @static
5689
       * @param {onnx.TypeProto.ITensor} message Tensor message or plain object to encode
5690
       * @param {$protobuf.Writer} [writer] Writer to encode to
5691
       * @returns {$protobuf.Writer} Writer
5692
       */
5693
      Tensor.encodeDelimited = function encodeDelimited(message, writer) {
5694
        return this.encode(message, writer).ldelim();
5695
      };
5696

5697
      /**
5698
       * Decodes a Tensor message from the specified reader or buffer.
5699
       * @function decode
5700
       * @memberof onnx.TypeProto.Tensor
5701
       * @static
5702
       * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
5703
       * @param {number} [length] Message length if known beforehand
5704
       * @returns {onnx.TypeProto.Tensor} Tensor
5705
       * @throws {Error} If the payload is not a reader or valid buffer
5706
       * @throws {$protobuf.util.ProtocolError} If required fields are missing
5707
       */
5708
      Tensor.decode = function decode(reader, length) {
5709
        if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
5710
        var end = length === undefined ? reader.len : reader.pos + length,
5711
          message = new $root.onnx.TypeProto.Tensor();
5712
        while (reader.pos < end) {
5713
          var tag = reader.uint32();
5714
          switch (tag >>> 3) {
5715
            case 1: {
5716
              message.elemType = reader.int32();
5717
              break;
5718
            }
5719
            case 2: {
5720
              message.shape = $root.onnx.TensorShapeProto.decode(reader, reader.uint32());
5721
              break;
5722
            }
5723
            default:
5724
              reader.skipType(tag & 7);
5725
              break;
5726
          }
5727
        }
5728
        return message;
5729
      };
5730

5731
      /**
5732
       * Decodes a Tensor message from the specified reader or buffer, length delimited.
5733
       * @function decodeDelimited
5734
       * @memberof onnx.TypeProto.Tensor
5735
       * @static
5736
       * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
5737
       * @returns {onnx.TypeProto.Tensor} Tensor
5738
       * @throws {Error} If the payload is not a reader or valid buffer
5739
       * @throws {$protobuf.util.ProtocolError} If required fields are missing
5740
       */
5741
      Tensor.decodeDelimited = function decodeDelimited(reader) {
5742
        if (!(reader instanceof $Reader)) reader = new $Reader(reader);
5743
        return this.decode(reader, reader.uint32());
5744
      };
5745

5746
      /**
5747
       * Verifies a Tensor message.
5748
       * @function verify
5749
       * @memberof onnx.TypeProto.Tensor
5750
       * @static
5751
       * @param {Object.<string,*>} message Plain object to verify
5752
       * @returns {string|null} `null` if valid, otherwise the reason why it is not
5753
       */
5754
      Tensor.verify = function verify(message) {
5755
        if (typeof message !== 'object' || message === null) return 'object expected';
5756
        if (message.elemType != null && message.hasOwnProperty('elemType'))
5757
          if (!$util.isInteger(message.elemType)) return 'elemType: integer expected';
5758
        if (message.shape != null && message.hasOwnProperty('shape')) {
5759
          var error = $root.onnx.TensorShapeProto.verify(message.shape);
5760
          if (error) return 'shape.' + error;
5761
        }
5762
        return null;
5763
      };
5764

5765
      /**
5766
       * Creates a Tensor message from a plain object. Also converts values to their respective internal types.
5767
       * @function fromObject
5768
       * @memberof onnx.TypeProto.Tensor
5769
       * @static
5770
       * @param {Object.<string,*>} object Plain object
5771
       * @returns {onnx.TypeProto.Tensor} Tensor
5772
       */
5773
      Tensor.fromObject = function fromObject(object) {
5774
        if (object instanceof $root.onnx.TypeProto.Tensor) return object;
5775
        var message = new $root.onnx.TypeProto.Tensor();
5776
        if (object.elemType != null) message.elemType = object.elemType | 0;
5777
        if (object.shape != null) {
5778
          if (typeof object.shape !== 'object') throw TypeError('.onnx.TypeProto.Tensor.shape: object expected');
5779
          message.shape = $root.onnx.TensorShapeProto.fromObject(object.shape);
5780
        }
5781
        return message;
5782
      };
5783

5784
      /**
5785
       * Creates a plain object from a Tensor message. Also converts values to other types if specified.
5786
       * @function toObject
5787
       * @memberof onnx.TypeProto.Tensor
5788
       * @static
5789
       * @param {onnx.TypeProto.Tensor} message Tensor
5790
       * @param {$protobuf.IConversionOptions} [options] Conversion options
5791
       * @returns {Object.<string,*>} Plain object
5792
       */
5793
      Tensor.toObject = function toObject(message, options) {
5794
        if (!options) options = {};
5795
        var object = {};
5796
        if (options.defaults) {
5797
          object.elemType = 0;
5798
          object.shape = null;
5799
        }
5800
        if (message.elemType != null && message.hasOwnProperty('elemType')) object.elemType = message.elemType;
5801
        if (message.shape != null && message.hasOwnProperty('shape'))
5802
          object.shape = $root.onnx.TensorShapeProto.toObject(message.shape, options);
5803
        return object;
5804
      };
5805

5806
      /**
5807
       * Converts this Tensor to JSON.
5808
       * @function toJSON
5809
       * @memberof onnx.TypeProto.Tensor
5810
       * @instance
5811
       * @returns {Object.<string,*>} JSON object
5812
       */
5813
      Tensor.prototype.toJSON = function toJSON() {
5814
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
5815
      };
5816

5817
      /**
5818
       * Gets the default type url for Tensor
5819
       * @function getTypeUrl
5820
       * @memberof onnx.TypeProto.Tensor
5821
       * @static
5822
       * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
5823
       * @returns {string} The default type url
5824
       */
5825
      Tensor.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
5826
        if (typeUrlPrefix === undefined) {
5827
          typeUrlPrefix = 'type.googleapis.com';
5828
        }
5829
        return typeUrlPrefix + '/onnx.TypeProto.Tensor';
5830
      };
5831

5832
      return Tensor;
5833
    })();
5834

5835
    TypeProto.Sequence = (function () {
5836
      /**
5837
       * Properties of a Sequence.
5838
       * @memberof onnx.TypeProto
5839
       * @interface ISequence
5840
       * @property {onnx.ITypeProto|null} [elemType] Sequence elemType
5841
       */
5842

5843
      /**
5844
       * Constructs a new Sequence.
5845
       * @memberof onnx.TypeProto
5846
       * @classdesc Represents a Sequence.
5847
       * @implements ISequence
5848
       * @constructor
5849
       * @param {onnx.TypeProto.ISequence=} [properties] Properties to set
5850
       */
5851
      function Sequence(properties) {
5852
        if (properties)
5853
          for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
5854
            if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
5855
      }
5856

5857
      /**
5858
       * Sequence elemType.
5859
       * @member {onnx.ITypeProto|null|undefined} elemType
5860
       * @memberof onnx.TypeProto.Sequence
5861
       * @instance
5862
       */
5863
      Sequence.prototype.elemType = null;
5864

5865
      /**
5866
       * Creates a new Sequence instance using the specified properties.
5867
       * @function create
5868
       * @memberof onnx.TypeProto.Sequence
5869
       * @static
5870
       * @param {onnx.TypeProto.ISequence=} [properties] Properties to set
5871
       * @returns {onnx.TypeProto.Sequence} Sequence instance
5872
       */
5873
      Sequence.create = function create(properties) {
5874
        return new Sequence(properties);
5875
      };
5876

5877
      /**
5878
       * Encodes the specified Sequence message. Does not implicitly {@link onnx.TypeProto.Sequence.verify|verify} messages.
5879
       * @function encode
5880
       * @memberof onnx.TypeProto.Sequence
5881
       * @static
5882
       * @param {onnx.TypeProto.ISequence} message Sequence message or plain object to encode
5883
       * @param {$protobuf.Writer} [writer] Writer to encode to
5884
       * @returns {$protobuf.Writer} Writer
5885
       */
5886
      Sequence.encode = function encode(message, writer) {
5887
        if (!writer) writer = $Writer.create();
5888
        if (message.elemType != null && Object.hasOwnProperty.call(message, 'elemType'))
5889
          $root.onnx.TypeProto.encode(message.elemType, writer.uint32(/* id 1, wireType 2 =*/ 10).fork()).ldelim();
5890
        return writer;
5891
      };
5892

5893
      /**
5894
       * Encodes the specified Sequence message, length delimited. Does not implicitly {@link onnx.TypeProto.Sequence.verify|verify} messages.
5895
       * @function encodeDelimited
5896
       * @memberof onnx.TypeProto.Sequence
5897
       * @static
5898
       * @param {onnx.TypeProto.ISequence} message Sequence message or plain object to encode
5899
       * @param {$protobuf.Writer} [writer] Writer to encode to
5900
       * @returns {$protobuf.Writer} Writer
5901
       */
5902
      Sequence.encodeDelimited = function encodeDelimited(message, writer) {
5903
        return this.encode(message, writer).ldelim();
5904
      };
5905

5906
      /**
5907
       * Decodes a Sequence message from the specified reader or buffer.
5908
       * @function decode
5909
       * @memberof onnx.TypeProto.Sequence
5910
       * @static
5911
       * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
5912
       * @param {number} [length] Message length if known beforehand
5913
       * @returns {onnx.TypeProto.Sequence} Sequence
5914
       * @throws {Error} If the payload is not a reader or valid buffer
5915
       * @throws {$protobuf.util.ProtocolError} If required fields are missing
5916
       */
5917
      Sequence.decode = function decode(reader, length) {
5918
        if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
5919
        var end = length === undefined ? reader.len : reader.pos + length,
5920
          message = new $root.onnx.TypeProto.Sequence();
5921
        while (reader.pos < end) {
5922
          var tag = reader.uint32();
5923
          switch (tag >>> 3) {
5924
            case 1: {
5925
              message.elemType = $root.onnx.TypeProto.decode(reader, reader.uint32());
5926
              break;
5927
            }
5928
            default:
5929
              reader.skipType(tag & 7);
5930
              break;
5931
          }
5932
        }
5933
        return message;
5934
      };
5935

5936
      /**
5937
       * Decodes a Sequence message from the specified reader or buffer, length delimited.
5938
       * @function decodeDelimited
5939
       * @memberof onnx.TypeProto.Sequence
5940
       * @static
5941
       * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
5942
       * @returns {onnx.TypeProto.Sequence} Sequence
5943
       * @throws {Error} If the payload is not a reader or valid buffer
5944
       * @throws {$protobuf.util.ProtocolError} If required fields are missing
5945
       */
5946
      Sequence.decodeDelimited = function decodeDelimited(reader) {
5947
        if (!(reader instanceof $Reader)) reader = new $Reader(reader);
5948
        return this.decode(reader, reader.uint32());
5949
      };
5950

5951
      /**
5952
       * Verifies a Sequence message.
5953
       * @function verify
5954
       * @memberof onnx.TypeProto.Sequence
5955
       * @static
5956
       * @param {Object.<string,*>} message Plain object to verify
5957
       * @returns {string|null} `null` if valid, otherwise the reason why it is not
5958
       */
5959
      Sequence.verify = function verify(message) {
5960
        if (typeof message !== 'object' || message === null) return 'object expected';
5961
        if (message.elemType != null && message.hasOwnProperty('elemType')) {
5962
          var error = $root.onnx.TypeProto.verify(message.elemType);
5963
          if (error) return 'elemType.' + error;
5964
        }
5965
        return null;
5966
      };
5967

5968
      /**
5969
       * Creates a Sequence message from a plain object. Also converts values to their respective internal types.
5970
       * @function fromObject
5971
       * @memberof onnx.TypeProto.Sequence
5972
       * @static
5973
       * @param {Object.<string,*>} object Plain object
5974
       * @returns {onnx.TypeProto.Sequence} Sequence
5975
       */
5976
      Sequence.fromObject = function fromObject(object) {
5977
        if (object instanceof $root.onnx.TypeProto.Sequence) return object;
5978
        var message = new $root.onnx.TypeProto.Sequence();
5979
        if (object.elemType != null) {
5980
          if (typeof object.elemType !== 'object')
5981
            throw TypeError('.onnx.TypeProto.Sequence.elemType: object expected');
5982
          message.elemType = $root.onnx.TypeProto.fromObject(object.elemType);
5983
        }
5984
        return message;
5985
      };
5986

5987
      /**
5988
       * Creates a plain object from a Sequence message. Also converts values to other types if specified.
5989
       * @function toObject
5990
       * @memberof onnx.TypeProto.Sequence
5991
       * @static
5992
       * @param {onnx.TypeProto.Sequence} message Sequence
5993
       * @param {$protobuf.IConversionOptions} [options] Conversion options
5994
       * @returns {Object.<string,*>} Plain object
5995
       */
5996
      Sequence.toObject = function toObject(message, options) {
5997
        if (!options) options = {};
5998
        var object = {};
5999
        if (options.defaults) object.elemType = null;
6000
        if (message.elemType != null && message.hasOwnProperty('elemType'))
6001
          object.elemType = $root.onnx.TypeProto.toObject(message.elemType, options);
6002
        return object;
6003
      };
6004

6005
      /**
6006
       * Converts this Sequence to JSON.
6007
       * @function toJSON
6008
       * @memberof onnx.TypeProto.Sequence
6009
       * @instance
6010
       * @returns {Object.<string,*>} JSON object
6011
       */
6012
      Sequence.prototype.toJSON = function toJSON() {
6013
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
6014
      };
6015

6016
      /**
6017
       * Gets the default type url for Sequence
6018
       * @function getTypeUrl
6019
       * @memberof onnx.TypeProto.Sequence
6020
       * @static
6021
       * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
6022
       * @returns {string} The default type url
6023
       */
6024
      Sequence.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
6025
        if (typeUrlPrefix === undefined) {
6026
          typeUrlPrefix = 'type.googleapis.com';
6027
        }
6028
        return typeUrlPrefix + '/onnx.TypeProto.Sequence';
6029
      };
6030

6031
      return Sequence;
6032
    })();
6033

6034
    TypeProto.Map = (function () {
6035
      /**
6036
       * Properties of a Map.
6037
       * @memberof onnx.TypeProto
6038
       * @interface IMap
6039
       * @property {number|null} [keyType] Map keyType
6040
       * @property {onnx.ITypeProto|null} [valueType] Map valueType
6041
       */
6042

6043
      /**
6044
       * Constructs a new Map.
6045
       * @memberof onnx.TypeProto
6046
       * @classdesc Represents a Map.
6047
       * @implements IMap
6048
       * @constructor
6049
       * @param {onnx.TypeProto.IMap=} [properties] Properties to set
6050
       */
6051
      function Map(properties) {
6052
        if (properties)
6053
          for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
6054
            if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
6055
      }
6056

6057
      /**
6058
       * Map keyType.
6059
       * @member {number} keyType
6060
       * @memberof onnx.TypeProto.Map
6061
       * @instance
6062
       */
6063
      Map.prototype.keyType = 0;
6064

6065
      /**
6066
       * Map valueType.
6067
       * @member {onnx.ITypeProto|null|undefined} valueType
6068
       * @memberof onnx.TypeProto.Map
6069
       * @instance
6070
       */
6071
      Map.prototype.valueType = null;
6072

6073
      /**
6074
       * Creates a new Map instance using the specified properties.
6075
       * @function create
6076
       * @memberof onnx.TypeProto.Map
6077
       * @static
6078
       * @param {onnx.TypeProto.IMap=} [properties] Properties to set
6079
       * @returns {onnx.TypeProto.Map} Map instance
6080
       */
6081
      Map.create = function create(properties) {
6082
        return new Map(properties);
6083
      };
6084

6085
      /**
6086
       * Encodes the specified Map message. Does not implicitly {@link onnx.TypeProto.Map.verify|verify} messages.
6087
       * @function encode
6088
       * @memberof onnx.TypeProto.Map
6089
       * @static
6090
       * @param {onnx.TypeProto.IMap} message Map message or plain object to encode
6091
       * @param {$protobuf.Writer} [writer] Writer to encode to
6092
       * @returns {$protobuf.Writer} Writer
6093
       */
6094
      Map.encode = function encode(message, writer) {
6095
        if (!writer) writer = $Writer.create();
6096
        if (message.keyType != null && Object.hasOwnProperty.call(message, 'keyType'))
6097
          writer.uint32(/* id 1, wireType 0 =*/ 8).int32(message.keyType);
6098
        if (message.valueType != null && Object.hasOwnProperty.call(message, 'valueType'))
6099
          $root.onnx.TypeProto.encode(message.valueType, writer.uint32(/* id 2, wireType 2 =*/ 18).fork()).ldelim();
6100
        return writer;
6101
      };
6102

6103
      /**
6104
       * Encodes the specified Map message, length delimited. Does not implicitly {@link onnx.TypeProto.Map.verify|verify} messages.
6105
       * @function encodeDelimited
6106
       * @memberof onnx.TypeProto.Map
6107
       * @static
6108
       * @param {onnx.TypeProto.IMap} message Map message or plain object to encode
6109
       * @param {$protobuf.Writer} [writer] Writer to encode to
6110
       * @returns {$protobuf.Writer} Writer
6111
       */
6112
      Map.encodeDelimited = function encodeDelimited(message, writer) {
6113
        return this.encode(message, writer).ldelim();
6114
      };
6115

6116
      /**
6117
       * Decodes a Map message from the specified reader or buffer.
6118
       * @function decode
6119
       * @memberof onnx.TypeProto.Map
6120
       * @static
6121
       * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
6122
       * @param {number} [length] Message length if known beforehand
6123
       * @returns {onnx.TypeProto.Map} Map
6124
       * @throws {Error} If the payload is not a reader or valid buffer
6125
       * @throws {$protobuf.util.ProtocolError} If required fields are missing
6126
       */
6127
      Map.decode = function decode(reader, length) {
6128
        if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
6129
        var end = length === undefined ? reader.len : reader.pos + length,
6130
          message = new $root.onnx.TypeProto.Map();
6131
        while (reader.pos < end) {
6132
          var tag = reader.uint32();
6133
          switch (tag >>> 3) {
6134
            case 1: {
6135
              message.keyType = reader.int32();
6136
              break;
6137
            }
6138
            case 2: {
6139
              message.valueType = $root.onnx.TypeProto.decode(reader, reader.uint32());
6140
              break;
6141
            }
6142
            default:
6143
              reader.skipType(tag & 7);
6144
              break;
6145
          }
6146
        }
6147
        return message;
6148
      };
6149

6150
      /**
6151
       * Decodes a Map message from the specified reader or buffer, length delimited.
6152
       * @function decodeDelimited
6153
       * @memberof onnx.TypeProto.Map
6154
       * @static
6155
       * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
6156
       * @returns {onnx.TypeProto.Map} Map
6157
       * @throws {Error} If the payload is not a reader or valid buffer
6158
       * @throws {$protobuf.util.ProtocolError} If required fields are missing
6159
       */
6160
      Map.decodeDelimited = function decodeDelimited(reader) {
6161
        if (!(reader instanceof $Reader)) reader = new $Reader(reader);
6162
        return this.decode(reader, reader.uint32());
6163
      };
6164

6165
      /**
6166
       * Verifies a Map message.
6167
       * @function verify
6168
       * @memberof onnx.TypeProto.Map
6169
       * @static
6170
       * @param {Object.<string,*>} message Plain object to verify
6171
       * @returns {string|null} `null` if valid, otherwise the reason why it is not
6172
       */
6173
      Map.verify = function verify(message) {
6174
        if (typeof message !== 'object' || message === null) return 'object expected';
6175
        if (message.keyType != null && message.hasOwnProperty('keyType'))
6176
          if (!$util.isInteger(message.keyType)) return 'keyType: integer expected';
6177
        if (message.valueType != null && message.hasOwnProperty('valueType')) {
6178
          var error = $root.onnx.TypeProto.verify(message.valueType);
6179
          if (error) return 'valueType.' + error;
6180
        }
6181
        return null;
6182
      };
6183

6184
      /**
6185
       * Creates a Map message from a plain object. Also converts values to their respective internal types.
6186
       * @function fromObject
6187
       * @memberof onnx.TypeProto.Map
6188
       * @static
6189
       * @param {Object.<string,*>} object Plain object
6190
       * @returns {onnx.TypeProto.Map} Map
6191
       */
6192
      Map.fromObject = function fromObject(object) {
6193
        if (object instanceof $root.onnx.TypeProto.Map) return object;
6194
        var message = new $root.onnx.TypeProto.Map();
6195
        if (object.keyType != null) message.keyType = object.keyType | 0;
6196
        if (object.valueType != null) {
6197
          if (typeof object.valueType !== 'object') throw TypeError('.onnx.TypeProto.Map.valueType: object expected');
6198
          message.valueType = $root.onnx.TypeProto.fromObject(object.valueType);
6199
        }
6200
        return message;
6201
      };
6202

6203
      /**
6204
       * Creates a plain object from a Map message. Also converts values to other types if specified.
6205
       * @function toObject
6206
       * @memberof onnx.TypeProto.Map
6207
       * @static
6208
       * @param {onnx.TypeProto.Map} message Map
6209
       * @param {$protobuf.IConversionOptions} [options] Conversion options
6210
       * @returns {Object.<string,*>} Plain object
6211
       */
6212
      Map.toObject = function toObject(message, options) {
6213
        if (!options) options = {};
6214
        var object = {};
6215
        if (options.defaults) {
6216
          object.keyType = 0;
6217
          object.valueType = null;
6218
        }
6219
        if (message.keyType != null && message.hasOwnProperty('keyType')) object.keyType = message.keyType;
6220
        if (message.valueType != null && message.hasOwnProperty('valueType'))
6221
          object.valueType = $root.onnx.TypeProto.toObject(message.valueType, options);
6222
        return object;
6223
      };
6224

6225
      /**
6226
       * Converts this Map to JSON.
6227
       * @function toJSON
6228
       * @memberof onnx.TypeProto.Map
6229
       * @instance
6230
       * @returns {Object.<string,*>} JSON object
6231
       */
6232
      Map.prototype.toJSON = function toJSON() {
6233
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
6234
      };
6235

6236
      /**
6237
       * Gets the default type url for Map
6238
       * @function getTypeUrl
6239
       * @memberof onnx.TypeProto.Map
6240
       * @static
6241
       * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
6242
       * @returns {string} The default type url
6243
       */
6244
      Map.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
6245
        if (typeUrlPrefix === undefined) {
6246
          typeUrlPrefix = 'type.googleapis.com';
6247
        }
6248
        return typeUrlPrefix + '/onnx.TypeProto.Map';
6249
      };
6250

6251
      return Map;
6252
    })();
6253

6254
    TypeProto.Optional = (function () {
6255
      /**
6256
       * Properties of an Optional.
6257
       * @memberof onnx.TypeProto
6258
       * @interface IOptional
6259
       * @property {onnx.ITypeProto|null} [elemType] Optional elemType
6260
       */
6261

6262
      /**
6263
       * Constructs a new Optional.
6264
       * @memberof onnx.TypeProto
6265
       * @classdesc Represents an Optional.
6266
       * @implements IOptional
6267
       * @constructor
6268
       * @param {onnx.TypeProto.IOptional=} [properties] Properties to set
6269
       */
6270
      function Optional(properties) {
6271
        if (properties)
6272
          for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
6273
            if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
6274
      }
6275

6276
      /**
6277
       * Optional elemType.
6278
       * @member {onnx.ITypeProto|null|undefined} elemType
6279
       * @memberof onnx.TypeProto.Optional
6280
       * @instance
6281
       */
6282
      Optional.prototype.elemType = null;
6283

6284
      /**
6285
       * Creates a new Optional instance using the specified properties.
6286
       * @function create
6287
       * @memberof onnx.TypeProto.Optional
6288
       * @static
6289
       * @param {onnx.TypeProto.IOptional=} [properties] Properties to set
6290
       * @returns {onnx.TypeProto.Optional} Optional instance
6291
       */
6292
      Optional.create = function create(properties) {
6293
        return new Optional(properties);
6294
      };
6295

6296
      /**
6297
       * Encodes the specified Optional message. Does not implicitly {@link onnx.TypeProto.Optional.verify|verify} messages.
6298
       * @function encode
6299
       * @memberof onnx.TypeProto.Optional
6300
       * @static
6301
       * @param {onnx.TypeProto.IOptional} message Optional message or plain object to encode
6302
       * @param {$protobuf.Writer} [writer] Writer to encode to
6303
       * @returns {$protobuf.Writer} Writer
6304
       */
6305
      Optional.encode = function encode(message, writer) {
6306
        if (!writer) writer = $Writer.create();
6307
        if (message.elemType != null && Object.hasOwnProperty.call(message, 'elemType'))
6308
          $root.onnx.TypeProto.encode(message.elemType, writer.uint32(/* id 1, wireType 2 =*/ 10).fork()).ldelim();
6309
        return writer;
6310
      };
6311

6312
      /**
6313
       * Encodes the specified Optional message, length delimited. Does not implicitly {@link onnx.TypeProto.Optional.verify|verify} messages.
6314
       * @function encodeDelimited
6315
       * @memberof onnx.TypeProto.Optional
6316
       * @static
6317
       * @param {onnx.TypeProto.IOptional} message Optional message or plain object to encode
6318
       * @param {$protobuf.Writer} [writer] Writer to encode to
6319
       * @returns {$protobuf.Writer} Writer
6320
       */
6321
      Optional.encodeDelimited = function encodeDelimited(message, writer) {
6322
        return this.encode(message, writer).ldelim();
6323
      };
6324

6325
      /**
6326
       * Decodes an Optional message from the specified reader or buffer.
6327
       * @function decode
6328
       * @memberof onnx.TypeProto.Optional
6329
       * @static
6330
       * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
6331
       * @param {number} [length] Message length if known beforehand
6332
       * @returns {onnx.TypeProto.Optional} Optional
6333
       * @throws {Error} If the payload is not a reader or valid buffer
6334
       * @throws {$protobuf.util.ProtocolError} If required fields are missing
6335
       */
6336
      Optional.decode = function decode(reader, length) {
6337
        if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
6338
        var end = length === undefined ? reader.len : reader.pos + length,
6339
          message = new $root.onnx.TypeProto.Optional();
6340
        while (reader.pos < end) {
6341
          var tag = reader.uint32();
6342
          switch (tag >>> 3) {
6343
            case 1: {
6344
              message.elemType = $root.onnx.TypeProto.decode(reader, reader.uint32());
6345
              break;
6346
            }
6347
            default:
6348
              reader.skipType(tag & 7);
6349
              break;
6350
          }
6351
        }
6352
        return message;
6353
      };
6354

6355
      /**
6356
       * Decodes an Optional message from the specified reader or buffer, length delimited.
6357
       * @function decodeDelimited
6358
       * @memberof onnx.TypeProto.Optional
6359
       * @static
6360
       * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
6361
       * @returns {onnx.TypeProto.Optional} Optional
6362
       * @throws {Error} If the payload is not a reader or valid buffer
6363
       * @throws {$protobuf.util.ProtocolError} If required fields are missing
6364
       */
6365
      Optional.decodeDelimited = function decodeDelimited(reader) {
6366
        if (!(reader instanceof $Reader)) reader = new $Reader(reader);
6367
        return this.decode(reader, reader.uint32());
6368
      };
6369

6370
      /**
6371
       * Verifies an Optional message.
6372
       * @function verify
6373
       * @memberof onnx.TypeProto.Optional
6374
       * @static
6375
       * @param {Object.<string,*>} message Plain object to verify
6376
       * @returns {string|null} `null` if valid, otherwise the reason why it is not
6377
       */
6378
      Optional.verify = function verify(message) {
6379
        if (typeof message !== 'object' || message === null) return 'object expected';
6380
        if (message.elemType != null && message.hasOwnProperty('elemType')) {
6381
          var error = $root.onnx.TypeProto.verify(message.elemType);
6382
          if (error) return 'elemType.' + error;
6383
        }
6384
        return null;
6385
      };
6386

6387
      /**
6388
       * Creates an Optional message from a plain object. Also converts values to their respective internal types.
6389
       * @function fromObject
6390
       * @memberof onnx.TypeProto.Optional
6391
       * @static
6392
       * @param {Object.<string,*>} object Plain object
6393
       * @returns {onnx.TypeProto.Optional} Optional
6394
       */
6395
      Optional.fromObject = function fromObject(object) {
6396
        if (object instanceof $root.onnx.TypeProto.Optional) return object;
6397
        var message = new $root.onnx.TypeProto.Optional();
6398
        if (object.elemType != null) {
6399
          if (typeof object.elemType !== 'object')
6400
            throw TypeError('.onnx.TypeProto.Optional.elemType: object expected');
6401
          message.elemType = $root.onnx.TypeProto.fromObject(object.elemType);
6402
        }
6403
        return message;
6404
      };
6405

6406
      /**
6407
       * Creates a plain object from an Optional message. Also converts values to other types if specified.
6408
       * @function toObject
6409
       * @memberof onnx.TypeProto.Optional
6410
       * @static
6411
       * @param {onnx.TypeProto.Optional} message Optional
6412
       * @param {$protobuf.IConversionOptions} [options] Conversion options
6413
       * @returns {Object.<string,*>} Plain object
6414
       */
6415
      Optional.toObject = function toObject(message, options) {
6416
        if (!options) options = {};
6417
        var object = {};
6418
        if (options.defaults) object.elemType = null;
6419
        if (message.elemType != null && message.hasOwnProperty('elemType'))
6420
          object.elemType = $root.onnx.TypeProto.toObject(message.elemType, options);
6421
        return object;
6422
      };
6423

6424
      /**
6425
       * Converts this Optional to JSON.
6426
       * @function toJSON
6427
       * @memberof onnx.TypeProto.Optional
6428
       * @instance
6429
       * @returns {Object.<string,*>} JSON object
6430
       */
6431
      Optional.prototype.toJSON = function toJSON() {
6432
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
6433
      };
6434

6435
      /**
6436
       * Gets the default type url for Optional
6437
       * @function getTypeUrl
6438
       * @memberof onnx.TypeProto.Optional
6439
       * @static
6440
       * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
6441
       * @returns {string} The default type url
6442
       */
6443
      Optional.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
6444
        if (typeUrlPrefix === undefined) {
6445
          typeUrlPrefix = 'type.googleapis.com';
6446
        }
6447
        return typeUrlPrefix + '/onnx.TypeProto.Optional';
6448
      };
6449

6450
      return Optional;
6451
    })();
6452

6453
    TypeProto.SparseTensor = (function () {
6454
      /**
6455
       * Properties of a SparseTensor.
6456
       * @memberof onnx.TypeProto
6457
       * @interface ISparseTensor
6458
       * @property {number|null} [elemType] SparseTensor elemType
6459
       * @property {onnx.ITensorShapeProto|null} [shape] SparseTensor shape
6460
       */
6461

6462
      /**
6463
       * Constructs a new SparseTensor.
6464
       * @memberof onnx.TypeProto
6465
       * @classdesc Represents a SparseTensor.
6466
       * @implements ISparseTensor
6467
       * @constructor
6468
       * @param {onnx.TypeProto.ISparseTensor=} [properties] Properties to set
6469
       */
6470
      function SparseTensor(properties) {
6471
        if (properties)
6472
          for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
6473
            if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
6474
      }
6475

6476
      /**
6477
       * SparseTensor elemType.
6478
       * @member {number} elemType
6479
       * @memberof onnx.TypeProto.SparseTensor
6480
       * @instance
6481
       */
6482
      SparseTensor.prototype.elemType = 0;
6483

6484
      /**
6485
       * SparseTensor shape.
6486
       * @member {onnx.ITensorShapeProto|null|undefined} shape
6487
       * @memberof onnx.TypeProto.SparseTensor
6488
       * @instance
6489
       */
6490
      SparseTensor.prototype.shape = null;
6491

6492
      /**
6493
       * Creates a new SparseTensor instance using the specified properties.
6494
       * @function create
6495
       * @memberof onnx.TypeProto.SparseTensor
6496
       * @static
6497
       * @param {onnx.TypeProto.ISparseTensor=} [properties] Properties to set
6498
       * @returns {onnx.TypeProto.SparseTensor} SparseTensor instance
6499
       */
6500
      SparseTensor.create = function create(properties) {
6501
        return new SparseTensor(properties);
6502
      };
6503

6504
      /**
6505
       * Encodes the specified SparseTensor message. Does not implicitly {@link onnx.TypeProto.SparseTensor.verify|verify} messages.
6506
       * @function encode
6507
       * @memberof onnx.TypeProto.SparseTensor
6508
       * @static
6509
       * @param {onnx.TypeProto.ISparseTensor} message SparseTensor message or plain object to encode
6510
       * @param {$protobuf.Writer} [writer] Writer to encode to
6511
       * @returns {$protobuf.Writer} Writer
6512
       */
6513
      SparseTensor.encode = function encode(message, writer) {
6514
        if (!writer) writer = $Writer.create();
6515
        if (message.elemType != null && Object.hasOwnProperty.call(message, 'elemType'))
6516
          writer.uint32(/* id 1, wireType 0 =*/ 8).int32(message.elemType);
6517
        if (message.shape != null && Object.hasOwnProperty.call(message, 'shape'))
6518
          $root.onnx.TensorShapeProto.encode(message.shape, writer.uint32(/* id 2, wireType 2 =*/ 18).fork()).ldelim();
6519
        return writer;
6520
      };
6521

6522
      /**
6523
       * Encodes the specified SparseTensor message, length delimited. Does not implicitly {@link onnx.TypeProto.SparseTensor.verify|verify} messages.
6524
       * @function encodeDelimited
6525
       * @memberof onnx.TypeProto.SparseTensor
6526
       * @static
6527
       * @param {onnx.TypeProto.ISparseTensor} message SparseTensor message or plain object to encode
6528
       * @param {$protobuf.Writer} [writer] Writer to encode to
6529
       * @returns {$protobuf.Writer} Writer
6530
       */
6531
      SparseTensor.encodeDelimited = function encodeDelimited(message, writer) {
6532
        return this.encode(message, writer).ldelim();
6533
      };
6534

6535
      /**
6536
       * Decodes a SparseTensor message from the specified reader or buffer.
6537
       * @function decode
6538
       * @memberof onnx.TypeProto.SparseTensor
6539
       * @static
6540
       * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
6541
       * @param {number} [length] Message length if known beforehand
6542
       * @returns {onnx.TypeProto.SparseTensor} SparseTensor
6543
       * @throws {Error} If the payload is not a reader or valid buffer
6544
       * @throws {$protobuf.util.ProtocolError} If required fields are missing
6545
       */
6546
      SparseTensor.decode = function decode(reader, length) {
6547
        if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
6548
        var end = length === undefined ? reader.len : reader.pos + length,
6549
          message = new $root.onnx.TypeProto.SparseTensor();
6550
        while (reader.pos < end) {
6551
          var tag = reader.uint32();
6552
          switch (tag >>> 3) {
6553
            case 1: {
6554
              message.elemType = reader.int32();
6555
              break;
6556
            }
6557
            case 2: {
6558
              message.shape = $root.onnx.TensorShapeProto.decode(reader, reader.uint32());
6559
              break;
6560
            }
6561
            default:
6562
              reader.skipType(tag & 7);
6563
              break;
6564
          }
6565
        }
6566
        return message;
6567
      };
6568

6569
      /**
6570
       * Decodes a SparseTensor message from the specified reader or buffer, length delimited.
6571
       * @function decodeDelimited
6572
       * @memberof onnx.TypeProto.SparseTensor
6573
       * @static
6574
       * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
6575
       * @returns {onnx.TypeProto.SparseTensor} SparseTensor
6576
       * @throws {Error} If the payload is not a reader or valid buffer
6577
       * @throws {$protobuf.util.ProtocolError} If required fields are missing
6578
       */
6579
      SparseTensor.decodeDelimited = function decodeDelimited(reader) {
6580
        if (!(reader instanceof $Reader)) reader = new $Reader(reader);
6581
        return this.decode(reader, reader.uint32());
6582
      };
6583

6584
      /**
6585
       * Verifies a SparseTensor message.
6586
       * @function verify
6587
       * @memberof onnx.TypeProto.SparseTensor
6588
       * @static
6589
       * @param {Object.<string,*>} message Plain object to verify
6590
       * @returns {string|null} `null` if valid, otherwise the reason why it is not
6591
       */
6592
      SparseTensor.verify = function verify(message) {
6593
        if (typeof message !== 'object' || message === null) return 'object expected';
6594
        if (message.elemType != null && message.hasOwnProperty('elemType'))
6595
          if (!$util.isInteger(message.elemType)) return 'elemType: integer expected';
6596
        if (message.shape != null && message.hasOwnProperty('shape')) {
6597
          var error = $root.onnx.TensorShapeProto.verify(message.shape);
6598
          if (error) return 'shape.' + error;
6599
        }
6600
        return null;
6601
      };
6602

6603
      /**
6604
       * Creates a SparseTensor message from a plain object. Also converts values to their respective internal types.
6605
       * @function fromObject
6606
       * @memberof onnx.TypeProto.SparseTensor
6607
       * @static
6608
       * @param {Object.<string,*>} object Plain object
6609
       * @returns {onnx.TypeProto.SparseTensor} SparseTensor
6610
       */
6611
      SparseTensor.fromObject = function fromObject(object) {
6612
        if (object instanceof $root.onnx.TypeProto.SparseTensor) return object;
6613
        var message = new $root.onnx.TypeProto.SparseTensor();
6614
        if (object.elemType != null) message.elemType = object.elemType | 0;
6615
        if (object.shape != null) {
6616
          if (typeof object.shape !== 'object') throw TypeError('.onnx.TypeProto.SparseTensor.shape: object expected');
6617
          message.shape = $root.onnx.TensorShapeProto.fromObject(object.shape);
6618
        }
6619
        return message;
6620
      };
6621

6622
      /**
6623
       * Creates a plain object from a SparseTensor message. Also converts values to other types if specified.
6624
       * @function toObject
6625
       * @memberof onnx.TypeProto.SparseTensor
6626
       * @static
6627
       * @param {onnx.TypeProto.SparseTensor} message SparseTensor
6628
       * @param {$protobuf.IConversionOptions} [options] Conversion options
6629
       * @returns {Object.<string,*>} Plain object
6630
       */
6631
      SparseTensor.toObject = function toObject(message, options) {
6632
        if (!options) options = {};
6633
        var object = {};
6634
        if (options.defaults) {
6635
          object.elemType = 0;
6636
          object.shape = null;
6637
        }
6638
        if (message.elemType != null && message.hasOwnProperty('elemType')) object.elemType = message.elemType;
6639
        if (message.shape != null && message.hasOwnProperty('shape'))
6640
          object.shape = $root.onnx.TensorShapeProto.toObject(message.shape, options);
6641
        return object;
6642
      };
6643

6644
      /**
6645
       * Converts this SparseTensor to JSON.
6646
       * @function toJSON
6647
       * @memberof onnx.TypeProto.SparseTensor
6648
       * @instance
6649
       * @returns {Object.<string,*>} JSON object
6650
       */
6651
      SparseTensor.prototype.toJSON = function toJSON() {
6652
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
6653
      };
6654

6655
      /**
6656
       * Gets the default type url for SparseTensor
6657
       * @function getTypeUrl
6658
       * @memberof onnx.TypeProto.SparseTensor
6659
       * @static
6660
       * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
6661
       * @returns {string} The default type url
6662
       */
6663
      SparseTensor.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
6664
        if (typeUrlPrefix === undefined) {
6665
          typeUrlPrefix = 'type.googleapis.com';
6666
        }
6667
        return typeUrlPrefix + '/onnx.TypeProto.SparseTensor';
6668
      };
6669

6670
      return SparseTensor;
6671
    })();
6672

6673
    return TypeProto;
6674
  })();
6675

6676
  onnx.OperatorSetIdProto = (function () {
6677
    /**
6678
     * Properties of an OperatorSetIdProto.
6679
     * @memberof onnx
6680
     * @interface IOperatorSetIdProto
6681
     * @property {string|null} [domain] OperatorSetIdProto domain
6682
     * @property {number|Long|null} [version] OperatorSetIdProto version
6683
     */
6684

6685
    /**
6686
     * Constructs a new OperatorSetIdProto.
6687
     * @memberof onnx
6688
     * @classdesc Represents an OperatorSetIdProto.
6689
     * @implements IOperatorSetIdProto
6690
     * @constructor
6691
     * @param {onnx.IOperatorSetIdProto=} [properties] Properties to set
6692
     */
6693
    function OperatorSetIdProto(properties) {
6694
      if (properties)
6695
        for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
6696
          if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
6697
    }
6698

6699
    /**
6700
     * OperatorSetIdProto domain.
6701
     * @member {string} domain
6702
     * @memberof onnx.OperatorSetIdProto
6703
     * @instance
6704
     */
6705
    OperatorSetIdProto.prototype.domain = '';
6706

6707
    /**
6708
     * OperatorSetIdProto version.
6709
     * @member {number|Long} version
6710
     * @memberof onnx.OperatorSetIdProto
6711
     * @instance
6712
     */
6713
    OperatorSetIdProto.prototype.version = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
6714

6715
    /**
6716
     * Creates a new OperatorSetIdProto instance using the specified properties.
6717
     * @function create
6718
     * @memberof onnx.OperatorSetIdProto
6719
     * @static
6720
     * @param {onnx.IOperatorSetIdProto=} [properties] Properties to set
6721
     * @returns {onnx.OperatorSetIdProto} OperatorSetIdProto instance
6722
     */
6723
    OperatorSetIdProto.create = function create(properties) {
6724
      return new OperatorSetIdProto(properties);
6725
    };
6726

6727
    /**
6728
     * Encodes the specified OperatorSetIdProto message. Does not implicitly {@link onnx.OperatorSetIdProto.verify|verify} messages.
6729
     * @function encode
6730
     * @memberof onnx.OperatorSetIdProto
6731
     * @static
6732
     * @param {onnx.IOperatorSetIdProto} message OperatorSetIdProto message or plain object to encode
6733
     * @param {$protobuf.Writer} [writer] Writer to encode to
6734
     * @returns {$protobuf.Writer} Writer
6735
     */
6736
    OperatorSetIdProto.encode = function encode(message, writer) {
6737
      if (!writer) writer = $Writer.create();
6738
      if (message.domain != null && Object.hasOwnProperty.call(message, 'domain'))
6739
        writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.domain);
6740
      if (message.version != null && Object.hasOwnProperty.call(message, 'version'))
6741
        writer.uint32(/* id 2, wireType 0 =*/ 16).int64(message.version);
6742
      return writer;
6743
    };
6744

6745
    /**
6746
     * Encodes the specified OperatorSetIdProto message, length delimited. Does not implicitly {@link onnx.OperatorSetIdProto.verify|verify} messages.
6747
     * @function encodeDelimited
6748
     * @memberof onnx.OperatorSetIdProto
6749
     * @static
6750
     * @param {onnx.IOperatorSetIdProto} message OperatorSetIdProto message or plain object to encode
6751
     * @param {$protobuf.Writer} [writer] Writer to encode to
6752
     * @returns {$protobuf.Writer} Writer
6753
     */
6754
    OperatorSetIdProto.encodeDelimited = function encodeDelimited(message, writer) {
6755
      return this.encode(message, writer).ldelim();
6756
    };
6757

6758
    /**
6759
     * Decodes an OperatorSetIdProto message from the specified reader or buffer.
6760
     * @function decode
6761
     * @memberof onnx.OperatorSetIdProto
6762
     * @static
6763
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
6764
     * @param {number} [length] Message length if known beforehand
6765
     * @returns {onnx.OperatorSetIdProto} OperatorSetIdProto
6766
     * @throws {Error} If the payload is not a reader or valid buffer
6767
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
6768
     */
6769
    OperatorSetIdProto.decode = function decode(reader, length) {
6770
      if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
6771
      var end = length === undefined ? reader.len : reader.pos + length,
6772
        message = new $root.onnx.OperatorSetIdProto();
6773
      while (reader.pos < end) {
6774
        var tag = reader.uint32();
6775
        switch (tag >>> 3) {
6776
          case 1: {
6777
            message.domain = reader.string();
6778
            break;
6779
          }
6780
          case 2: {
6781
            message.version = reader.int64();
6782
            break;
6783
          }
6784
          default:
6785
            reader.skipType(tag & 7);
6786
            break;
6787
        }
6788
      }
6789
      return message;
6790
    };
6791

6792
    /**
6793
     * Decodes an OperatorSetIdProto message from the specified reader or buffer, length delimited.
6794
     * @function decodeDelimited
6795
     * @memberof onnx.OperatorSetIdProto
6796
     * @static
6797
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
6798
     * @returns {onnx.OperatorSetIdProto} OperatorSetIdProto
6799
     * @throws {Error} If the payload is not a reader or valid buffer
6800
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
6801
     */
6802
    OperatorSetIdProto.decodeDelimited = function decodeDelimited(reader) {
6803
      if (!(reader instanceof $Reader)) reader = new $Reader(reader);
6804
      return this.decode(reader, reader.uint32());
6805
    };
6806

6807
    /**
6808
     * Verifies an OperatorSetIdProto message.
6809
     * @function verify
6810
     * @memberof onnx.OperatorSetIdProto
6811
     * @static
6812
     * @param {Object.<string,*>} message Plain object to verify
6813
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
6814
     */
6815
    OperatorSetIdProto.verify = function verify(message) {
6816
      if (typeof message !== 'object' || message === null) return 'object expected';
6817
      if (message.domain != null && message.hasOwnProperty('domain'))
6818
        if (!$util.isString(message.domain)) return 'domain: string expected';
6819
      if (message.version != null && message.hasOwnProperty('version'))
6820
        if (
6821
          !$util.isInteger(message.version) &&
6822
          !(message.version && $util.isInteger(message.version.low) && $util.isInteger(message.version.high))
6823
        )
6824
          return 'version: integer|Long expected';
6825
      return null;
6826
    };
6827

6828
    /**
6829
     * Creates an OperatorSetIdProto message from a plain object. Also converts values to their respective internal types.
6830
     * @function fromObject
6831
     * @memberof onnx.OperatorSetIdProto
6832
     * @static
6833
     * @param {Object.<string,*>} object Plain object
6834
     * @returns {onnx.OperatorSetIdProto} OperatorSetIdProto
6835
     */
6836
    OperatorSetIdProto.fromObject = function fromObject(object) {
6837
      if (object instanceof $root.onnx.OperatorSetIdProto) return object;
6838
      var message = new $root.onnx.OperatorSetIdProto();
6839
      if (object.domain != null) message.domain = String(object.domain);
6840
      if (object.version != null)
6841
        if ($util.Long) (message.version = $util.Long.fromValue(object.version)).unsigned = false;
6842
        else if (typeof object.version === 'string') message.version = parseInt(object.version, 10);
6843
        else if (typeof object.version === 'number') message.version = object.version;
6844
        else if (typeof object.version === 'object')
6845
          message.version = new $util.LongBits(object.version.low >>> 0, object.version.high >>> 0).toNumber();
6846
      return message;
6847
    };
6848

6849
    /**
6850
     * Creates a plain object from an OperatorSetIdProto message. Also converts values to other types if specified.
6851
     * @function toObject
6852
     * @memberof onnx.OperatorSetIdProto
6853
     * @static
6854
     * @param {onnx.OperatorSetIdProto} message OperatorSetIdProto
6855
     * @param {$protobuf.IConversionOptions} [options] Conversion options
6856
     * @returns {Object.<string,*>} Plain object
6857
     */
6858
    OperatorSetIdProto.toObject = function toObject(message, options) {
6859
      if (!options) options = {};
6860
      var object = {};
6861
      if (options.defaults) {
6862
        object.domain = '';
6863
        if ($util.Long) {
6864
          var long = new $util.Long(0, 0, false);
6865
          object.version =
6866
            options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
6867
        } else object.version = options.longs === String ? '0' : 0;
6868
      }
6869
      if (message.domain != null && message.hasOwnProperty('domain')) object.domain = message.domain;
6870
      if (message.version != null && message.hasOwnProperty('version'))
6871
        if (typeof message.version === 'number')
6872
          object.version = options.longs === String ? String(message.version) : message.version;
6873
        else
6874
          object.version =
6875
            options.longs === String
6876
              ? $util.Long.prototype.toString.call(message.version)
6877
              : options.longs === Number
6878
                ? new $util.LongBits(message.version.low >>> 0, message.version.high >>> 0).toNumber()
6879
                : message.version;
6880
      return object;
6881
    };
6882

6883
    /**
6884
     * Converts this OperatorSetIdProto to JSON.
6885
     * @function toJSON
6886
     * @memberof onnx.OperatorSetIdProto
6887
     * @instance
6888
     * @returns {Object.<string,*>} JSON object
6889
     */
6890
    OperatorSetIdProto.prototype.toJSON = function toJSON() {
6891
      return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
6892
    };
6893

6894
    /**
6895
     * Gets the default type url for OperatorSetIdProto
6896
     * @function getTypeUrl
6897
     * @memberof onnx.OperatorSetIdProto
6898
     * @static
6899
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
6900
     * @returns {string} The default type url
6901
     */
6902
    OperatorSetIdProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
6903
      if (typeUrlPrefix === undefined) {
6904
        typeUrlPrefix = 'type.googleapis.com';
6905
      }
6906
      return typeUrlPrefix + '/onnx.OperatorSetIdProto';
6907
    };
6908

6909
    return OperatorSetIdProto;
6910
  })();
6911

6912
  /**
6913
   * OperatorStatus enum.
6914
   * @name onnx.OperatorStatus
6915
   * @enum {number}
6916
   * @property {number} EXPERIMENTAL=0 EXPERIMENTAL value
6917
   * @property {number} STABLE=1 STABLE value
6918
   */
6919
  onnx.OperatorStatus = (function () {
6920
    var valuesById = {},
6921
      values = Object.create(valuesById);
6922
    values[(valuesById[0] = 'EXPERIMENTAL')] = 0;
6923
    values[(valuesById[1] = 'STABLE')] = 1;
6924
    return values;
6925
  })();
6926

6927
  onnx.FunctionProto = (function () {
6928
    /**
6929
     * Properties of a FunctionProto.
6930
     * @memberof onnx
6931
     * @interface IFunctionProto
6932
     * @property {string|null} [name] FunctionProto name
6933
     * @property {Array.<string>|null} [input] FunctionProto input
6934
     * @property {Array.<string>|null} [output] FunctionProto output
6935
     * @property {Array.<string>|null} [attribute] FunctionProto attribute
6936
     * @property {Array.<onnx.IAttributeProto>|null} [attributeProto] FunctionProto attributeProto
6937
     * @property {Array.<onnx.INodeProto>|null} [node] FunctionProto node
6938
     * @property {string|null} [docString] FunctionProto docString
6939
     * @property {Array.<onnx.IOperatorSetIdProto>|null} [opsetImport] FunctionProto opsetImport
6940
     * @property {string|null} [domain] FunctionProto domain
6941
     */
6942

6943
    /**
6944
     * Constructs a new FunctionProto.
6945
     * @memberof onnx
6946
     * @classdesc Represents a FunctionProto.
6947
     * @implements IFunctionProto
6948
     * @constructor
6949
     * @param {onnx.IFunctionProto=} [properties] Properties to set
6950
     */
6951
    function FunctionProto(properties) {
6952
      this.input = [];
6953
      this.output = [];
6954
      this.attribute = [];
6955
      this.attributeProto = [];
6956
      this.node = [];
6957
      this.opsetImport = [];
6958
      if (properties)
6959
        for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
6960
          if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
6961
    }
6962

6963
    /**
6964
     * FunctionProto name.
6965
     * @member {string} name
6966
     * @memberof onnx.FunctionProto
6967
     * @instance
6968
     */
6969
    FunctionProto.prototype.name = '';
6970

6971
    /**
6972
     * FunctionProto input.
6973
     * @member {Array.<string>} input
6974
     * @memberof onnx.FunctionProto
6975
     * @instance
6976
     */
6977
    FunctionProto.prototype.input = $util.emptyArray;
6978

6979
    /**
6980
     * FunctionProto output.
6981
     * @member {Array.<string>} output
6982
     * @memberof onnx.FunctionProto
6983
     * @instance
6984
     */
6985
    FunctionProto.prototype.output = $util.emptyArray;
6986

6987
    /**
6988
     * FunctionProto attribute.
6989
     * @member {Array.<string>} attribute
6990
     * @memberof onnx.FunctionProto
6991
     * @instance
6992
     */
6993
    FunctionProto.prototype.attribute = $util.emptyArray;
6994

6995
    /**
6996
     * FunctionProto attributeProto.
6997
     * @member {Array.<onnx.IAttributeProto>} attributeProto
6998
     * @memberof onnx.FunctionProto
6999
     * @instance
7000
     */
7001
    FunctionProto.prototype.attributeProto = $util.emptyArray;
7002

7003
    /**
7004
     * FunctionProto node.
7005
     * @member {Array.<onnx.INodeProto>} node
7006
     * @memberof onnx.FunctionProto
7007
     * @instance
7008
     */
7009
    FunctionProto.prototype.node = $util.emptyArray;
7010

7011
    /**
7012
     * FunctionProto docString.
7013
     * @member {string} docString
7014
     * @memberof onnx.FunctionProto
7015
     * @instance
7016
     */
7017
    FunctionProto.prototype.docString = '';
7018

7019
    /**
7020
     * FunctionProto opsetImport.
7021
     * @member {Array.<onnx.IOperatorSetIdProto>} opsetImport
7022
     * @memberof onnx.FunctionProto
7023
     * @instance
7024
     */
7025
    FunctionProto.prototype.opsetImport = $util.emptyArray;
7026

7027
    /**
7028
     * FunctionProto domain.
7029
     * @member {string} domain
7030
     * @memberof onnx.FunctionProto
7031
     * @instance
7032
     */
7033
    FunctionProto.prototype.domain = '';
7034

7035
    /**
7036
     * Creates a new FunctionProto instance using the specified properties.
7037
     * @function create
7038
     * @memberof onnx.FunctionProto
7039
     * @static
7040
     * @param {onnx.IFunctionProto=} [properties] Properties to set
7041
     * @returns {onnx.FunctionProto} FunctionProto instance
7042
     */
7043
    FunctionProto.create = function create(properties) {
7044
      return new FunctionProto(properties);
7045
    };
7046

7047
    /**
7048
     * Encodes the specified FunctionProto message. Does not implicitly {@link onnx.FunctionProto.verify|verify} messages.
7049
     * @function encode
7050
     * @memberof onnx.FunctionProto
7051
     * @static
7052
     * @param {onnx.IFunctionProto} message FunctionProto message or plain object to encode
7053
     * @param {$protobuf.Writer} [writer] Writer to encode to
7054
     * @returns {$protobuf.Writer} Writer
7055
     */
7056
    FunctionProto.encode = function encode(message, writer) {
7057
      if (!writer) writer = $Writer.create();
7058
      if (message.name != null && Object.hasOwnProperty.call(message, 'name'))
7059
        writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.name);
7060
      if (message.input != null && message.input.length)
7061
        for (var i = 0; i < message.input.length; ++i)
7062
          writer.uint32(/* id 4, wireType 2 =*/ 34).string(message.input[i]);
7063
      if (message.output != null && message.output.length)
7064
        for (var i = 0; i < message.output.length; ++i)
7065
          writer.uint32(/* id 5, wireType 2 =*/ 42).string(message.output[i]);
7066
      if (message.attribute != null && message.attribute.length)
7067
        for (var i = 0; i < message.attribute.length; ++i)
7068
          writer.uint32(/* id 6, wireType 2 =*/ 50).string(message.attribute[i]);
7069
      if (message.node != null && message.node.length)
7070
        for (var i = 0; i < message.node.length; ++i)
7071
          $root.onnx.NodeProto.encode(message.node[i], writer.uint32(/* id 7, wireType 2 =*/ 58).fork()).ldelim();
7072
      if (message.docString != null && Object.hasOwnProperty.call(message, 'docString'))
7073
        writer.uint32(/* id 8, wireType 2 =*/ 66).string(message.docString);
7074
      if (message.opsetImport != null && message.opsetImport.length)
7075
        for (var i = 0; i < message.opsetImport.length; ++i)
7076
          $root.onnx.OperatorSetIdProto.encode(
7077
            message.opsetImport[i],
7078
            writer.uint32(/* id 9, wireType 2 =*/ 74).fork(),
7079
          ).ldelim();
7080
      if (message.domain != null && Object.hasOwnProperty.call(message, 'domain'))
7081
        writer.uint32(/* id 10, wireType 2 =*/ 82).string(message.domain);
7082
      if (message.attributeProto != null && message.attributeProto.length)
7083
        for (var i = 0; i < message.attributeProto.length; ++i)
7084
          $root.onnx.AttributeProto.encode(
7085
            message.attributeProto[i],
7086
            writer.uint32(/* id 11, wireType 2 =*/ 90).fork(),
7087
          ).ldelim();
7088
      return writer;
7089
    };
7090

7091
    /**
7092
     * Encodes the specified FunctionProto message, length delimited. Does not implicitly {@link onnx.FunctionProto.verify|verify} messages.
7093
     * @function encodeDelimited
7094
     * @memberof onnx.FunctionProto
7095
     * @static
7096
     * @param {onnx.IFunctionProto} message FunctionProto message or plain object to encode
7097
     * @param {$protobuf.Writer} [writer] Writer to encode to
7098
     * @returns {$protobuf.Writer} Writer
7099
     */
7100
    FunctionProto.encodeDelimited = function encodeDelimited(message, writer) {
7101
      return this.encode(message, writer).ldelim();
7102
    };
7103

7104
    /**
7105
     * Decodes a FunctionProto message from the specified reader or buffer.
7106
     * @function decode
7107
     * @memberof onnx.FunctionProto
7108
     * @static
7109
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
7110
     * @param {number} [length] Message length if known beforehand
7111
     * @returns {onnx.FunctionProto} FunctionProto
7112
     * @throws {Error} If the payload is not a reader or valid buffer
7113
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
7114
     */
7115
    FunctionProto.decode = function decode(reader, length) {
7116
      if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
7117
      var end = length === undefined ? reader.len : reader.pos + length,
7118
        message = new $root.onnx.FunctionProto();
7119
      while (reader.pos < end) {
7120
        var tag = reader.uint32();
7121
        switch (tag >>> 3) {
7122
          case 1: {
7123
            message.name = reader.string();
7124
            break;
7125
          }
7126
          case 4: {
7127
            if (!(message.input && message.input.length)) message.input = [];
7128
            message.input.push(reader.string());
7129
            break;
7130
          }
7131
          case 5: {
7132
            if (!(message.output && message.output.length)) message.output = [];
7133
            message.output.push(reader.string());
7134
            break;
7135
          }
7136
          case 6: {
7137
            if (!(message.attribute && message.attribute.length)) message.attribute = [];
7138
            message.attribute.push(reader.string());
7139
            break;
7140
          }
7141
          case 11: {
7142
            if (!(message.attributeProto && message.attributeProto.length)) message.attributeProto = [];
7143
            message.attributeProto.push($root.onnx.AttributeProto.decode(reader, reader.uint32()));
7144
            break;
7145
          }
7146
          case 7: {
7147
            if (!(message.node && message.node.length)) message.node = [];
7148
            message.node.push($root.onnx.NodeProto.decode(reader, reader.uint32()));
7149
            break;
7150
          }
7151
          case 8: {
7152
            message.docString = reader.string();
7153
            break;
7154
          }
7155
          case 9: {
7156
            if (!(message.opsetImport && message.opsetImport.length)) message.opsetImport = [];
7157
            message.opsetImport.push($root.onnx.OperatorSetIdProto.decode(reader, reader.uint32()));
7158
            break;
7159
          }
7160
          case 10: {
7161
            message.domain = reader.string();
7162
            break;
7163
          }
7164
          default:
7165
            reader.skipType(tag & 7);
7166
            break;
7167
        }
7168
      }
7169
      return message;
7170
    };
7171

7172
    /**
7173
     * Decodes a FunctionProto message from the specified reader or buffer, length delimited.
7174
     * @function decodeDelimited
7175
     * @memberof onnx.FunctionProto
7176
     * @static
7177
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
7178
     * @returns {onnx.FunctionProto} FunctionProto
7179
     * @throws {Error} If the payload is not a reader or valid buffer
7180
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
7181
     */
7182
    FunctionProto.decodeDelimited = function decodeDelimited(reader) {
7183
      if (!(reader instanceof $Reader)) reader = new $Reader(reader);
7184
      return this.decode(reader, reader.uint32());
7185
    };
7186

7187
    /**
7188
     * Verifies a FunctionProto message.
7189
     * @function verify
7190
     * @memberof onnx.FunctionProto
7191
     * @static
7192
     * @param {Object.<string,*>} message Plain object to verify
7193
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
7194
     */
7195
    FunctionProto.verify = function verify(message) {
7196
      if (typeof message !== 'object' || message === null) return 'object expected';
7197
      if (message.name != null && message.hasOwnProperty('name'))
7198
        if (!$util.isString(message.name)) return 'name: string expected';
7199
      if (message.input != null && message.hasOwnProperty('input')) {
7200
        if (!Array.isArray(message.input)) return 'input: array expected';
7201
        for (var i = 0; i < message.input.length; ++i)
7202
          if (!$util.isString(message.input[i])) return 'input: string[] expected';
7203
      }
7204
      if (message.output != null && message.hasOwnProperty('output')) {
7205
        if (!Array.isArray(message.output)) return 'output: array expected';
7206
        for (var i = 0; i < message.output.length; ++i)
7207
          if (!$util.isString(message.output[i])) return 'output: string[] expected';
7208
      }
7209
      if (message.attribute != null && message.hasOwnProperty('attribute')) {
7210
        if (!Array.isArray(message.attribute)) return 'attribute: array expected';
7211
        for (var i = 0; i < message.attribute.length; ++i)
7212
          if (!$util.isString(message.attribute[i])) return 'attribute: string[] expected';
7213
      }
7214
      if (message.attributeProto != null && message.hasOwnProperty('attributeProto')) {
7215
        if (!Array.isArray(message.attributeProto)) return 'attributeProto: array expected';
7216
        for (var i = 0; i < message.attributeProto.length; ++i) {
7217
          var error = $root.onnx.AttributeProto.verify(message.attributeProto[i]);
7218
          if (error) return 'attributeProto.' + error;
7219
        }
7220
      }
7221
      if (message.node != null && message.hasOwnProperty('node')) {
7222
        if (!Array.isArray(message.node)) return 'node: array expected';
7223
        for (var i = 0; i < message.node.length; ++i) {
7224
          var error = $root.onnx.NodeProto.verify(message.node[i]);
7225
          if (error) return 'node.' + error;
7226
        }
7227
      }
7228
      if (message.docString != null && message.hasOwnProperty('docString'))
7229
        if (!$util.isString(message.docString)) return 'docString: string expected';
7230
      if (message.opsetImport != null && message.hasOwnProperty('opsetImport')) {
7231
        if (!Array.isArray(message.opsetImport)) return 'opsetImport: array expected';
7232
        for (var i = 0; i < message.opsetImport.length; ++i) {
7233
          var error = $root.onnx.OperatorSetIdProto.verify(message.opsetImport[i]);
7234
          if (error) return 'opsetImport.' + error;
7235
        }
7236
      }
7237
      if (message.domain != null && message.hasOwnProperty('domain'))
7238
        if (!$util.isString(message.domain)) return 'domain: string expected';
7239
      return null;
7240
    };
7241

7242
    /**
7243
     * Creates a FunctionProto message from a plain object. Also converts values to their respective internal types.
7244
     * @function fromObject
7245
     * @memberof onnx.FunctionProto
7246
     * @static
7247
     * @param {Object.<string,*>} object Plain object
7248
     * @returns {onnx.FunctionProto} FunctionProto
7249
     */
7250
    FunctionProto.fromObject = function fromObject(object) {
7251
      if (object instanceof $root.onnx.FunctionProto) return object;
7252
      var message = new $root.onnx.FunctionProto();
7253
      if (object.name != null) message.name = String(object.name);
7254
      if (object.input) {
7255
        if (!Array.isArray(object.input)) throw TypeError('.onnx.FunctionProto.input: array expected');
7256
        message.input = [];
7257
        for (var i = 0; i < object.input.length; ++i) message.input[i] = String(object.input[i]);
7258
      }
7259
      if (object.output) {
7260
        if (!Array.isArray(object.output)) throw TypeError('.onnx.FunctionProto.output: array expected');
7261
        message.output = [];
7262
        for (var i = 0; i < object.output.length; ++i) message.output[i] = String(object.output[i]);
7263
      }
7264
      if (object.attribute) {
7265
        if (!Array.isArray(object.attribute)) throw TypeError('.onnx.FunctionProto.attribute: array expected');
7266
        message.attribute = [];
7267
        for (var i = 0; i < object.attribute.length; ++i) message.attribute[i] = String(object.attribute[i]);
7268
      }
7269
      if (object.attributeProto) {
7270
        if (!Array.isArray(object.attributeProto))
7271
          throw TypeError('.onnx.FunctionProto.attributeProto: array expected');
7272
        message.attributeProto = [];
7273
        for (var i = 0; i < object.attributeProto.length; ++i) {
7274
          if (typeof object.attributeProto[i] !== 'object')
7275
            throw TypeError('.onnx.FunctionProto.attributeProto: object expected');
7276
          message.attributeProto[i] = $root.onnx.AttributeProto.fromObject(object.attributeProto[i]);
7277
        }
7278
      }
7279
      if (object.node) {
7280
        if (!Array.isArray(object.node)) throw TypeError('.onnx.FunctionProto.node: array expected');
7281
        message.node = [];
7282
        for (var i = 0; i < object.node.length; ++i) {
7283
          if (typeof object.node[i] !== 'object') throw TypeError('.onnx.FunctionProto.node: object expected');
7284
          message.node[i] = $root.onnx.NodeProto.fromObject(object.node[i]);
7285
        }
7286
      }
7287
      if (object.docString != null) message.docString = String(object.docString);
7288
      if (object.opsetImport) {
7289
        if (!Array.isArray(object.opsetImport)) throw TypeError('.onnx.FunctionProto.opsetImport: array expected');
7290
        message.opsetImport = [];
7291
        for (var i = 0; i < object.opsetImport.length; ++i) {
7292
          if (typeof object.opsetImport[i] !== 'object')
7293
            throw TypeError('.onnx.FunctionProto.opsetImport: object expected');
7294
          message.opsetImport[i] = $root.onnx.OperatorSetIdProto.fromObject(object.opsetImport[i]);
7295
        }
7296
      }
7297
      if (object.domain != null) message.domain = String(object.domain);
7298
      return message;
7299
    };
7300

7301
    /**
7302
     * Creates a plain object from a FunctionProto message. Also converts values to other types if specified.
7303
     * @function toObject
7304
     * @memberof onnx.FunctionProto
7305
     * @static
7306
     * @param {onnx.FunctionProto} message FunctionProto
7307
     * @param {$protobuf.IConversionOptions} [options] Conversion options
7308
     * @returns {Object.<string,*>} Plain object
7309
     */
7310
    FunctionProto.toObject = function toObject(message, options) {
7311
      if (!options) options = {};
7312
      var object = {};
7313
      if (options.arrays || options.defaults) {
7314
        object.input = [];
7315
        object.output = [];
7316
        object.attribute = [];
7317
        object.node = [];
7318
        object.opsetImport = [];
7319
        object.attributeProto = [];
7320
      }
7321
      if (options.defaults) {
7322
        object.name = '';
7323
        object.docString = '';
7324
        object.domain = '';
7325
      }
7326
      if (message.name != null && message.hasOwnProperty('name')) object.name = message.name;
7327
      if (message.input && message.input.length) {
7328
        object.input = [];
7329
        for (var j = 0; j < message.input.length; ++j) object.input[j] = message.input[j];
7330
      }
7331
      if (message.output && message.output.length) {
7332
        object.output = [];
7333
        for (var j = 0; j < message.output.length; ++j) object.output[j] = message.output[j];
7334
      }
7335
      if (message.attribute && message.attribute.length) {
7336
        object.attribute = [];
7337
        for (var j = 0; j < message.attribute.length; ++j) object.attribute[j] = message.attribute[j];
7338
      }
7339
      if (message.node && message.node.length) {
7340
        object.node = [];
7341
        for (var j = 0; j < message.node.length; ++j)
7342
          object.node[j] = $root.onnx.NodeProto.toObject(message.node[j], options);
7343
      }
7344
      if (message.docString != null && message.hasOwnProperty('docString')) object.docString = message.docString;
7345
      if (message.opsetImport && message.opsetImport.length) {
7346
        object.opsetImport = [];
7347
        for (var j = 0; j < message.opsetImport.length; ++j)
7348
          object.opsetImport[j] = $root.onnx.OperatorSetIdProto.toObject(message.opsetImport[j], options);
7349
      }
7350
      if (message.domain != null && message.hasOwnProperty('domain')) object.domain = message.domain;
7351
      if (message.attributeProto && message.attributeProto.length) {
7352
        object.attributeProto = [];
7353
        for (var j = 0; j < message.attributeProto.length; ++j)
7354
          object.attributeProto[j] = $root.onnx.AttributeProto.toObject(message.attributeProto[j], options);
7355
      }
7356
      return object;
7357
    };
7358

7359
    /**
7360
     * Converts this FunctionProto to JSON.
7361
     * @function toJSON
7362
     * @memberof onnx.FunctionProto
7363
     * @instance
7364
     * @returns {Object.<string,*>} JSON object
7365
     */
7366
    FunctionProto.prototype.toJSON = function toJSON() {
7367
      return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
7368
    };
7369

7370
    /**
7371
     * Gets the default type url for FunctionProto
7372
     * @function getTypeUrl
7373
     * @memberof onnx.FunctionProto
7374
     * @static
7375
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
7376
     * @returns {string} The default type url
7377
     */
7378
    FunctionProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
7379
      if (typeUrlPrefix === undefined) {
7380
        typeUrlPrefix = 'type.googleapis.com';
7381
      }
7382
      return typeUrlPrefix + '/onnx.FunctionProto';
7383
    };
7384

7385
    return FunctionProto;
7386
  })();
7387

7388
  return onnx;
7389
})();
7390

7391
module.exports = $root;
7392

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.