1# Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14# ============================================================================== 15from tflite_support import flatbuffers 16# automatically generated by the FlatBuffers compiler, do not modify 17 18# namespace: tflite 19 20from tflite_support.flatbuffers.compat import import_numpy 21np = import_numpy() 22 23class ZerosLikeOptions(object): 24 __slots__ = ['_tab'] 25 26 @classmethod 27 def GetRootAsZerosLikeOptions(cls, buf, offset): 28 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 29 x = ZerosLikeOptions() 30 x.Init(buf, n + offset) 31 return x 32 33 @classmethod 34 def ZerosLikeOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 35 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 36 37 # ZerosLikeOptions 38 def Init(self, buf, pos): 39 self._tab = flatbuffers.table.Table(buf, pos) 40 41def ZerosLikeOptionsStart(builder): builder.StartObject(0) 42def ZerosLikeOptionsEnd(builder): return builder.EndObject() 43 44 45class ZerosLikeOptionsT(object): 46 47 # ZerosLikeOptionsT 48 def __init__(self): 49 pass 50 51 @classmethod 52 def InitFromBuf(cls, buf, pos): 53 zerosLikeOptions = ZerosLikeOptions() 54 zerosLikeOptions.Init(buf, pos) 55 return cls.InitFromObj(zerosLikeOptions) 56 57 @classmethod 58 def InitFromObj(cls, zerosLikeOptions): 59 x = ZerosLikeOptionsT() 60 x._UnPack(zerosLikeOptions) 61 return x 62 63 # ZerosLikeOptionsT 64 def _UnPack(self, zerosLikeOptions): 65 if zerosLikeOptions is None: 66 return 67 68 # ZerosLikeOptionsT 69 def Pack(self, builder): 70 ZerosLikeOptionsStart(builder) 71 zerosLikeOptions = ZerosLikeOptionsEnd(builder) 72 return zerosLikeOptions 73# automatically generated by the FlatBuffers compiler, do not modify 74 75# namespace: tflite 76 77from tflite_support.flatbuffers.compat import import_numpy 78np = import_numpy() 79 80class WhileOptions(object): 81 __slots__ = ['_tab'] 82 83 @classmethod 84 def GetRootAsWhileOptions(cls, buf, offset): 85 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 86 x = WhileOptions() 87 x.Init(buf, n + offset) 88 return x 89 90 @classmethod 91 def WhileOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 92 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 93 94 # WhileOptions 95 def Init(self, buf, pos): 96 self._tab = flatbuffers.table.Table(buf, pos) 97 98 # WhileOptions 99 def CondSubgraphIndex(self): 100 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 101 if o != 0: 102 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 103 return 0 104 105 # WhileOptions 106 def BodySubgraphIndex(self): 107 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 108 if o != 0: 109 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 110 return 0 111 112def WhileOptionsStart(builder): builder.StartObject(2) 113def WhileOptionsAddCondSubgraphIndex(builder, condSubgraphIndex): builder.PrependInt32Slot(0, condSubgraphIndex, 0) 114def WhileOptionsAddBodySubgraphIndex(builder, bodySubgraphIndex): builder.PrependInt32Slot(1, bodySubgraphIndex, 0) 115def WhileOptionsEnd(builder): return builder.EndObject() 116 117 118class WhileOptionsT(object): 119 120 # WhileOptionsT 121 def __init__(self): 122 self.condSubgraphIndex = 0 # type: int 123 self.bodySubgraphIndex = 0 # type: int 124 125 @classmethod 126 def InitFromBuf(cls, buf, pos): 127 whileOptions = WhileOptions() 128 whileOptions.Init(buf, pos) 129 return cls.InitFromObj(whileOptions) 130 131 @classmethod 132 def InitFromObj(cls, whileOptions): 133 x = WhileOptionsT() 134 x._UnPack(whileOptions) 135 return x 136 137 # WhileOptionsT 138 def _UnPack(self, whileOptions): 139 if whileOptions is None: 140 return 141 self.condSubgraphIndex = whileOptions.CondSubgraphIndex() 142 self.bodySubgraphIndex = whileOptions.BodySubgraphIndex() 143 144 # WhileOptionsT 145 def Pack(self, builder): 146 WhileOptionsStart(builder) 147 WhileOptionsAddCondSubgraphIndex(builder, self.condSubgraphIndex) 148 WhileOptionsAddBodySubgraphIndex(builder, self.bodySubgraphIndex) 149 whileOptions = WhileOptionsEnd(builder) 150 return whileOptions 151# automatically generated by the FlatBuffers compiler, do not modify 152 153# namespace: tflite 154 155from tflite_support.flatbuffers.compat import import_numpy 156np = import_numpy() 157 158class WhereOptions(object): 159 __slots__ = ['_tab'] 160 161 @classmethod 162 def GetRootAsWhereOptions(cls, buf, offset): 163 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 164 x = WhereOptions() 165 x.Init(buf, n + offset) 166 return x 167 168 @classmethod 169 def WhereOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 170 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 171 172 # WhereOptions 173 def Init(self, buf, pos): 174 self._tab = flatbuffers.table.Table(buf, pos) 175 176def WhereOptionsStart(builder): builder.StartObject(0) 177def WhereOptionsEnd(builder): return builder.EndObject() 178 179 180class WhereOptionsT(object): 181 182 # WhereOptionsT 183 def __init__(self): 184 pass 185 186 @classmethod 187 def InitFromBuf(cls, buf, pos): 188 whereOptions = WhereOptions() 189 whereOptions.Init(buf, pos) 190 return cls.InitFromObj(whereOptions) 191 192 @classmethod 193 def InitFromObj(cls, whereOptions): 194 x = WhereOptionsT() 195 x._UnPack(whereOptions) 196 return x 197 198 # WhereOptionsT 199 def _UnPack(self, whereOptions): 200 if whereOptions is None: 201 return 202 203 # WhereOptionsT 204 def Pack(self, builder): 205 WhereOptionsStart(builder) 206 whereOptions = WhereOptionsEnd(builder) 207 return whereOptions 208# automatically generated by the FlatBuffers compiler, do not modify 209 210# namespace: tflite 211 212from tflite_support.flatbuffers.compat import import_numpy 213np = import_numpy() 214 215class UnpackOptions(object): 216 __slots__ = ['_tab'] 217 218 @classmethod 219 def GetRootAsUnpackOptions(cls, buf, offset): 220 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 221 x = UnpackOptions() 222 x.Init(buf, n + offset) 223 return x 224 225 @classmethod 226 def UnpackOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 227 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 228 229 # UnpackOptions 230 def Init(self, buf, pos): 231 self._tab = flatbuffers.table.Table(buf, pos) 232 233 # UnpackOptions 234 def Num(self): 235 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 236 if o != 0: 237 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 238 return 0 239 240 # UnpackOptions 241 def Axis(self): 242 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 243 if o != 0: 244 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 245 return 0 246 247def UnpackOptionsStart(builder): builder.StartObject(2) 248def UnpackOptionsAddNum(builder, num): builder.PrependInt32Slot(0, num, 0) 249def UnpackOptionsAddAxis(builder, axis): builder.PrependInt32Slot(1, axis, 0) 250def UnpackOptionsEnd(builder): return builder.EndObject() 251 252 253class UnpackOptionsT(object): 254 255 # UnpackOptionsT 256 def __init__(self): 257 self.num = 0 # type: int 258 self.axis = 0 # type: int 259 260 @classmethod 261 def InitFromBuf(cls, buf, pos): 262 unpackOptions = UnpackOptions() 263 unpackOptions.Init(buf, pos) 264 return cls.InitFromObj(unpackOptions) 265 266 @classmethod 267 def InitFromObj(cls, unpackOptions): 268 x = UnpackOptionsT() 269 x._UnPack(unpackOptions) 270 return x 271 272 # UnpackOptionsT 273 def _UnPack(self, unpackOptions): 274 if unpackOptions is None: 275 return 276 self.num = unpackOptions.Num() 277 self.axis = unpackOptions.Axis() 278 279 # UnpackOptionsT 280 def Pack(self, builder): 281 UnpackOptionsStart(builder) 282 UnpackOptionsAddNum(builder, self.num) 283 UnpackOptionsAddAxis(builder, self.axis) 284 unpackOptions = UnpackOptionsEnd(builder) 285 return unpackOptions 286# automatically generated by the FlatBuffers compiler, do not modify 287 288# namespace: tflite 289 290from tflite_support.flatbuffers.compat import import_numpy 291np = import_numpy() 292 293class UniqueOptions(object): 294 __slots__ = ['_tab'] 295 296 @classmethod 297 def GetRootAsUniqueOptions(cls, buf, offset): 298 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 299 x = UniqueOptions() 300 x.Init(buf, n + offset) 301 return x 302 303 @classmethod 304 def UniqueOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 305 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 306 307 # UniqueOptions 308 def Init(self, buf, pos): 309 self._tab = flatbuffers.table.Table(buf, pos) 310 311 # UniqueOptions 312 def IdxOutType(self): 313 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 314 if o != 0: 315 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 316 return 2 317 318def UniqueOptionsStart(builder): builder.StartObject(1) 319def UniqueOptionsAddIdxOutType(builder, idxOutType): builder.PrependInt8Slot(0, idxOutType, 2) 320def UniqueOptionsEnd(builder): return builder.EndObject() 321 322 323class UniqueOptionsT(object): 324 325 # UniqueOptionsT 326 def __init__(self): 327 self.idxOutType = 2 # type: int 328 329 @classmethod 330 def InitFromBuf(cls, buf, pos): 331 uniqueOptions = UniqueOptions() 332 uniqueOptions.Init(buf, pos) 333 return cls.InitFromObj(uniqueOptions) 334 335 @classmethod 336 def InitFromObj(cls, uniqueOptions): 337 x = UniqueOptionsT() 338 x._UnPack(uniqueOptions) 339 return x 340 341 # UniqueOptionsT 342 def _UnPack(self, uniqueOptions): 343 if uniqueOptions is None: 344 return 345 self.idxOutType = uniqueOptions.IdxOutType() 346 347 # UniqueOptionsT 348 def Pack(self, builder): 349 UniqueOptionsStart(builder) 350 UniqueOptionsAddIdxOutType(builder, self.idxOutType) 351 uniqueOptions = UniqueOptionsEnd(builder) 352 return uniqueOptions 353# automatically generated by the FlatBuffers compiler, do not modify 354 355# namespace: tflite 356 357from tflite_support.flatbuffers.compat import import_numpy 358np = import_numpy() 359 360class UnidirectionalSequenceLSTMOptions(object): 361 __slots__ = ['_tab'] 362 363 @classmethod 364 def GetRootAsUnidirectionalSequenceLSTMOptions(cls, buf, offset): 365 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 366 x = UnidirectionalSequenceLSTMOptions() 367 x.Init(buf, n + offset) 368 return x 369 370 @classmethod 371 def UnidirectionalSequenceLSTMOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 372 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 373 374 # UnidirectionalSequenceLSTMOptions 375 def Init(self, buf, pos): 376 self._tab = flatbuffers.table.Table(buf, pos) 377 378 # UnidirectionalSequenceLSTMOptions 379 def FusedActivationFunction(self): 380 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 381 if o != 0: 382 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 383 return 0 384 385 # UnidirectionalSequenceLSTMOptions 386 def CellClip(self): 387 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 388 if o != 0: 389 return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) 390 return 0.0 391 392 # UnidirectionalSequenceLSTMOptions 393 def ProjClip(self): 394 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 395 if o != 0: 396 return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) 397 return 0.0 398 399 # UnidirectionalSequenceLSTMOptions 400 def TimeMajor(self): 401 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 402 if o != 0: 403 return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) 404 return False 405 406def UnidirectionalSequenceLSTMOptionsStart(builder): builder.StartObject(4) 407def UnidirectionalSequenceLSTMOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0) 408def UnidirectionalSequenceLSTMOptionsAddCellClip(builder, cellClip): builder.PrependFloat32Slot(1, cellClip, 0.0) 409def UnidirectionalSequenceLSTMOptionsAddProjClip(builder, projClip): builder.PrependFloat32Slot(2, projClip, 0.0) 410def UnidirectionalSequenceLSTMOptionsAddTimeMajor(builder, timeMajor): builder.PrependBoolSlot(3, timeMajor, 0) 411def UnidirectionalSequenceLSTMOptionsEnd(builder): return builder.EndObject() 412 413 414class UnidirectionalSequenceLSTMOptionsT(object): 415 416 # UnidirectionalSequenceLSTMOptionsT 417 def __init__(self): 418 self.fusedActivationFunction = 0 # type: int 419 self.cellClip = 0.0 # type: float 420 self.projClip = 0.0 # type: float 421 self.timeMajor = False # type: bool 422 423 @classmethod 424 def InitFromBuf(cls, buf, pos): 425 unidirectionalSequenceLSTMOptions = UnidirectionalSequenceLSTMOptions() 426 unidirectionalSequenceLSTMOptions.Init(buf, pos) 427 return cls.InitFromObj(unidirectionalSequenceLSTMOptions) 428 429 @classmethod 430 def InitFromObj(cls, unidirectionalSequenceLSTMOptions): 431 x = UnidirectionalSequenceLSTMOptionsT() 432 x._UnPack(unidirectionalSequenceLSTMOptions) 433 return x 434 435 # UnidirectionalSequenceLSTMOptionsT 436 def _UnPack(self, unidirectionalSequenceLSTMOptions): 437 if unidirectionalSequenceLSTMOptions is None: 438 return 439 self.fusedActivationFunction = unidirectionalSequenceLSTMOptions.FusedActivationFunction() 440 self.cellClip = unidirectionalSequenceLSTMOptions.CellClip() 441 self.projClip = unidirectionalSequenceLSTMOptions.ProjClip() 442 self.timeMajor = unidirectionalSequenceLSTMOptions.TimeMajor() 443 444 # UnidirectionalSequenceLSTMOptionsT 445 def Pack(self, builder): 446 UnidirectionalSequenceLSTMOptionsStart(builder) 447 UnidirectionalSequenceLSTMOptionsAddFusedActivationFunction(builder, self.fusedActivationFunction) 448 UnidirectionalSequenceLSTMOptionsAddCellClip(builder, self.cellClip) 449 UnidirectionalSequenceLSTMOptionsAddProjClip(builder, self.projClip) 450 UnidirectionalSequenceLSTMOptionsAddTimeMajor(builder, self.timeMajor) 451 unidirectionalSequenceLSTMOptions = UnidirectionalSequenceLSTMOptionsEnd(builder) 452 return unidirectionalSequenceLSTMOptions 453# automatically generated by the FlatBuffers compiler, do not modify 454 455# namespace: tflite 456 457from tflite_support.flatbuffers.compat import import_numpy 458np = import_numpy() 459 460class Uint8Vector(object): 461 __slots__ = ['_tab'] 462 463 @classmethod 464 def GetRootAsUint8Vector(cls, buf, offset): 465 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 466 x = Uint8Vector() 467 x.Init(buf, n + offset) 468 return x 469 470 @classmethod 471 def Uint8VectorBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 472 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 473 474 # Uint8Vector 475 def Init(self, buf, pos): 476 self._tab = flatbuffers.table.Table(buf, pos) 477 478 # Uint8Vector 479 def Values(self, j): 480 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 481 if o != 0: 482 a = self._tab.Vector(o) 483 return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) 484 return 0 485 486 # Uint8Vector 487 def ValuesAsNumpy(self): 488 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 489 if o != 0: 490 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) 491 return 0 492 493 # Uint8Vector 494 def ValuesLength(self): 495 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 496 if o != 0: 497 return self._tab.VectorLen(o) 498 return 0 499 500 # Uint8Vector 501 def ValuesIsNone(self): 502 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 503 return o == 0 504 505def Uint8VectorStart(builder): builder.StartObject(1) 506def Uint8VectorAddValues(builder, values): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(values), 0) 507def Uint8VectorStartValuesVector(builder, numElems): return builder.StartVector(1, numElems, 1) 508def Uint8VectorEnd(builder): return builder.EndObject() 509 510try: 511 from typing import List 512except: 513 pass 514 515class Uint8VectorT(object): 516 517 # Uint8VectorT 518 def __init__(self): 519 self.values = None # type: List[int] 520 521 @classmethod 522 def InitFromBuf(cls, buf, pos): 523 uint8Vector = Uint8Vector() 524 uint8Vector.Init(buf, pos) 525 return cls.InitFromObj(uint8Vector) 526 527 @classmethod 528 def InitFromObj(cls, uint8Vector): 529 x = Uint8VectorT() 530 x._UnPack(uint8Vector) 531 return x 532 533 # Uint8VectorT 534 def _UnPack(self, uint8Vector): 535 if uint8Vector is None: 536 return 537 if not uint8Vector.ValuesIsNone(): 538 if np is None: 539 self.values = [] 540 for i in range(uint8Vector.ValuesLength()): 541 self.values.append(uint8Vector.Values(i)) 542 else: 543 self.values = uint8Vector.ValuesAsNumpy() 544 545 # Uint8VectorT 546 def Pack(self, builder): 547 if self.values is not None: 548 if np is not None and type(self.values) is np.ndarray: 549 values = builder.CreateNumpyVector(self.values) 550 else: 551 Uint8VectorStartValuesVector(builder, len(self.values)) 552 for i in reversed(range(len(self.values))): 553 builder.PrependUint8(self.values[i]) 554 values = builder.EndVector(len(self.values)) 555 Uint8VectorStart(builder) 556 if self.values is not None: 557 Uint8VectorAddValues(builder, values) 558 uint8Vector = Uint8VectorEnd(builder) 559 return uint8Vector 560# automatically generated by the FlatBuffers compiler, do not modify 561 562# namespace: tflite 563 564from tflite_support.flatbuffers.compat import import_numpy 565np = import_numpy() 566 567class Uint16Vector(object): 568 __slots__ = ['_tab'] 569 570 @classmethod 571 def GetRootAsUint16Vector(cls, buf, offset): 572 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 573 x = Uint16Vector() 574 x.Init(buf, n + offset) 575 return x 576 577 @classmethod 578 def Uint16VectorBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 579 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 580 581 # Uint16Vector 582 def Init(self, buf, pos): 583 self._tab = flatbuffers.table.Table(buf, pos) 584 585 # Uint16Vector 586 def Values(self, j): 587 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 588 if o != 0: 589 a = self._tab.Vector(o) 590 return self._tab.Get(flatbuffers.number_types.Uint16Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 2)) 591 return 0 592 593 # Uint16Vector 594 def ValuesAsNumpy(self): 595 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 596 if o != 0: 597 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint16Flags, o) 598 return 0 599 600 # Uint16Vector 601 def ValuesLength(self): 602 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 603 if o != 0: 604 return self._tab.VectorLen(o) 605 return 0 606 607 # Uint16Vector 608 def ValuesIsNone(self): 609 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 610 return o == 0 611 612def Uint16VectorStart(builder): builder.StartObject(1) 613def Uint16VectorAddValues(builder, values): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(values), 0) 614def Uint16VectorStartValuesVector(builder, numElems): return builder.StartVector(2, numElems, 2) 615def Uint16VectorEnd(builder): return builder.EndObject() 616 617try: 618 from typing import List 619except: 620 pass 621 622class Uint16VectorT(object): 623 624 # Uint16VectorT 625 def __init__(self): 626 self.values = None # type: List[int] 627 628 @classmethod 629 def InitFromBuf(cls, buf, pos): 630 uint16Vector = Uint16Vector() 631 uint16Vector.Init(buf, pos) 632 return cls.InitFromObj(uint16Vector) 633 634 @classmethod 635 def InitFromObj(cls, uint16Vector): 636 x = Uint16VectorT() 637 x._UnPack(uint16Vector) 638 return x 639 640 # Uint16VectorT 641 def _UnPack(self, uint16Vector): 642 if uint16Vector is None: 643 return 644 if not uint16Vector.ValuesIsNone(): 645 if np is None: 646 self.values = [] 647 for i in range(uint16Vector.ValuesLength()): 648 self.values.append(uint16Vector.Values(i)) 649 else: 650 self.values = uint16Vector.ValuesAsNumpy() 651 652 # Uint16VectorT 653 def Pack(self, builder): 654 if self.values is not None: 655 if np is not None and type(self.values) is np.ndarray: 656 values = builder.CreateNumpyVector(self.values) 657 else: 658 Uint16VectorStartValuesVector(builder, len(self.values)) 659 for i in reversed(range(len(self.values))): 660 builder.PrependUint16(self.values[i]) 661 values = builder.EndVector(len(self.values)) 662 Uint16VectorStart(builder) 663 if self.values is not None: 664 Uint16VectorAddValues(builder, values) 665 uint16Vector = Uint16VectorEnd(builder) 666 return uint16Vector 667# automatically generated by the FlatBuffers compiler, do not modify 668 669# namespace: tflite 670 671from tflite_support.flatbuffers.compat import import_numpy 672np = import_numpy() 673 674class TransposeOptions(object): 675 __slots__ = ['_tab'] 676 677 @classmethod 678 def GetRootAsTransposeOptions(cls, buf, offset): 679 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 680 x = TransposeOptions() 681 x.Init(buf, n + offset) 682 return x 683 684 @classmethod 685 def TransposeOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 686 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 687 688 # TransposeOptions 689 def Init(self, buf, pos): 690 self._tab = flatbuffers.table.Table(buf, pos) 691 692def TransposeOptionsStart(builder): builder.StartObject(0) 693def TransposeOptionsEnd(builder): return builder.EndObject() 694 695 696class TransposeOptionsT(object): 697 698 # TransposeOptionsT 699 def __init__(self): 700 pass 701 702 @classmethod 703 def InitFromBuf(cls, buf, pos): 704 transposeOptions = TransposeOptions() 705 transposeOptions.Init(buf, pos) 706 return cls.InitFromObj(transposeOptions) 707 708 @classmethod 709 def InitFromObj(cls, transposeOptions): 710 x = TransposeOptionsT() 711 x._UnPack(transposeOptions) 712 return x 713 714 # TransposeOptionsT 715 def _UnPack(self, transposeOptions): 716 if transposeOptions is None: 717 return 718 719 # TransposeOptionsT 720 def Pack(self, builder): 721 TransposeOptionsStart(builder) 722 transposeOptions = TransposeOptionsEnd(builder) 723 return transposeOptions 724# automatically generated by the FlatBuffers compiler, do not modify 725 726# namespace: tflite 727 728from tflite_support.flatbuffers.compat import import_numpy 729np = import_numpy() 730 731class TransposeConvOptions(object): 732 __slots__ = ['_tab'] 733 734 @classmethod 735 def GetRootAsTransposeConvOptions(cls, buf, offset): 736 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 737 x = TransposeConvOptions() 738 x.Init(buf, n + offset) 739 return x 740 741 @classmethod 742 def TransposeConvOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 743 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 744 745 # TransposeConvOptions 746 def Init(self, buf, pos): 747 self._tab = flatbuffers.table.Table(buf, pos) 748 749 # TransposeConvOptions 750 def Padding(self): 751 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 752 if o != 0: 753 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 754 return 0 755 756 # TransposeConvOptions 757 def StrideW(self): 758 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 759 if o != 0: 760 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 761 return 0 762 763 # TransposeConvOptions 764 def StrideH(self): 765 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 766 if o != 0: 767 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 768 return 0 769 770def TransposeConvOptionsStart(builder): builder.StartObject(3) 771def TransposeConvOptionsAddPadding(builder, padding): builder.PrependInt8Slot(0, padding, 0) 772def TransposeConvOptionsAddStrideW(builder, strideW): builder.PrependInt32Slot(1, strideW, 0) 773def TransposeConvOptionsAddStrideH(builder, strideH): builder.PrependInt32Slot(2, strideH, 0) 774def TransposeConvOptionsEnd(builder): return builder.EndObject() 775 776 777class TransposeConvOptionsT(object): 778 779 # TransposeConvOptionsT 780 def __init__(self): 781 self.padding = 0 # type: int 782 self.strideW = 0 # type: int 783 self.strideH = 0 # type: int 784 785 @classmethod 786 def InitFromBuf(cls, buf, pos): 787 transposeConvOptions = TransposeConvOptions() 788 transposeConvOptions.Init(buf, pos) 789 return cls.InitFromObj(transposeConvOptions) 790 791 @classmethod 792 def InitFromObj(cls, transposeConvOptions): 793 x = TransposeConvOptionsT() 794 x._UnPack(transposeConvOptions) 795 return x 796 797 # TransposeConvOptionsT 798 def _UnPack(self, transposeConvOptions): 799 if transposeConvOptions is None: 800 return 801 self.padding = transposeConvOptions.Padding() 802 self.strideW = transposeConvOptions.StrideW() 803 self.strideH = transposeConvOptions.StrideH() 804 805 # TransposeConvOptionsT 806 def Pack(self, builder): 807 TransposeConvOptionsStart(builder) 808 TransposeConvOptionsAddPadding(builder, self.padding) 809 TransposeConvOptionsAddStrideW(builder, self.strideW) 810 TransposeConvOptionsAddStrideH(builder, self.strideH) 811 transposeConvOptions = TransposeConvOptionsEnd(builder) 812 return transposeConvOptions 813# automatically generated by the FlatBuffers compiler, do not modify 814 815# namespace: tflite 816 817from tflite_support.flatbuffers.compat import import_numpy 818np = import_numpy() 819 820class TopKV2Options(object): 821 __slots__ = ['_tab'] 822 823 @classmethod 824 def GetRootAsTopKV2Options(cls, buf, offset): 825 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 826 x = TopKV2Options() 827 x.Init(buf, n + offset) 828 return x 829 830 @classmethod 831 def TopKV2OptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 832 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 833 834 # TopKV2Options 835 def Init(self, buf, pos): 836 self._tab = flatbuffers.table.Table(buf, pos) 837 838def TopKV2OptionsStart(builder): builder.StartObject(0) 839def TopKV2OptionsEnd(builder): return builder.EndObject() 840 841 842class TopKV2OptionsT(object): 843 844 # TopKV2OptionsT 845 def __init__(self): 846 pass 847 848 @classmethod 849 def InitFromBuf(cls, buf, pos): 850 topKV2Options = TopKV2Options() 851 topKV2Options.Init(buf, pos) 852 return cls.InitFromObj(topKV2Options) 853 854 @classmethod 855 def InitFromObj(cls, topKV2Options): 856 x = TopKV2OptionsT() 857 x._UnPack(topKV2Options) 858 return x 859 860 # TopKV2OptionsT 861 def _UnPack(self, topKV2Options): 862 if topKV2Options is None: 863 return 864 865 # TopKV2OptionsT 866 def Pack(self, builder): 867 TopKV2OptionsStart(builder) 868 topKV2Options = TopKV2OptionsEnd(builder) 869 return topKV2Options 870# automatically generated by the FlatBuffers compiler, do not modify 871 872# namespace: tflite 873 874from tflite_support.flatbuffers.compat import import_numpy 875np = import_numpy() 876 877class TileOptions(object): 878 __slots__ = ['_tab'] 879 880 @classmethod 881 def GetRootAsTileOptions(cls, buf, offset): 882 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 883 x = TileOptions() 884 x.Init(buf, n + offset) 885 return x 886 887 @classmethod 888 def TileOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 889 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 890 891 # TileOptions 892 def Init(self, buf, pos): 893 self._tab = flatbuffers.table.Table(buf, pos) 894 895def TileOptionsStart(builder): builder.StartObject(0) 896def TileOptionsEnd(builder): return builder.EndObject() 897 898 899class TileOptionsT(object): 900 901 # TileOptionsT 902 def __init__(self): 903 pass 904 905 @classmethod 906 def InitFromBuf(cls, buf, pos): 907 tileOptions = TileOptions() 908 tileOptions.Init(buf, pos) 909 return cls.InitFromObj(tileOptions) 910 911 @classmethod 912 def InitFromObj(cls, tileOptions): 913 x = TileOptionsT() 914 x._UnPack(tileOptions) 915 return x 916 917 # TileOptionsT 918 def _UnPack(self, tileOptions): 919 if tileOptions is None: 920 return 921 922 # TileOptionsT 923 def Pack(self, builder): 924 TileOptionsStart(builder) 925 tileOptions = TileOptionsEnd(builder) 926 return tileOptions 927# automatically generated by the FlatBuffers compiler, do not modify 928 929# namespace: tflite 930 931class TensorType(object): 932 FLOAT32 = 0 933 FLOAT16 = 1 934 INT32 = 2 935 UINT8 = 3 936 INT64 = 4 937 STRING = 5 938 BOOL = 6 939 INT16 = 7 940 COMPLEX64 = 8 941 INT8 = 9 942 943# automatically generated by the FlatBuffers compiler, do not modify 944 945# namespace: tflite 946 947from tflite_support.flatbuffers.compat import import_numpy 948np = import_numpy() 949 950class Tensor(object): 951 __slots__ = ['_tab'] 952 953 @classmethod 954 def GetRootAsTensor(cls, buf, offset): 955 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 956 x = Tensor() 957 x.Init(buf, n + offset) 958 return x 959 960 @classmethod 961 def TensorBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 962 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 963 964 # Tensor 965 def Init(self, buf, pos): 966 self._tab = flatbuffers.table.Table(buf, pos) 967 968 # Tensor 969 def Shape(self, j): 970 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 971 if o != 0: 972 a = self._tab.Vector(o) 973 return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 974 return 0 975 976 # Tensor 977 def ShapeAsNumpy(self): 978 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 979 if o != 0: 980 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) 981 return 0 982 983 # Tensor 984 def ShapeLength(self): 985 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 986 if o != 0: 987 return self._tab.VectorLen(o) 988 return 0 989 990 # Tensor 991 def ShapeIsNone(self): 992 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 993 return o == 0 994 995 # Tensor 996 def Type(self): 997 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 998 if o != 0: 999 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 1000 return 0 1001 1002 # Tensor 1003 def Buffer(self): 1004 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 1005 if o != 0: 1006 return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos) 1007 return 0 1008 1009 # Tensor 1010 def Name(self): 1011 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 1012 if o != 0: 1013 return self._tab.String(o + self._tab.Pos) 1014 return None 1015 1016 # Tensor 1017 def Quantization(self): 1018 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) 1019 if o != 0: 1020 x = self._tab.Indirect(o + self._tab.Pos) 1021 obj = QuantizationParameters() 1022 obj.Init(self._tab.Bytes, x) 1023 return obj 1024 return None 1025 1026 # Tensor 1027 def IsVariable(self): 1028 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) 1029 if o != 0: 1030 return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) 1031 return False 1032 1033 # Tensor 1034 def Sparsity(self): 1035 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) 1036 if o != 0: 1037 x = self._tab.Indirect(o + self._tab.Pos) 1038 obj = SparsityParameters() 1039 obj.Init(self._tab.Bytes, x) 1040 return obj 1041 return None 1042 1043 # Tensor 1044 def ShapeSignature(self, j): 1045 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) 1046 if o != 0: 1047 a = self._tab.Vector(o) 1048 return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 1049 return 0 1050 1051 # Tensor 1052 def ShapeSignatureAsNumpy(self): 1053 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) 1054 if o != 0: 1055 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) 1056 return 0 1057 1058 # Tensor 1059 def ShapeSignatureLength(self): 1060 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) 1061 if o != 0: 1062 return self._tab.VectorLen(o) 1063 return 0 1064 1065 # Tensor 1066 def ShapeSignatureIsNone(self): 1067 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) 1068 return o == 0 1069 1070def TensorStart(builder): builder.StartObject(8) 1071def TensorAddShape(builder, shape): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(shape), 0) 1072def TensorStartShapeVector(builder, numElems): return builder.StartVector(4, numElems, 4) 1073def TensorAddType(builder, type): builder.PrependInt8Slot(1, type, 0) 1074def TensorAddBuffer(builder, buffer): builder.PrependUint32Slot(2, buffer, 0) 1075def TensorAddName(builder, name): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0) 1076def TensorAddQuantization(builder, quantization): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(quantization), 0) 1077def TensorAddIsVariable(builder, isVariable): builder.PrependBoolSlot(5, isVariable, 0) 1078def TensorAddSparsity(builder, sparsity): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(sparsity), 0) 1079def TensorAddShapeSignature(builder, shapeSignature): builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(shapeSignature), 0) 1080def TensorStartShapeSignatureVector(builder, numElems): return builder.StartVector(4, numElems, 4) 1081def TensorEnd(builder): return builder.EndObject() 1082 1083try: 1084 from typing import List, Optional 1085except: 1086 pass 1087 1088class TensorT(object): 1089 1090 # TensorT 1091 def __init__(self): 1092 self.shape = None # type: List[int] 1093 self.type = 0 # type: int 1094 self.buffer = 0 # type: int 1095 self.name = None # type: str 1096 self.quantization = None # type: Optional[QuantizationParametersT] 1097 self.isVariable = False # type: bool 1098 self.sparsity = None # type: Optional[SparsityParametersT] 1099 self.shapeSignature = None # type: List[int] 1100 1101 @classmethod 1102 def InitFromBuf(cls, buf, pos): 1103 tensor = Tensor() 1104 tensor.Init(buf, pos) 1105 return cls.InitFromObj(tensor) 1106 1107 @classmethod 1108 def InitFromObj(cls, tensor): 1109 x = TensorT() 1110 x._UnPack(tensor) 1111 return x 1112 1113 # TensorT 1114 def _UnPack(self, tensor): 1115 if tensor is None: 1116 return 1117 if not tensor.ShapeIsNone(): 1118 if np is None: 1119 self.shape = [] 1120 for i in range(tensor.ShapeLength()): 1121 self.shape.append(tensor.Shape(i)) 1122 else: 1123 self.shape = tensor.ShapeAsNumpy() 1124 self.type = tensor.Type() 1125 self.buffer = tensor.Buffer() 1126 self.name = tensor.Name() 1127 if tensor.Quantization() is not None: 1128 self.quantization = QuantizationParametersT.InitFromObj(tensor.Quantization()) 1129 self.isVariable = tensor.IsVariable() 1130 if tensor.Sparsity() is not None: 1131 self.sparsity = SparsityParametersT.InitFromObj(tensor.Sparsity()) 1132 if not tensor.ShapeSignatureIsNone(): 1133 if np is None: 1134 self.shapeSignature = [] 1135 for i in range(tensor.ShapeSignatureLength()): 1136 self.shapeSignature.append(tensor.ShapeSignature(i)) 1137 else: 1138 self.shapeSignature = tensor.ShapeSignatureAsNumpy() 1139 1140 # TensorT 1141 def Pack(self, builder): 1142 if self.shape is not None: 1143 if np is not None and type(self.shape) is np.ndarray: 1144 shape = builder.CreateNumpyVector(self.shape) 1145 else: 1146 TensorStartShapeVector(builder, len(self.shape)) 1147 for i in reversed(range(len(self.shape))): 1148 builder.PrependInt32(self.shape[i]) 1149 shape = builder.EndVector(len(self.shape)) 1150 if self.name is not None: 1151 name = builder.CreateString(self.name) 1152 if self.quantization is not None: 1153 quantization = self.quantization.Pack(builder) 1154 if self.sparsity is not None: 1155 sparsity = self.sparsity.Pack(builder) 1156 if self.shapeSignature is not None: 1157 if np is not None and type(self.shapeSignature) is np.ndarray: 1158 shapeSignature = builder.CreateNumpyVector(self.shapeSignature) 1159 else: 1160 TensorStartShapeSignatureVector(builder, len(self.shapeSignature)) 1161 for i in reversed(range(len(self.shapeSignature))): 1162 builder.PrependInt32(self.shapeSignature[i]) 1163 shapeSignature = builder.EndVector(len(self.shapeSignature)) 1164 TensorStart(builder) 1165 if self.shape is not None: 1166 TensorAddShape(builder, shape) 1167 TensorAddType(builder, self.type) 1168 TensorAddBuffer(builder, self.buffer) 1169 if self.name is not None: 1170 TensorAddName(builder, name) 1171 if self.quantization is not None: 1172 TensorAddQuantization(builder, quantization) 1173 TensorAddIsVariable(builder, self.isVariable) 1174 if self.sparsity is not None: 1175 TensorAddSparsity(builder, sparsity) 1176 if self.shapeSignature is not None: 1177 TensorAddShapeSignature(builder, shapeSignature) 1178 tensor = TensorEnd(builder) 1179 return tensor 1180# automatically generated by the FlatBuffers compiler, do not modify 1181 1182# namespace: tflite 1183 1184from tflite_support.flatbuffers.compat import import_numpy 1185np = import_numpy() 1186 1187class SubOptions(object): 1188 __slots__ = ['_tab'] 1189 1190 @classmethod 1191 def GetRootAsSubOptions(cls, buf, offset): 1192 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 1193 x = SubOptions() 1194 x.Init(buf, n + offset) 1195 return x 1196 1197 @classmethod 1198 def SubOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 1199 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 1200 1201 # SubOptions 1202 def Init(self, buf, pos): 1203 self._tab = flatbuffers.table.Table(buf, pos) 1204 1205 # SubOptions 1206 def FusedActivationFunction(self): 1207 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 1208 if o != 0: 1209 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 1210 return 0 1211 1212def SubOptionsStart(builder): builder.StartObject(1) 1213def SubOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0) 1214def SubOptionsEnd(builder): return builder.EndObject() 1215 1216 1217class SubOptionsT(object): 1218 1219 # SubOptionsT 1220 def __init__(self): 1221 self.fusedActivationFunction = 0 # type: int 1222 1223 @classmethod 1224 def InitFromBuf(cls, buf, pos): 1225 subOptions = SubOptions() 1226 subOptions.Init(buf, pos) 1227 return cls.InitFromObj(subOptions) 1228 1229 @classmethod 1230 def InitFromObj(cls, subOptions): 1231 x = SubOptionsT() 1232 x._UnPack(subOptions) 1233 return x 1234 1235 # SubOptionsT 1236 def _UnPack(self, subOptions): 1237 if subOptions is None: 1238 return 1239 self.fusedActivationFunction = subOptions.FusedActivationFunction() 1240 1241 # SubOptionsT 1242 def Pack(self, builder): 1243 SubOptionsStart(builder) 1244 SubOptionsAddFusedActivationFunction(builder, self.fusedActivationFunction) 1245 subOptions = SubOptionsEnd(builder) 1246 return subOptions 1247# automatically generated by the FlatBuffers compiler, do not modify 1248 1249# namespace: tflite 1250 1251from tflite_support.flatbuffers.compat import import_numpy 1252np = import_numpy() 1253 1254class SubGraph(object): 1255 __slots__ = ['_tab'] 1256 1257 @classmethod 1258 def GetRootAsSubGraph(cls, buf, offset): 1259 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 1260 x = SubGraph() 1261 x.Init(buf, n + offset) 1262 return x 1263 1264 @classmethod 1265 def SubGraphBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 1266 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 1267 1268 # SubGraph 1269 def Init(self, buf, pos): 1270 self._tab = flatbuffers.table.Table(buf, pos) 1271 1272 # SubGraph 1273 def Tensors(self, j): 1274 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 1275 if o != 0: 1276 x = self._tab.Vector(o) 1277 x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 1278 x = self._tab.Indirect(x) 1279 obj = Tensor() 1280 obj.Init(self._tab.Bytes, x) 1281 return obj 1282 return None 1283 1284 # SubGraph 1285 def TensorsLength(self): 1286 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 1287 if o != 0: 1288 return self._tab.VectorLen(o) 1289 return 0 1290 1291 # SubGraph 1292 def TensorsIsNone(self): 1293 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 1294 return o == 0 1295 1296 # SubGraph 1297 def Inputs(self, j): 1298 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 1299 if o != 0: 1300 a = self._tab.Vector(o) 1301 return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 1302 return 0 1303 1304 # SubGraph 1305 def InputsAsNumpy(self): 1306 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 1307 if o != 0: 1308 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) 1309 return 0 1310 1311 # SubGraph 1312 def InputsLength(self): 1313 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 1314 if o != 0: 1315 return self._tab.VectorLen(o) 1316 return 0 1317 1318 # SubGraph 1319 def InputsIsNone(self): 1320 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 1321 return o == 0 1322 1323 # SubGraph 1324 def Outputs(self, j): 1325 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 1326 if o != 0: 1327 a = self._tab.Vector(o) 1328 return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 1329 return 0 1330 1331 # SubGraph 1332 def OutputsAsNumpy(self): 1333 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 1334 if o != 0: 1335 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) 1336 return 0 1337 1338 # SubGraph 1339 def OutputsLength(self): 1340 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 1341 if o != 0: 1342 return self._tab.VectorLen(o) 1343 return 0 1344 1345 # SubGraph 1346 def OutputsIsNone(self): 1347 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 1348 return o == 0 1349 1350 # SubGraph 1351 def Operators(self, j): 1352 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 1353 if o != 0: 1354 x = self._tab.Vector(o) 1355 x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 1356 x = self._tab.Indirect(x) 1357 obj = Operator() 1358 obj.Init(self._tab.Bytes, x) 1359 return obj 1360 return None 1361 1362 # SubGraph 1363 def OperatorsLength(self): 1364 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 1365 if o != 0: 1366 return self._tab.VectorLen(o) 1367 return 0 1368 1369 # SubGraph 1370 def OperatorsIsNone(self): 1371 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 1372 return o == 0 1373 1374 # SubGraph 1375 def Name(self): 1376 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) 1377 if o != 0: 1378 return self._tab.String(o + self._tab.Pos) 1379 return None 1380 1381def SubGraphStart(builder): builder.StartObject(5) 1382def SubGraphAddTensors(builder, tensors): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(tensors), 0) 1383def SubGraphStartTensorsVector(builder, numElems): return builder.StartVector(4, numElems, 4) 1384def SubGraphAddInputs(builder, inputs): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(inputs), 0) 1385def SubGraphStartInputsVector(builder, numElems): return builder.StartVector(4, numElems, 4) 1386def SubGraphAddOutputs(builder, outputs): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(outputs), 0) 1387def SubGraphStartOutputsVector(builder, numElems): return builder.StartVector(4, numElems, 4) 1388def SubGraphAddOperators(builder, operators): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(operators), 0) 1389def SubGraphStartOperatorsVector(builder, numElems): return builder.StartVector(4, numElems, 4) 1390def SubGraphAddName(builder, name): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0) 1391def SubGraphEnd(builder): return builder.EndObject() 1392 1393try: 1394 from typing import List 1395except: 1396 pass 1397 1398class SubGraphT(object): 1399 1400 # SubGraphT 1401 def __init__(self): 1402 self.tensors = None # type: List[TensorT] 1403 self.inputs = None # type: List[int] 1404 self.outputs = None # type: List[int] 1405 self.operators = None # type: List[OperatorT] 1406 self.name = None # type: str 1407 1408 @classmethod 1409 def InitFromBuf(cls, buf, pos): 1410 subGraph = SubGraph() 1411 subGraph.Init(buf, pos) 1412 return cls.InitFromObj(subGraph) 1413 1414 @classmethod 1415 def InitFromObj(cls, subGraph): 1416 x = SubGraphT() 1417 x._UnPack(subGraph) 1418 return x 1419 1420 # SubGraphT 1421 def _UnPack(self, subGraph): 1422 if subGraph is None: 1423 return 1424 if not subGraph.TensorsIsNone(): 1425 self.tensors = [] 1426 for i in range(subGraph.TensorsLength()): 1427 if subGraph.Tensors(i) is None: 1428 self.tensors.append(None) 1429 else: 1430 tensor_ = TensorT.InitFromObj(subGraph.Tensors(i)) 1431 self.tensors.append(tensor_) 1432 if not subGraph.InputsIsNone(): 1433 if np is None: 1434 self.inputs = [] 1435 for i in range(subGraph.InputsLength()): 1436 self.inputs.append(subGraph.Inputs(i)) 1437 else: 1438 self.inputs = subGraph.InputsAsNumpy() 1439 if not subGraph.OutputsIsNone(): 1440 if np is None: 1441 self.outputs = [] 1442 for i in range(subGraph.OutputsLength()): 1443 self.outputs.append(subGraph.Outputs(i)) 1444 else: 1445 self.outputs = subGraph.OutputsAsNumpy() 1446 if not subGraph.OperatorsIsNone(): 1447 self.operators = [] 1448 for i in range(subGraph.OperatorsLength()): 1449 if subGraph.Operators(i) is None: 1450 self.operators.append(None) 1451 else: 1452 operator_ = OperatorT.InitFromObj(subGraph.Operators(i)) 1453 self.operators.append(operator_) 1454 self.name = subGraph.Name() 1455 1456 # SubGraphT 1457 def Pack(self, builder): 1458 if self.tensors is not None: 1459 tensorslist = [] 1460 for i in range(len(self.tensors)): 1461 tensorslist.append(self.tensors[i].Pack(builder)) 1462 SubGraphStartTensorsVector(builder, len(self.tensors)) 1463 for i in reversed(range(len(self.tensors))): 1464 builder.PrependUOffsetTRelative(tensorslist[i]) 1465 tensors = builder.EndVector(len(self.tensors)) 1466 if self.inputs is not None: 1467 if np is not None and type(self.inputs) is np.ndarray: 1468 inputs = builder.CreateNumpyVector(self.inputs) 1469 else: 1470 SubGraphStartInputsVector(builder, len(self.inputs)) 1471 for i in reversed(range(len(self.inputs))): 1472 builder.PrependInt32(self.inputs[i]) 1473 inputs = builder.EndVector(len(self.inputs)) 1474 if self.outputs is not None: 1475 if np is not None and type(self.outputs) is np.ndarray: 1476 outputs = builder.CreateNumpyVector(self.outputs) 1477 else: 1478 SubGraphStartOutputsVector(builder, len(self.outputs)) 1479 for i in reversed(range(len(self.outputs))): 1480 builder.PrependInt32(self.outputs[i]) 1481 outputs = builder.EndVector(len(self.outputs)) 1482 if self.operators is not None: 1483 operatorslist = [] 1484 for i in range(len(self.operators)): 1485 operatorslist.append(self.operators[i].Pack(builder)) 1486 SubGraphStartOperatorsVector(builder, len(self.operators)) 1487 for i in reversed(range(len(self.operators))): 1488 builder.PrependUOffsetTRelative(operatorslist[i]) 1489 operators = builder.EndVector(len(self.operators)) 1490 if self.name is not None: 1491 name = builder.CreateString(self.name) 1492 SubGraphStart(builder) 1493 if self.tensors is not None: 1494 SubGraphAddTensors(builder, tensors) 1495 if self.inputs is not None: 1496 SubGraphAddInputs(builder, inputs) 1497 if self.outputs is not None: 1498 SubGraphAddOutputs(builder, outputs) 1499 if self.operators is not None: 1500 SubGraphAddOperators(builder, operators) 1501 if self.name is not None: 1502 SubGraphAddName(builder, name) 1503 subGraph = SubGraphEnd(builder) 1504 return subGraph 1505# automatically generated by the FlatBuffers compiler, do not modify 1506 1507# namespace: tflite 1508 1509from tflite_support.flatbuffers.compat import import_numpy 1510np = import_numpy() 1511 1512class StridedSliceOptions(object): 1513 __slots__ = ['_tab'] 1514 1515 @classmethod 1516 def GetRootAsStridedSliceOptions(cls, buf, offset): 1517 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 1518 x = StridedSliceOptions() 1519 x.Init(buf, n + offset) 1520 return x 1521 1522 @classmethod 1523 def StridedSliceOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 1524 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 1525 1526 # StridedSliceOptions 1527 def Init(self, buf, pos): 1528 self._tab = flatbuffers.table.Table(buf, pos) 1529 1530 # StridedSliceOptions 1531 def BeginMask(self): 1532 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 1533 if o != 0: 1534 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 1535 return 0 1536 1537 # StridedSliceOptions 1538 def EndMask(self): 1539 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 1540 if o != 0: 1541 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 1542 return 0 1543 1544 # StridedSliceOptions 1545 def EllipsisMask(self): 1546 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 1547 if o != 0: 1548 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 1549 return 0 1550 1551 # StridedSliceOptions 1552 def NewAxisMask(self): 1553 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 1554 if o != 0: 1555 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 1556 return 0 1557 1558 # StridedSliceOptions 1559 def ShrinkAxisMask(self): 1560 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) 1561 if o != 0: 1562 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 1563 return 0 1564 1565def StridedSliceOptionsStart(builder): builder.StartObject(5) 1566def StridedSliceOptionsAddBeginMask(builder, beginMask): builder.PrependInt32Slot(0, beginMask, 0) 1567def StridedSliceOptionsAddEndMask(builder, endMask): builder.PrependInt32Slot(1, endMask, 0) 1568def StridedSliceOptionsAddEllipsisMask(builder, ellipsisMask): builder.PrependInt32Slot(2, ellipsisMask, 0) 1569def StridedSliceOptionsAddNewAxisMask(builder, newAxisMask): builder.PrependInt32Slot(3, newAxisMask, 0) 1570def StridedSliceOptionsAddShrinkAxisMask(builder, shrinkAxisMask): builder.PrependInt32Slot(4, shrinkAxisMask, 0) 1571def StridedSliceOptionsEnd(builder): return builder.EndObject() 1572 1573 1574class StridedSliceOptionsT(object): 1575 1576 # StridedSliceOptionsT 1577 def __init__(self): 1578 self.beginMask = 0 # type: int 1579 self.endMask = 0 # type: int 1580 self.ellipsisMask = 0 # type: int 1581 self.newAxisMask = 0 # type: int 1582 self.shrinkAxisMask = 0 # type: int 1583 1584 @classmethod 1585 def InitFromBuf(cls, buf, pos): 1586 stridedSliceOptions = StridedSliceOptions() 1587 stridedSliceOptions.Init(buf, pos) 1588 return cls.InitFromObj(stridedSliceOptions) 1589 1590 @classmethod 1591 def InitFromObj(cls, stridedSliceOptions): 1592 x = StridedSliceOptionsT() 1593 x._UnPack(stridedSliceOptions) 1594 return x 1595 1596 # StridedSliceOptionsT 1597 def _UnPack(self, stridedSliceOptions): 1598 if stridedSliceOptions is None: 1599 return 1600 self.beginMask = stridedSliceOptions.BeginMask() 1601 self.endMask = stridedSliceOptions.EndMask() 1602 self.ellipsisMask = stridedSliceOptions.EllipsisMask() 1603 self.newAxisMask = stridedSliceOptions.NewAxisMask() 1604 self.shrinkAxisMask = stridedSliceOptions.ShrinkAxisMask() 1605 1606 # StridedSliceOptionsT 1607 def Pack(self, builder): 1608 StridedSliceOptionsStart(builder) 1609 StridedSliceOptionsAddBeginMask(builder, self.beginMask) 1610 StridedSliceOptionsAddEndMask(builder, self.endMask) 1611 StridedSliceOptionsAddEllipsisMask(builder, self.ellipsisMask) 1612 StridedSliceOptionsAddNewAxisMask(builder, self.newAxisMask) 1613 StridedSliceOptionsAddShrinkAxisMask(builder, self.shrinkAxisMask) 1614 stridedSliceOptions = StridedSliceOptionsEnd(builder) 1615 return stridedSliceOptions 1616# automatically generated by the FlatBuffers compiler, do not modify 1617 1618# namespace: tflite 1619 1620from tflite_support.flatbuffers.compat import import_numpy 1621np = import_numpy() 1622 1623class SqueezeOptions(object): 1624 __slots__ = ['_tab'] 1625 1626 @classmethod 1627 def GetRootAsSqueezeOptions(cls, buf, offset): 1628 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 1629 x = SqueezeOptions() 1630 x.Init(buf, n + offset) 1631 return x 1632 1633 @classmethod 1634 def SqueezeOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 1635 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 1636 1637 # SqueezeOptions 1638 def Init(self, buf, pos): 1639 self._tab = flatbuffers.table.Table(buf, pos) 1640 1641 # SqueezeOptions 1642 def SqueezeDims(self, j): 1643 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 1644 if o != 0: 1645 a = self._tab.Vector(o) 1646 return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 1647 return 0 1648 1649 # SqueezeOptions 1650 def SqueezeDimsAsNumpy(self): 1651 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 1652 if o != 0: 1653 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) 1654 return 0 1655 1656 # SqueezeOptions 1657 def SqueezeDimsLength(self): 1658 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 1659 if o != 0: 1660 return self._tab.VectorLen(o) 1661 return 0 1662 1663 # SqueezeOptions 1664 def SqueezeDimsIsNone(self): 1665 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 1666 return o == 0 1667 1668def SqueezeOptionsStart(builder): builder.StartObject(1) 1669def SqueezeOptionsAddSqueezeDims(builder, squeezeDims): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(squeezeDims), 0) 1670def SqueezeOptionsStartSqueezeDimsVector(builder, numElems): return builder.StartVector(4, numElems, 4) 1671def SqueezeOptionsEnd(builder): return builder.EndObject() 1672 1673try: 1674 from typing import List 1675except: 1676 pass 1677 1678class SqueezeOptionsT(object): 1679 1680 # SqueezeOptionsT 1681 def __init__(self): 1682 self.squeezeDims = None # type: List[int] 1683 1684 @classmethod 1685 def InitFromBuf(cls, buf, pos): 1686 squeezeOptions = SqueezeOptions() 1687 squeezeOptions.Init(buf, pos) 1688 return cls.InitFromObj(squeezeOptions) 1689 1690 @classmethod 1691 def InitFromObj(cls, squeezeOptions): 1692 x = SqueezeOptionsT() 1693 x._UnPack(squeezeOptions) 1694 return x 1695 1696 # SqueezeOptionsT 1697 def _UnPack(self, squeezeOptions): 1698 if squeezeOptions is None: 1699 return 1700 if not squeezeOptions.SqueezeDimsIsNone(): 1701 if np is None: 1702 self.squeezeDims = [] 1703 for i in range(squeezeOptions.SqueezeDimsLength()): 1704 self.squeezeDims.append(squeezeOptions.SqueezeDims(i)) 1705 else: 1706 self.squeezeDims = squeezeOptions.SqueezeDimsAsNumpy() 1707 1708 # SqueezeOptionsT 1709 def Pack(self, builder): 1710 if self.squeezeDims is not None: 1711 if np is not None and type(self.squeezeDims) is np.ndarray: 1712 squeezeDims = builder.CreateNumpyVector(self.squeezeDims) 1713 else: 1714 SqueezeOptionsStartSqueezeDimsVector(builder, len(self.squeezeDims)) 1715 for i in reversed(range(len(self.squeezeDims))): 1716 builder.PrependInt32(self.squeezeDims[i]) 1717 squeezeDims = builder.EndVector(len(self.squeezeDims)) 1718 SqueezeOptionsStart(builder) 1719 if self.squeezeDims is not None: 1720 SqueezeOptionsAddSqueezeDims(builder, squeezeDims) 1721 squeezeOptions = SqueezeOptionsEnd(builder) 1722 return squeezeOptions 1723# automatically generated by the FlatBuffers compiler, do not modify 1724 1725# namespace: tflite 1726 1727from tflite_support.flatbuffers.compat import import_numpy 1728np = import_numpy() 1729 1730class SquaredDifferenceOptions(object): 1731 __slots__ = ['_tab'] 1732 1733 @classmethod 1734 def GetRootAsSquaredDifferenceOptions(cls, buf, offset): 1735 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 1736 x = SquaredDifferenceOptions() 1737 x.Init(buf, n + offset) 1738 return x 1739 1740 @classmethod 1741 def SquaredDifferenceOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 1742 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 1743 1744 # SquaredDifferenceOptions 1745 def Init(self, buf, pos): 1746 self._tab = flatbuffers.table.Table(buf, pos) 1747 1748def SquaredDifferenceOptionsStart(builder): builder.StartObject(0) 1749def SquaredDifferenceOptionsEnd(builder): return builder.EndObject() 1750 1751 1752class SquaredDifferenceOptionsT(object): 1753 1754 # SquaredDifferenceOptionsT 1755 def __init__(self): 1756 pass 1757 1758 @classmethod 1759 def InitFromBuf(cls, buf, pos): 1760 squaredDifferenceOptions = SquaredDifferenceOptions() 1761 squaredDifferenceOptions.Init(buf, pos) 1762 return cls.InitFromObj(squaredDifferenceOptions) 1763 1764 @classmethod 1765 def InitFromObj(cls, squaredDifferenceOptions): 1766 x = SquaredDifferenceOptionsT() 1767 x._UnPack(squaredDifferenceOptions) 1768 return x 1769 1770 # SquaredDifferenceOptionsT 1771 def _UnPack(self, squaredDifferenceOptions): 1772 if squaredDifferenceOptions is None: 1773 return 1774 1775 # SquaredDifferenceOptionsT 1776 def Pack(self, builder): 1777 SquaredDifferenceOptionsStart(builder) 1778 squaredDifferenceOptions = SquaredDifferenceOptionsEnd(builder) 1779 return squaredDifferenceOptions 1780# automatically generated by the FlatBuffers compiler, do not modify 1781 1782# namespace: tflite 1783 1784from tflite_support.flatbuffers.compat import import_numpy 1785np = import_numpy() 1786 1787class SquareOptions(object): 1788 __slots__ = ['_tab'] 1789 1790 @classmethod 1791 def GetRootAsSquareOptions(cls, buf, offset): 1792 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 1793 x = SquareOptions() 1794 x.Init(buf, n + offset) 1795 return x 1796 1797 @classmethod 1798 def SquareOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 1799 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 1800 1801 # SquareOptions 1802 def Init(self, buf, pos): 1803 self._tab = flatbuffers.table.Table(buf, pos) 1804 1805def SquareOptionsStart(builder): builder.StartObject(0) 1806def SquareOptionsEnd(builder): return builder.EndObject() 1807 1808 1809class SquareOptionsT(object): 1810 1811 # SquareOptionsT 1812 def __init__(self): 1813 pass 1814 1815 @classmethod 1816 def InitFromBuf(cls, buf, pos): 1817 squareOptions = SquareOptions() 1818 squareOptions.Init(buf, pos) 1819 return cls.InitFromObj(squareOptions) 1820 1821 @classmethod 1822 def InitFromObj(cls, squareOptions): 1823 x = SquareOptionsT() 1824 x._UnPack(squareOptions) 1825 return x 1826 1827 # SquareOptionsT 1828 def _UnPack(self, squareOptions): 1829 if squareOptions is None: 1830 return 1831 1832 # SquareOptionsT 1833 def Pack(self, builder): 1834 SquareOptionsStart(builder) 1835 squareOptions = SquareOptionsEnd(builder) 1836 return squareOptions 1837# automatically generated by the FlatBuffers compiler, do not modify 1838 1839# namespace: tflite 1840 1841from tflite_support.flatbuffers.compat import import_numpy 1842np = import_numpy() 1843 1844class SplitVOptions(object): 1845 __slots__ = ['_tab'] 1846 1847 @classmethod 1848 def GetRootAsSplitVOptions(cls, buf, offset): 1849 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 1850 x = SplitVOptions() 1851 x.Init(buf, n + offset) 1852 return x 1853 1854 @classmethod 1855 def SplitVOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 1856 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 1857 1858 # SplitVOptions 1859 def Init(self, buf, pos): 1860 self._tab = flatbuffers.table.Table(buf, pos) 1861 1862 # SplitVOptions 1863 def NumSplits(self): 1864 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 1865 if o != 0: 1866 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 1867 return 0 1868 1869def SplitVOptionsStart(builder): builder.StartObject(1) 1870def SplitVOptionsAddNumSplits(builder, numSplits): builder.PrependInt32Slot(0, numSplits, 0) 1871def SplitVOptionsEnd(builder): return builder.EndObject() 1872 1873 1874class SplitVOptionsT(object): 1875 1876 # SplitVOptionsT 1877 def __init__(self): 1878 self.numSplits = 0 # type: int 1879 1880 @classmethod 1881 def InitFromBuf(cls, buf, pos): 1882 splitVOptions = SplitVOptions() 1883 splitVOptions.Init(buf, pos) 1884 return cls.InitFromObj(splitVOptions) 1885 1886 @classmethod 1887 def InitFromObj(cls, splitVOptions): 1888 x = SplitVOptionsT() 1889 x._UnPack(splitVOptions) 1890 return x 1891 1892 # SplitVOptionsT 1893 def _UnPack(self, splitVOptions): 1894 if splitVOptions is None: 1895 return 1896 self.numSplits = splitVOptions.NumSplits() 1897 1898 # SplitVOptionsT 1899 def Pack(self, builder): 1900 SplitVOptionsStart(builder) 1901 SplitVOptionsAddNumSplits(builder, self.numSplits) 1902 splitVOptions = SplitVOptionsEnd(builder) 1903 return splitVOptions 1904# automatically generated by the FlatBuffers compiler, do not modify 1905 1906# namespace: tflite 1907 1908from tflite_support.flatbuffers.compat import import_numpy 1909np = import_numpy() 1910 1911class SplitOptions(object): 1912 __slots__ = ['_tab'] 1913 1914 @classmethod 1915 def GetRootAsSplitOptions(cls, buf, offset): 1916 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 1917 x = SplitOptions() 1918 x.Init(buf, n + offset) 1919 return x 1920 1921 @classmethod 1922 def SplitOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 1923 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 1924 1925 # SplitOptions 1926 def Init(self, buf, pos): 1927 self._tab = flatbuffers.table.Table(buf, pos) 1928 1929 # SplitOptions 1930 def NumSplits(self): 1931 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 1932 if o != 0: 1933 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 1934 return 0 1935 1936def SplitOptionsStart(builder): builder.StartObject(1) 1937def SplitOptionsAddNumSplits(builder, numSplits): builder.PrependInt32Slot(0, numSplits, 0) 1938def SplitOptionsEnd(builder): return builder.EndObject() 1939 1940 1941class SplitOptionsT(object): 1942 1943 # SplitOptionsT 1944 def __init__(self): 1945 self.numSplits = 0 # type: int 1946 1947 @classmethod 1948 def InitFromBuf(cls, buf, pos): 1949 splitOptions = SplitOptions() 1950 splitOptions.Init(buf, pos) 1951 return cls.InitFromObj(splitOptions) 1952 1953 @classmethod 1954 def InitFromObj(cls, splitOptions): 1955 x = SplitOptionsT() 1956 x._UnPack(splitOptions) 1957 return x 1958 1959 # SplitOptionsT 1960 def _UnPack(self, splitOptions): 1961 if splitOptions is None: 1962 return 1963 self.numSplits = splitOptions.NumSplits() 1964 1965 # SplitOptionsT 1966 def Pack(self, builder): 1967 SplitOptionsStart(builder) 1968 SplitOptionsAddNumSplits(builder, self.numSplits) 1969 splitOptions = SplitOptionsEnd(builder) 1970 return splitOptions 1971# automatically generated by the FlatBuffers compiler, do not modify 1972 1973# namespace: tflite 1974 1975from tflite_support.flatbuffers.compat import import_numpy 1976np = import_numpy() 1977 1978class SparsityParameters(object): 1979 __slots__ = ['_tab'] 1980 1981 @classmethod 1982 def GetRootAsSparsityParameters(cls, buf, offset): 1983 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 1984 x = SparsityParameters() 1985 x.Init(buf, n + offset) 1986 return x 1987 1988 @classmethod 1989 def SparsityParametersBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 1990 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 1991 1992 # SparsityParameters 1993 def Init(self, buf, pos): 1994 self._tab = flatbuffers.table.Table(buf, pos) 1995 1996 # SparsityParameters 1997 def TraversalOrder(self, j): 1998 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 1999 if o != 0: 2000 a = self._tab.Vector(o) 2001 return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 2002 return 0 2003 2004 # SparsityParameters 2005 def TraversalOrderAsNumpy(self): 2006 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 2007 if o != 0: 2008 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) 2009 return 0 2010 2011 # SparsityParameters 2012 def TraversalOrderLength(self): 2013 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 2014 if o != 0: 2015 return self._tab.VectorLen(o) 2016 return 0 2017 2018 # SparsityParameters 2019 def TraversalOrderIsNone(self): 2020 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 2021 return o == 0 2022 2023 # SparsityParameters 2024 def BlockMap(self, j): 2025 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 2026 if o != 0: 2027 a = self._tab.Vector(o) 2028 return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 2029 return 0 2030 2031 # SparsityParameters 2032 def BlockMapAsNumpy(self): 2033 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 2034 if o != 0: 2035 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) 2036 return 0 2037 2038 # SparsityParameters 2039 def BlockMapLength(self): 2040 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 2041 if o != 0: 2042 return self._tab.VectorLen(o) 2043 return 0 2044 2045 # SparsityParameters 2046 def BlockMapIsNone(self): 2047 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 2048 return o == 0 2049 2050 # SparsityParameters 2051 def DimMetadata(self, j): 2052 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 2053 if o != 0: 2054 x = self._tab.Vector(o) 2055 x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 2056 x = self._tab.Indirect(x) 2057 obj = DimensionMetadata() 2058 obj.Init(self._tab.Bytes, x) 2059 return obj 2060 return None 2061 2062 # SparsityParameters 2063 def DimMetadataLength(self): 2064 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 2065 if o != 0: 2066 return self._tab.VectorLen(o) 2067 return 0 2068 2069 # SparsityParameters 2070 def DimMetadataIsNone(self): 2071 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 2072 return o == 0 2073 2074def SparsityParametersStart(builder): builder.StartObject(3) 2075def SparsityParametersAddTraversalOrder(builder, traversalOrder): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(traversalOrder), 0) 2076def SparsityParametersStartTraversalOrderVector(builder, numElems): return builder.StartVector(4, numElems, 4) 2077def SparsityParametersAddBlockMap(builder, blockMap): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(blockMap), 0) 2078def SparsityParametersStartBlockMapVector(builder, numElems): return builder.StartVector(4, numElems, 4) 2079def SparsityParametersAddDimMetadata(builder, dimMetadata): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(dimMetadata), 0) 2080def SparsityParametersStartDimMetadataVector(builder, numElems): return builder.StartVector(4, numElems, 4) 2081def SparsityParametersEnd(builder): return builder.EndObject() 2082 2083try: 2084 from typing import List 2085except: 2086 pass 2087 2088class SparsityParametersT(object): 2089 2090 # SparsityParametersT 2091 def __init__(self): 2092 self.traversalOrder = None # type: List[int] 2093 self.blockMap = None # type: List[int] 2094 self.dimMetadata = None # type: List[DimensionMetadataT] 2095 2096 @classmethod 2097 def InitFromBuf(cls, buf, pos): 2098 sparsityParameters = SparsityParameters() 2099 sparsityParameters.Init(buf, pos) 2100 return cls.InitFromObj(sparsityParameters) 2101 2102 @classmethod 2103 def InitFromObj(cls, sparsityParameters): 2104 x = SparsityParametersT() 2105 x._UnPack(sparsityParameters) 2106 return x 2107 2108 # SparsityParametersT 2109 def _UnPack(self, sparsityParameters): 2110 if sparsityParameters is None: 2111 return 2112 if not sparsityParameters.TraversalOrderIsNone(): 2113 if np is None: 2114 self.traversalOrder = [] 2115 for i in range(sparsityParameters.TraversalOrderLength()): 2116 self.traversalOrder.append(sparsityParameters.TraversalOrder(i)) 2117 else: 2118 self.traversalOrder = sparsityParameters.TraversalOrderAsNumpy() 2119 if not sparsityParameters.BlockMapIsNone(): 2120 if np is None: 2121 self.blockMap = [] 2122 for i in range(sparsityParameters.BlockMapLength()): 2123 self.blockMap.append(sparsityParameters.BlockMap(i)) 2124 else: 2125 self.blockMap = sparsityParameters.BlockMapAsNumpy() 2126 if not sparsityParameters.DimMetadataIsNone(): 2127 self.dimMetadata = [] 2128 for i in range(sparsityParameters.DimMetadataLength()): 2129 if sparsityParameters.DimMetadata(i) is None: 2130 self.dimMetadata.append(None) 2131 else: 2132 dimensionMetadata_ = DimensionMetadataT.InitFromObj(sparsityParameters.DimMetadata(i)) 2133 self.dimMetadata.append(dimensionMetadata_) 2134 2135 # SparsityParametersT 2136 def Pack(self, builder): 2137 if self.traversalOrder is not None: 2138 if np is not None and type(self.traversalOrder) is np.ndarray: 2139 traversalOrder = builder.CreateNumpyVector(self.traversalOrder) 2140 else: 2141 SparsityParametersStartTraversalOrderVector(builder, len(self.traversalOrder)) 2142 for i in reversed(range(len(self.traversalOrder))): 2143 builder.PrependInt32(self.traversalOrder[i]) 2144 traversalOrder = builder.EndVector(len(self.traversalOrder)) 2145 if self.blockMap is not None: 2146 if np is not None and type(self.blockMap) is np.ndarray: 2147 blockMap = builder.CreateNumpyVector(self.blockMap) 2148 else: 2149 SparsityParametersStartBlockMapVector(builder, len(self.blockMap)) 2150 for i in reversed(range(len(self.blockMap))): 2151 builder.PrependInt32(self.blockMap[i]) 2152 blockMap = builder.EndVector(len(self.blockMap)) 2153 if self.dimMetadata is not None: 2154 dimMetadatalist = [] 2155 for i in range(len(self.dimMetadata)): 2156 dimMetadatalist.append(self.dimMetadata[i].Pack(builder)) 2157 SparsityParametersStartDimMetadataVector(builder, len(self.dimMetadata)) 2158 for i in reversed(range(len(self.dimMetadata))): 2159 builder.PrependUOffsetTRelative(dimMetadatalist[i]) 2160 dimMetadata = builder.EndVector(len(self.dimMetadata)) 2161 SparsityParametersStart(builder) 2162 if self.traversalOrder is not None: 2163 SparsityParametersAddTraversalOrder(builder, traversalOrder) 2164 if self.blockMap is not None: 2165 SparsityParametersAddBlockMap(builder, blockMap) 2166 if self.dimMetadata is not None: 2167 SparsityParametersAddDimMetadata(builder, dimMetadata) 2168 sparsityParameters = SparsityParametersEnd(builder) 2169 return sparsityParameters 2170# automatically generated by the FlatBuffers compiler, do not modify 2171 2172# namespace: tflite 2173 2174from tflite_support.flatbuffers.compat import import_numpy 2175np = import_numpy() 2176 2177class SparseToDenseOptions(object): 2178 __slots__ = ['_tab'] 2179 2180 @classmethod 2181 def GetRootAsSparseToDenseOptions(cls, buf, offset): 2182 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 2183 x = SparseToDenseOptions() 2184 x.Init(buf, n + offset) 2185 return x 2186 2187 @classmethod 2188 def SparseToDenseOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 2189 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 2190 2191 # SparseToDenseOptions 2192 def Init(self, buf, pos): 2193 self._tab = flatbuffers.table.Table(buf, pos) 2194 2195 # SparseToDenseOptions 2196 def ValidateIndices(self): 2197 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 2198 if o != 0: 2199 return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) 2200 return False 2201 2202def SparseToDenseOptionsStart(builder): builder.StartObject(1) 2203def SparseToDenseOptionsAddValidateIndices(builder, validateIndices): builder.PrependBoolSlot(0, validateIndices, 0) 2204def SparseToDenseOptionsEnd(builder): return builder.EndObject() 2205 2206 2207class SparseToDenseOptionsT(object): 2208 2209 # SparseToDenseOptionsT 2210 def __init__(self): 2211 self.validateIndices = False # type: bool 2212 2213 @classmethod 2214 def InitFromBuf(cls, buf, pos): 2215 sparseToDenseOptions = SparseToDenseOptions() 2216 sparseToDenseOptions.Init(buf, pos) 2217 return cls.InitFromObj(sparseToDenseOptions) 2218 2219 @classmethod 2220 def InitFromObj(cls, sparseToDenseOptions): 2221 x = SparseToDenseOptionsT() 2222 x._UnPack(sparseToDenseOptions) 2223 return x 2224 2225 # SparseToDenseOptionsT 2226 def _UnPack(self, sparseToDenseOptions): 2227 if sparseToDenseOptions is None: 2228 return 2229 self.validateIndices = sparseToDenseOptions.ValidateIndices() 2230 2231 # SparseToDenseOptionsT 2232 def Pack(self, builder): 2233 SparseToDenseOptionsStart(builder) 2234 SparseToDenseOptionsAddValidateIndices(builder, self.validateIndices) 2235 sparseToDenseOptions = SparseToDenseOptionsEnd(builder) 2236 return sparseToDenseOptions 2237# automatically generated by the FlatBuffers compiler, do not modify 2238 2239# namespace: tflite 2240 2241class SparseIndexVector(object): 2242 NONE = 0 2243 Int32Vector = 1 2244 Uint16Vector = 2 2245 Uint8Vector = 3 2246 2247 2248def SparseIndexVectorCreator(unionType, table): 2249 from tflite_support.flatbuffers.table import Table 2250 if not isinstance(table, Table): 2251 return None 2252 if unionType == SparseIndexVector().Int32Vector: 2253 return Int32VectorT.InitFromBuf(table.Bytes, table.Pos) 2254 if unionType == SparseIndexVector().Uint16Vector: 2255 return Uint16VectorT.InitFromBuf(table.Bytes, table.Pos) 2256 if unionType == SparseIndexVector().Uint8Vector: 2257 return Uint8VectorT.InitFromBuf(table.Bytes, table.Pos) 2258 return None 2259# automatically generated by the FlatBuffers compiler, do not modify 2260 2261# namespace: tflite 2262 2263from tflite_support.flatbuffers.compat import import_numpy 2264np = import_numpy() 2265 2266class SpaceToDepthOptions(object): 2267 __slots__ = ['_tab'] 2268 2269 @classmethod 2270 def GetRootAsSpaceToDepthOptions(cls, buf, offset): 2271 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 2272 x = SpaceToDepthOptions() 2273 x.Init(buf, n + offset) 2274 return x 2275 2276 @classmethod 2277 def SpaceToDepthOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 2278 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 2279 2280 # SpaceToDepthOptions 2281 def Init(self, buf, pos): 2282 self._tab = flatbuffers.table.Table(buf, pos) 2283 2284 # SpaceToDepthOptions 2285 def BlockSize(self): 2286 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 2287 if o != 0: 2288 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 2289 return 0 2290 2291def SpaceToDepthOptionsStart(builder): builder.StartObject(1) 2292def SpaceToDepthOptionsAddBlockSize(builder, blockSize): builder.PrependInt32Slot(0, blockSize, 0) 2293def SpaceToDepthOptionsEnd(builder): return builder.EndObject() 2294 2295 2296class SpaceToDepthOptionsT(object): 2297 2298 # SpaceToDepthOptionsT 2299 def __init__(self): 2300 self.blockSize = 0 # type: int 2301 2302 @classmethod 2303 def InitFromBuf(cls, buf, pos): 2304 spaceToDepthOptions = SpaceToDepthOptions() 2305 spaceToDepthOptions.Init(buf, pos) 2306 return cls.InitFromObj(spaceToDepthOptions) 2307 2308 @classmethod 2309 def InitFromObj(cls, spaceToDepthOptions): 2310 x = SpaceToDepthOptionsT() 2311 x._UnPack(spaceToDepthOptions) 2312 return x 2313 2314 # SpaceToDepthOptionsT 2315 def _UnPack(self, spaceToDepthOptions): 2316 if spaceToDepthOptions is None: 2317 return 2318 self.blockSize = spaceToDepthOptions.BlockSize() 2319 2320 # SpaceToDepthOptionsT 2321 def Pack(self, builder): 2322 SpaceToDepthOptionsStart(builder) 2323 SpaceToDepthOptionsAddBlockSize(builder, self.blockSize) 2324 spaceToDepthOptions = SpaceToDepthOptionsEnd(builder) 2325 return spaceToDepthOptions 2326# automatically generated by the FlatBuffers compiler, do not modify 2327 2328# namespace: tflite 2329 2330from tflite_support.flatbuffers.compat import import_numpy 2331np = import_numpy() 2332 2333class SpaceToBatchNDOptions(object): 2334 __slots__ = ['_tab'] 2335 2336 @classmethod 2337 def GetRootAsSpaceToBatchNDOptions(cls, buf, offset): 2338 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 2339 x = SpaceToBatchNDOptions() 2340 x.Init(buf, n + offset) 2341 return x 2342 2343 @classmethod 2344 def SpaceToBatchNDOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 2345 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 2346 2347 # SpaceToBatchNDOptions 2348 def Init(self, buf, pos): 2349 self._tab = flatbuffers.table.Table(buf, pos) 2350 2351def SpaceToBatchNDOptionsStart(builder): builder.StartObject(0) 2352def SpaceToBatchNDOptionsEnd(builder): return builder.EndObject() 2353 2354 2355class SpaceToBatchNDOptionsT(object): 2356 2357 # SpaceToBatchNDOptionsT 2358 def __init__(self): 2359 pass 2360 2361 @classmethod 2362 def InitFromBuf(cls, buf, pos): 2363 spaceToBatchNDOptions = SpaceToBatchNDOptions() 2364 spaceToBatchNDOptions.Init(buf, pos) 2365 return cls.InitFromObj(spaceToBatchNDOptions) 2366 2367 @classmethod 2368 def InitFromObj(cls, spaceToBatchNDOptions): 2369 x = SpaceToBatchNDOptionsT() 2370 x._UnPack(spaceToBatchNDOptions) 2371 return x 2372 2373 # SpaceToBatchNDOptionsT 2374 def _UnPack(self, spaceToBatchNDOptions): 2375 if spaceToBatchNDOptions is None: 2376 return 2377 2378 # SpaceToBatchNDOptionsT 2379 def Pack(self, builder): 2380 SpaceToBatchNDOptionsStart(builder) 2381 spaceToBatchNDOptions = SpaceToBatchNDOptionsEnd(builder) 2382 return spaceToBatchNDOptions 2383# automatically generated by the FlatBuffers compiler, do not modify 2384 2385# namespace: tflite 2386 2387from tflite_support.flatbuffers.compat import import_numpy 2388np = import_numpy() 2389 2390class SoftmaxOptions(object): 2391 __slots__ = ['_tab'] 2392 2393 @classmethod 2394 def GetRootAsSoftmaxOptions(cls, buf, offset): 2395 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 2396 x = SoftmaxOptions() 2397 x.Init(buf, n + offset) 2398 return x 2399 2400 @classmethod 2401 def SoftmaxOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 2402 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 2403 2404 # SoftmaxOptions 2405 def Init(self, buf, pos): 2406 self._tab = flatbuffers.table.Table(buf, pos) 2407 2408 # SoftmaxOptions 2409 def Beta(self): 2410 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 2411 if o != 0: 2412 return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) 2413 return 0.0 2414 2415def SoftmaxOptionsStart(builder): builder.StartObject(1) 2416def SoftmaxOptionsAddBeta(builder, beta): builder.PrependFloat32Slot(0, beta, 0.0) 2417def SoftmaxOptionsEnd(builder): return builder.EndObject() 2418 2419 2420class SoftmaxOptionsT(object): 2421 2422 # SoftmaxOptionsT 2423 def __init__(self): 2424 self.beta = 0.0 # type: float 2425 2426 @classmethod 2427 def InitFromBuf(cls, buf, pos): 2428 softmaxOptions = SoftmaxOptions() 2429 softmaxOptions.Init(buf, pos) 2430 return cls.InitFromObj(softmaxOptions) 2431 2432 @classmethod 2433 def InitFromObj(cls, softmaxOptions): 2434 x = SoftmaxOptionsT() 2435 x._UnPack(softmaxOptions) 2436 return x 2437 2438 # SoftmaxOptionsT 2439 def _UnPack(self, softmaxOptions): 2440 if softmaxOptions is None: 2441 return 2442 self.beta = softmaxOptions.Beta() 2443 2444 # SoftmaxOptionsT 2445 def Pack(self, builder): 2446 SoftmaxOptionsStart(builder) 2447 SoftmaxOptionsAddBeta(builder, self.beta) 2448 softmaxOptions = SoftmaxOptionsEnd(builder) 2449 return softmaxOptions 2450# automatically generated by the FlatBuffers compiler, do not modify 2451 2452# namespace: tflite 2453 2454from tflite_support.flatbuffers.compat import import_numpy 2455np = import_numpy() 2456 2457class SliceOptions(object): 2458 __slots__ = ['_tab'] 2459 2460 @classmethod 2461 def GetRootAsSliceOptions(cls, buf, offset): 2462 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 2463 x = SliceOptions() 2464 x.Init(buf, n + offset) 2465 return x 2466 2467 @classmethod 2468 def SliceOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 2469 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 2470 2471 # SliceOptions 2472 def Init(self, buf, pos): 2473 self._tab = flatbuffers.table.Table(buf, pos) 2474 2475def SliceOptionsStart(builder): builder.StartObject(0) 2476def SliceOptionsEnd(builder): return builder.EndObject() 2477 2478 2479class SliceOptionsT(object): 2480 2481 # SliceOptionsT 2482 def __init__(self): 2483 pass 2484 2485 @classmethod 2486 def InitFromBuf(cls, buf, pos): 2487 sliceOptions = SliceOptions() 2488 sliceOptions.Init(buf, pos) 2489 return cls.InitFromObj(sliceOptions) 2490 2491 @classmethod 2492 def InitFromObj(cls, sliceOptions): 2493 x = SliceOptionsT() 2494 x._UnPack(sliceOptions) 2495 return x 2496 2497 # SliceOptionsT 2498 def _UnPack(self, sliceOptions): 2499 if sliceOptions is None: 2500 return 2501 2502 # SliceOptionsT 2503 def Pack(self, builder): 2504 SliceOptionsStart(builder) 2505 sliceOptions = SliceOptionsEnd(builder) 2506 return sliceOptions 2507# automatically generated by the FlatBuffers compiler, do not modify 2508 2509# namespace: tflite 2510 2511from tflite_support.flatbuffers.compat import import_numpy 2512np = import_numpy() 2513 2514class SkipGramOptions(object): 2515 __slots__ = ['_tab'] 2516 2517 @classmethod 2518 def GetRootAsSkipGramOptions(cls, buf, offset): 2519 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 2520 x = SkipGramOptions() 2521 x.Init(buf, n + offset) 2522 return x 2523 2524 @classmethod 2525 def SkipGramOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 2526 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 2527 2528 # SkipGramOptions 2529 def Init(self, buf, pos): 2530 self._tab = flatbuffers.table.Table(buf, pos) 2531 2532 # SkipGramOptions 2533 def NgramSize(self): 2534 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 2535 if o != 0: 2536 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 2537 return 0 2538 2539 # SkipGramOptions 2540 def MaxSkipSize(self): 2541 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 2542 if o != 0: 2543 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 2544 return 0 2545 2546 # SkipGramOptions 2547 def IncludeAllNgrams(self): 2548 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 2549 if o != 0: 2550 return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) 2551 return False 2552 2553def SkipGramOptionsStart(builder): builder.StartObject(3) 2554def SkipGramOptionsAddNgramSize(builder, ngramSize): builder.PrependInt32Slot(0, ngramSize, 0) 2555def SkipGramOptionsAddMaxSkipSize(builder, maxSkipSize): builder.PrependInt32Slot(1, maxSkipSize, 0) 2556def SkipGramOptionsAddIncludeAllNgrams(builder, includeAllNgrams): builder.PrependBoolSlot(2, includeAllNgrams, 0) 2557def SkipGramOptionsEnd(builder): return builder.EndObject() 2558 2559 2560class SkipGramOptionsT(object): 2561 2562 # SkipGramOptionsT 2563 def __init__(self): 2564 self.ngramSize = 0 # type: int 2565 self.maxSkipSize = 0 # type: int 2566 self.includeAllNgrams = False # type: bool 2567 2568 @classmethod 2569 def InitFromBuf(cls, buf, pos): 2570 skipGramOptions = SkipGramOptions() 2571 skipGramOptions.Init(buf, pos) 2572 return cls.InitFromObj(skipGramOptions) 2573 2574 @classmethod 2575 def InitFromObj(cls, skipGramOptions): 2576 x = SkipGramOptionsT() 2577 x._UnPack(skipGramOptions) 2578 return x 2579 2580 # SkipGramOptionsT 2581 def _UnPack(self, skipGramOptions): 2582 if skipGramOptions is None: 2583 return 2584 self.ngramSize = skipGramOptions.NgramSize() 2585 self.maxSkipSize = skipGramOptions.MaxSkipSize() 2586 self.includeAllNgrams = skipGramOptions.IncludeAllNgrams() 2587 2588 # SkipGramOptionsT 2589 def Pack(self, builder): 2590 SkipGramOptionsStart(builder) 2591 SkipGramOptionsAddNgramSize(builder, self.ngramSize) 2592 SkipGramOptionsAddMaxSkipSize(builder, self.maxSkipSize) 2593 SkipGramOptionsAddIncludeAllNgrams(builder, self.includeAllNgrams) 2594 skipGramOptions = SkipGramOptionsEnd(builder) 2595 return skipGramOptions 2596# automatically generated by the FlatBuffers compiler, do not modify 2597 2598# namespace: tflite 2599 2600from tflite_support.flatbuffers.compat import import_numpy 2601np = import_numpy() 2602 2603class ShapeOptions(object): 2604 __slots__ = ['_tab'] 2605 2606 @classmethod 2607 def GetRootAsShapeOptions(cls, buf, offset): 2608 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 2609 x = ShapeOptions() 2610 x.Init(buf, n + offset) 2611 return x 2612 2613 @classmethod 2614 def ShapeOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 2615 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 2616 2617 # ShapeOptions 2618 def Init(self, buf, pos): 2619 self._tab = flatbuffers.table.Table(buf, pos) 2620 2621 # ShapeOptions 2622 def OutType(self): 2623 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 2624 if o != 0: 2625 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 2626 return 0 2627 2628def ShapeOptionsStart(builder): builder.StartObject(1) 2629def ShapeOptionsAddOutType(builder, outType): builder.PrependInt8Slot(0, outType, 0) 2630def ShapeOptionsEnd(builder): return builder.EndObject() 2631 2632 2633class ShapeOptionsT(object): 2634 2635 # ShapeOptionsT 2636 def __init__(self): 2637 self.outType = 0 # type: int 2638 2639 @classmethod 2640 def InitFromBuf(cls, buf, pos): 2641 shapeOptions = ShapeOptions() 2642 shapeOptions.Init(buf, pos) 2643 return cls.InitFromObj(shapeOptions) 2644 2645 @classmethod 2646 def InitFromObj(cls, shapeOptions): 2647 x = ShapeOptionsT() 2648 x._UnPack(shapeOptions) 2649 return x 2650 2651 # ShapeOptionsT 2652 def _UnPack(self, shapeOptions): 2653 if shapeOptions is None: 2654 return 2655 self.outType = shapeOptions.OutType() 2656 2657 # ShapeOptionsT 2658 def Pack(self, builder): 2659 ShapeOptionsStart(builder) 2660 ShapeOptionsAddOutType(builder, self.outType) 2661 shapeOptions = ShapeOptionsEnd(builder) 2662 return shapeOptions 2663# automatically generated by the FlatBuffers compiler, do not modify 2664 2665# namespace: tflite 2666 2667from tflite_support.flatbuffers.compat import import_numpy 2668np = import_numpy() 2669 2670class SequenceRNNOptions(object): 2671 __slots__ = ['_tab'] 2672 2673 @classmethod 2674 def GetRootAsSequenceRNNOptions(cls, buf, offset): 2675 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 2676 x = SequenceRNNOptions() 2677 x.Init(buf, n + offset) 2678 return x 2679 2680 @classmethod 2681 def SequenceRNNOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 2682 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 2683 2684 # SequenceRNNOptions 2685 def Init(self, buf, pos): 2686 self._tab = flatbuffers.table.Table(buf, pos) 2687 2688 # SequenceRNNOptions 2689 def TimeMajor(self): 2690 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 2691 if o != 0: 2692 return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) 2693 return False 2694 2695 # SequenceRNNOptions 2696 def FusedActivationFunction(self): 2697 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 2698 if o != 0: 2699 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 2700 return 0 2701 2702def SequenceRNNOptionsStart(builder): builder.StartObject(2) 2703def SequenceRNNOptionsAddTimeMajor(builder, timeMajor): builder.PrependBoolSlot(0, timeMajor, 0) 2704def SequenceRNNOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(1, fusedActivationFunction, 0) 2705def SequenceRNNOptionsEnd(builder): return builder.EndObject() 2706 2707 2708class SequenceRNNOptionsT(object): 2709 2710 # SequenceRNNOptionsT 2711 def __init__(self): 2712 self.timeMajor = False # type: bool 2713 self.fusedActivationFunction = 0 # type: int 2714 2715 @classmethod 2716 def InitFromBuf(cls, buf, pos): 2717 sequenceRNNOptions = SequenceRNNOptions() 2718 sequenceRNNOptions.Init(buf, pos) 2719 return cls.InitFromObj(sequenceRNNOptions) 2720 2721 @classmethod 2722 def InitFromObj(cls, sequenceRNNOptions): 2723 x = SequenceRNNOptionsT() 2724 x._UnPack(sequenceRNNOptions) 2725 return x 2726 2727 # SequenceRNNOptionsT 2728 def _UnPack(self, sequenceRNNOptions): 2729 if sequenceRNNOptions is None: 2730 return 2731 self.timeMajor = sequenceRNNOptions.TimeMajor() 2732 self.fusedActivationFunction = sequenceRNNOptions.FusedActivationFunction() 2733 2734 # SequenceRNNOptionsT 2735 def Pack(self, builder): 2736 SequenceRNNOptionsStart(builder) 2737 SequenceRNNOptionsAddTimeMajor(builder, self.timeMajor) 2738 SequenceRNNOptionsAddFusedActivationFunction(builder, self.fusedActivationFunction) 2739 sequenceRNNOptions = SequenceRNNOptionsEnd(builder) 2740 return sequenceRNNOptions 2741# automatically generated by the FlatBuffers compiler, do not modify 2742 2743# namespace: tflite 2744 2745from tflite_support.flatbuffers.compat import import_numpy 2746np = import_numpy() 2747 2748class SelectV2Options(object): 2749 __slots__ = ['_tab'] 2750 2751 @classmethod 2752 def GetRootAsSelectV2Options(cls, buf, offset): 2753 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 2754 x = SelectV2Options() 2755 x.Init(buf, n + offset) 2756 return x 2757 2758 @classmethod 2759 def SelectV2OptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 2760 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 2761 2762 # SelectV2Options 2763 def Init(self, buf, pos): 2764 self._tab = flatbuffers.table.Table(buf, pos) 2765 2766def SelectV2OptionsStart(builder): builder.StartObject(0) 2767def SelectV2OptionsEnd(builder): return builder.EndObject() 2768 2769 2770class SelectV2OptionsT(object): 2771 2772 # SelectV2OptionsT 2773 def __init__(self): 2774 pass 2775 2776 @classmethod 2777 def InitFromBuf(cls, buf, pos): 2778 selectV2Options = SelectV2Options() 2779 selectV2Options.Init(buf, pos) 2780 return cls.InitFromObj(selectV2Options) 2781 2782 @classmethod 2783 def InitFromObj(cls, selectV2Options): 2784 x = SelectV2OptionsT() 2785 x._UnPack(selectV2Options) 2786 return x 2787 2788 # SelectV2OptionsT 2789 def _UnPack(self, selectV2Options): 2790 if selectV2Options is None: 2791 return 2792 2793 # SelectV2OptionsT 2794 def Pack(self, builder): 2795 SelectV2OptionsStart(builder) 2796 selectV2Options = SelectV2OptionsEnd(builder) 2797 return selectV2Options 2798# automatically generated by the FlatBuffers compiler, do not modify 2799 2800# namespace: tflite 2801 2802from tflite_support.flatbuffers.compat import import_numpy 2803np = import_numpy() 2804 2805class SelectOptions(object): 2806 __slots__ = ['_tab'] 2807 2808 @classmethod 2809 def GetRootAsSelectOptions(cls, buf, offset): 2810 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 2811 x = SelectOptions() 2812 x.Init(buf, n + offset) 2813 return x 2814 2815 @classmethod 2816 def SelectOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 2817 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 2818 2819 # SelectOptions 2820 def Init(self, buf, pos): 2821 self._tab = flatbuffers.table.Table(buf, pos) 2822 2823def SelectOptionsStart(builder): builder.StartObject(0) 2824def SelectOptionsEnd(builder): return builder.EndObject() 2825 2826 2827class SelectOptionsT(object): 2828 2829 # SelectOptionsT 2830 def __init__(self): 2831 pass 2832 2833 @classmethod 2834 def InitFromBuf(cls, buf, pos): 2835 selectOptions = SelectOptions() 2836 selectOptions.Init(buf, pos) 2837 return cls.InitFromObj(selectOptions) 2838 2839 @classmethod 2840 def InitFromObj(cls, selectOptions): 2841 x = SelectOptionsT() 2842 x._UnPack(selectOptions) 2843 return x 2844 2845 # SelectOptionsT 2846 def _UnPack(self, selectOptions): 2847 if selectOptions is None: 2848 return 2849 2850 # SelectOptionsT 2851 def Pack(self, builder): 2852 SelectOptionsStart(builder) 2853 selectOptions = SelectOptionsEnd(builder) 2854 return selectOptions 2855# automatically generated by the FlatBuffers compiler, do not modify 2856 2857# namespace: tflite 2858 2859from tflite_support.flatbuffers.compat import import_numpy 2860np = import_numpy() 2861 2862class SegmentSumOptions(object): 2863 __slots__ = ['_tab'] 2864 2865 @classmethod 2866 def GetRootAsSegmentSumOptions(cls, buf, offset): 2867 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 2868 x = SegmentSumOptions() 2869 x.Init(buf, n + offset) 2870 return x 2871 2872 @classmethod 2873 def SegmentSumOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 2874 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 2875 2876 # SegmentSumOptions 2877 def Init(self, buf, pos): 2878 self._tab = flatbuffers.table.Table(buf, pos) 2879 2880def SegmentSumOptionsStart(builder): builder.StartObject(0) 2881def SegmentSumOptionsEnd(builder): return builder.EndObject() 2882 2883 2884class SegmentSumOptionsT(object): 2885 2886 # SegmentSumOptionsT 2887 def __init__(self): 2888 pass 2889 2890 @classmethod 2891 def InitFromBuf(cls, buf, pos): 2892 segmentSumOptions = SegmentSumOptions() 2893 segmentSumOptions.Init(buf, pos) 2894 return cls.InitFromObj(segmentSumOptions) 2895 2896 @classmethod 2897 def InitFromObj(cls, segmentSumOptions): 2898 x = SegmentSumOptionsT() 2899 x._UnPack(segmentSumOptions) 2900 return x 2901 2902 # SegmentSumOptionsT 2903 def _UnPack(self, segmentSumOptions): 2904 if segmentSumOptions is None: 2905 return 2906 2907 # SegmentSumOptionsT 2908 def Pack(self, builder): 2909 SegmentSumOptionsStart(builder) 2910 segmentSumOptions = SegmentSumOptionsEnd(builder) 2911 return segmentSumOptions 2912# automatically generated by the FlatBuffers compiler, do not modify 2913 2914# namespace: tflite 2915 2916from tflite_support.flatbuffers.compat import import_numpy 2917np = import_numpy() 2918 2919class ScatterNdOptions(object): 2920 __slots__ = ['_tab'] 2921 2922 @classmethod 2923 def GetRootAsScatterNdOptions(cls, buf, offset): 2924 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 2925 x = ScatterNdOptions() 2926 x.Init(buf, n + offset) 2927 return x 2928 2929 @classmethod 2930 def ScatterNdOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 2931 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 2932 2933 # ScatterNdOptions 2934 def Init(self, buf, pos): 2935 self._tab = flatbuffers.table.Table(buf, pos) 2936 2937def ScatterNdOptionsStart(builder): builder.StartObject(0) 2938def ScatterNdOptionsEnd(builder): return builder.EndObject() 2939 2940 2941class ScatterNdOptionsT(object): 2942 2943 # ScatterNdOptionsT 2944 def __init__(self): 2945 pass 2946 2947 @classmethod 2948 def InitFromBuf(cls, buf, pos): 2949 scatterNdOptions = ScatterNdOptions() 2950 scatterNdOptions.Init(buf, pos) 2951 return cls.InitFromObj(scatterNdOptions) 2952 2953 @classmethod 2954 def InitFromObj(cls, scatterNdOptions): 2955 x = ScatterNdOptionsT() 2956 x._UnPack(scatterNdOptions) 2957 return x 2958 2959 # ScatterNdOptionsT 2960 def _UnPack(self, scatterNdOptions): 2961 if scatterNdOptions is None: 2962 return 2963 2964 # ScatterNdOptionsT 2965 def Pack(self, builder): 2966 ScatterNdOptionsStart(builder) 2967 scatterNdOptions = ScatterNdOptionsEnd(builder) 2968 return scatterNdOptions 2969# automatically generated by the FlatBuffers compiler, do not modify 2970 2971# namespace: tflite 2972 2973from tflite_support.flatbuffers.compat import import_numpy 2974np = import_numpy() 2975 2976class SVDFOptions(object): 2977 __slots__ = ['_tab'] 2978 2979 @classmethod 2980 def GetRootAsSVDFOptions(cls, buf, offset): 2981 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 2982 x = SVDFOptions() 2983 x.Init(buf, n + offset) 2984 return x 2985 2986 @classmethod 2987 def SVDFOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 2988 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 2989 2990 # SVDFOptions 2991 def Init(self, buf, pos): 2992 self._tab = flatbuffers.table.Table(buf, pos) 2993 2994 # SVDFOptions 2995 def Rank(self): 2996 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 2997 if o != 0: 2998 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 2999 return 0 3000 3001 # SVDFOptions 3002 def FusedActivationFunction(self): 3003 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 3004 if o != 0: 3005 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 3006 return 0 3007 3008def SVDFOptionsStart(builder): builder.StartObject(2) 3009def SVDFOptionsAddRank(builder, rank): builder.PrependInt32Slot(0, rank, 0) 3010def SVDFOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(1, fusedActivationFunction, 0) 3011def SVDFOptionsEnd(builder): return builder.EndObject() 3012 3013 3014class SVDFOptionsT(object): 3015 3016 # SVDFOptionsT 3017 def __init__(self): 3018 self.rank = 0 # type: int 3019 self.fusedActivationFunction = 0 # type: int 3020 3021 @classmethod 3022 def InitFromBuf(cls, buf, pos): 3023 sVDFOptions = SVDFOptions() 3024 sVDFOptions.Init(buf, pos) 3025 return cls.InitFromObj(sVDFOptions) 3026 3027 @classmethod 3028 def InitFromObj(cls, sVDFOptions): 3029 x = SVDFOptionsT() 3030 x._UnPack(sVDFOptions) 3031 return x 3032 3033 # SVDFOptionsT 3034 def _UnPack(self, sVDFOptions): 3035 if sVDFOptions is None: 3036 return 3037 self.rank = sVDFOptions.Rank() 3038 self.fusedActivationFunction = sVDFOptions.FusedActivationFunction() 3039 3040 # SVDFOptionsT 3041 def Pack(self, builder): 3042 SVDFOptionsStart(builder) 3043 SVDFOptionsAddRank(builder, self.rank) 3044 SVDFOptionsAddFusedActivationFunction(builder, self.fusedActivationFunction) 3045 sVDFOptions = SVDFOptionsEnd(builder) 3046 return sVDFOptions 3047# automatically generated by the FlatBuffers compiler, do not modify 3048 3049# namespace: tflite 3050 3051from tflite_support.flatbuffers.compat import import_numpy 3052np = import_numpy() 3053 3054class ReverseV2Options(object): 3055 __slots__ = ['_tab'] 3056 3057 @classmethod 3058 def GetRootAsReverseV2Options(cls, buf, offset): 3059 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 3060 x = ReverseV2Options() 3061 x.Init(buf, n + offset) 3062 return x 3063 3064 @classmethod 3065 def ReverseV2OptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 3066 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 3067 3068 # ReverseV2Options 3069 def Init(self, buf, pos): 3070 self._tab = flatbuffers.table.Table(buf, pos) 3071 3072def ReverseV2OptionsStart(builder): builder.StartObject(0) 3073def ReverseV2OptionsEnd(builder): return builder.EndObject() 3074 3075 3076class ReverseV2OptionsT(object): 3077 3078 # ReverseV2OptionsT 3079 def __init__(self): 3080 pass 3081 3082 @classmethod 3083 def InitFromBuf(cls, buf, pos): 3084 reverseV2Options = ReverseV2Options() 3085 reverseV2Options.Init(buf, pos) 3086 return cls.InitFromObj(reverseV2Options) 3087 3088 @classmethod 3089 def InitFromObj(cls, reverseV2Options): 3090 x = ReverseV2OptionsT() 3091 x._UnPack(reverseV2Options) 3092 return x 3093 3094 # ReverseV2OptionsT 3095 def _UnPack(self, reverseV2Options): 3096 if reverseV2Options is None: 3097 return 3098 3099 # ReverseV2OptionsT 3100 def Pack(self, builder): 3101 ReverseV2OptionsStart(builder) 3102 reverseV2Options = ReverseV2OptionsEnd(builder) 3103 return reverseV2Options 3104# automatically generated by the FlatBuffers compiler, do not modify 3105 3106# namespace: tflite 3107 3108from tflite_support.flatbuffers.compat import import_numpy 3109np = import_numpy() 3110 3111class ReverseSequenceOptions(object): 3112 __slots__ = ['_tab'] 3113 3114 @classmethod 3115 def GetRootAsReverseSequenceOptions(cls, buf, offset): 3116 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 3117 x = ReverseSequenceOptions() 3118 x.Init(buf, n + offset) 3119 return x 3120 3121 @classmethod 3122 def ReverseSequenceOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 3123 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 3124 3125 # ReverseSequenceOptions 3126 def Init(self, buf, pos): 3127 self._tab = flatbuffers.table.Table(buf, pos) 3128 3129 # ReverseSequenceOptions 3130 def SeqDim(self): 3131 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 3132 if o != 0: 3133 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 3134 return 0 3135 3136 # ReverseSequenceOptions 3137 def BatchDim(self): 3138 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 3139 if o != 0: 3140 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 3141 return 0 3142 3143def ReverseSequenceOptionsStart(builder): builder.StartObject(2) 3144def ReverseSequenceOptionsAddSeqDim(builder, seqDim): builder.PrependInt32Slot(0, seqDim, 0) 3145def ReverseSequenceOptionsAddBatchDim(builder, batchDim): builder.PrependInt32Slot(1, batchDim, 0) 3146def ReverseSequenceOptionsEnd(builder): return builder.EndObject() 3147 3148 3149class ReverseSequenceOptionsT(object): 3150 3151 # ReverseSequenceOptionsT 3152 def __init__(self): 3153 self.seqDim = 0 # type: int 3154 self.batchDim = 0 # type: int 3155 3156 @classmethod 3157 def InitFromBuf(cls, buf, pos): 3158 reverseSequenceOptions = ReverseSequenceOptions() 3159 reverseSequenceOptions.Init(buf, pos) 3160 return cls.InitFromObj(reverseSequenceOptions) 3161 3162 @classmethod 3163 def InitFromObj(cls, reverseSequenceOptions): 3164 x = ReverseSequenceOptionsT() 3165 x._UnPack(reverseSequenceOptions) 3166 return x 3167 3168 # ReverseSequenceOptionsT 3169 def _UnPack(self, reverseSequenceOptions): 3170 if reverseSequenceOptions is None: 3171 return 3172 self.seqDim = reverseSequenceOptions.SeqDim() 3173 self.batchDim = reverseSequenceOptions.BatchDim() 3174 3175 # ReverseSequenceOptionsT 3176 def Pack(self, builder): 3177 ReverseSequenceOptionsStart(builder) 3178 ReverseSequenceOptionsAddSeqDim(builder, self.seqDim) 3179 ReverseSequenceOptionsAddBatchDim(builder, self.batchDim) 3180 reverseSequenceOptions = ReverseSequenceOptionsEnd(builder) 3181 return reverseSequenceOptions 3182# automatically generated by the FlatBuffers compiler, do not modify 3183 3184# namespace: tflite 3185 3186from tflite_support.flatbuffers.compat import import_numpy 3187np = import_numpy() 3188 3189class ResizeNearestNeighborOptions(object): 3190 __slots__ = ['_tab'] 3191 3192 @classmethod 3193 def GetRootAsResizeNearestNeighborOptions(cls, buf, offset): 3194 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 3195 x = ResizeNearestNeighborOptions() 3196 x.Init(buf, n + offset) 3197 return x 3198 3199 @classmethod 3200 def ResizeNearestNeighborOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 3201 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 3202 3203 # ResizeNearestNeighborOptions 3204 def Init(self, buf, pos): 3205 self._tab = flatbuffers.table.Table(buf, pos) 3206 3207 # ResizeNearestNeighborOptions 3208 def AlignCorners(self): 3209 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 3210 if o != 0: 3211 return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) 3212 return False 3213 3214def ResizeNearestNeighborOptionsStart(builder): builder.StartObject(1) 3215def ResizeNearestNeighborOptionsAddAlignCorners(builder, alignCorners): builder.PrependBoolSlot(0, alignCorners, 0) 3216def ResizeNearestNeighborOptionsEnd(builder): return builder.EndObject() 3217 3218 3219class ResizeNearestNeighborOptionsT(object): 3220 3221 # ResizeNearestNeighborOptionsT 3222 def __init__(self): 3223 self.alignCorners = False # type: bool 3224 3225 @classmethod 3226 def InitFromBuf(cls, buf, pos): 3227 resizeNearestNeighborOptions = ResizeNearestNeighborOptions() 3228 resizeNearestNeighborOptions.Init(buf, pos) 3229 return cls.InitFromObj(resizeNearestNeighborOptions) 3230 3231 @classmethod 3232 def InitFromObj(cls, resizeNearestNeighborOptions): 3233 x = ResizeNearestNeighborOptionsT() 3234 x._UnPack(resizeNearestNeighborOptions) 3235 return x 3236 3237 # ResizeNearestNeighborOptionsT 3238 def _UnPack(self, resizeNearestNeighborOptions): 3239 if resizeNearestNeighborOptions is None: 3240 return 3241 self.alignCorners = resizeNearestNeighborOptions.AlignCorners() 3242 3243 # ResizeNearestNeighborOptionsT 3244 def Pack(self, builder): 3245 ResizeNearestNeighborOptionsStart(builder) 3246 ResizeNearestNeighborOptionsAddAlignCorners(builder, self.alignCorners) 3247 resizeNearestNeighborOptions = ResizeNearestNeighborOptionsEnd(builder) 3248 return resizeNearestNeighborOptions 3249# automatically generated by the FlatBuffers compiler, do not modify 3250 3251# namespace: tflite 3252 3253from tflite_support.flatbuffers.compat import import_numpy 3254np = import_numpy() 3255 3256class ResizeBilinearOptions(object): 3257 __slots__ = ['_tab'] 3258 3259 @classmethod 3260 def GetRootAsResizeBilinearOptions(cls, buf, offset): 3261 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 3262 x = ResizeBilinearOptions() 3263 x.Init(buf, n + offset) 3264 return x 3265 3266 @classmethod 3267 def ResizeBilinearOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 3268 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 3269 3270 # ResizeBilinearOptions 3271 def Init(self, buf, pos): 3272 self._tab = flatbuffers.table.Table(buf, pos) 3273 3274 # ResizeBilinearOptions 3275 def AlignCorners(self): 3276 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 3277 if o != 0: 3278 return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) 3279 return False 3280 3281 # ResizeBilinearOptions 3282 def HalfPixelCenters(self): 3283 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 3284 if o != 0: 3285 return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) 3286 return False 3287 3288def ResizeBilinearOptionsStart(builder): builder.StartObject(4) 3289def ResizeBilinearOptionsAddAlignCorners(builder, alignCorners): builder.PrependBoolSlot(2, alignCorners, 0) 3290def ResizeBilinearOptionsAddHalfPixelCenters(builder, halfPixelCenters): builder.PrependBoolSlot(3, halfPixelCenters, 0) 3291def ResizeBilinearOptionsEnd(builder): return builder.EndObject() 3292 3293 3294class ResizeBilinearOptionsT(object): 3295 3296 # ResizeBilinearOptionsT 3297 def __init__(self): 3298 self.alignCorners = False # type: bool 3299 self.halfPixelCenters = False # type: bool 3300 3301 @classmethod 3302 def InitFromBuf(cls, buf, pos): 3303 resizeBilinearOptions = ResizeBilinearOptions() 3304 resizeBilinearOptions.Init(buf, pos) 3305 return cls.InitFromObj(resizeBilinearOptions) 3306 3307 @classmethod 3308 def InitFromObj(cls, resizeBilinearOptions): 3309 x = ResizeBilinearOptionsT() 3310 x._UnPack(resizeBilinearOptions) 3311 return x 3312 3313 # ResizeBilinearOptionsT 3314 def _UnPack(self, resizeBilinearOptions): 3315 if resizeBilinearOptions is None: 3316 return 3317 self.alignCorners = resizeBilinearOptions.AlignCorners() 3318 self.halfPixelCenters = resizeBilinearOptions.HalfPixelCenters() 3319 3320 # ResizeBilinearOptionsT 3321 def Pack(self, builder): 3322 ResizeBilinearOptionsStart(builder) 3323 ResizeBilinearOptionsAddAlignCorners(builder, self.alignCorners) 3324 ResizeBilinearOptionsAddHalfPixelCenters(builder, self.halfPixelCenters) 3325 resizeBilinearOptions = ResizeBilinearOptionsEnd(builder) 3326 return resizeBilinearOptions 3327# automatically generated by the FlatBuffers compiler, do not modify 3328 3329# namespace: tflite 3330 3331from tflite_support.flatbuffers.compat import import_numpy 3332np = import_numpy() 3333 3334class ReshapeOptions(object): 3335 __slots__ = ['_tab'] 3336 3337 @classmethod 3338 def GetRootAsReshapeOptions(cls, buf, offset): 3339 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 3340 x = ReshapeOptions() 3341 x.Init(buf, n + offset) 3342 return x 3343 3344 @classmethod 3345 def ReshapeOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 3346 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 3347 3348 # ReshapeOptions 3349 def Init(self, buf, pos): 3350 self._tab = flatbuffers.table.Table(buf, pos) 3351 3352 # ReshapeOptions 3353 def NewShape(self, j): 3354 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 3355 if o != 0: 3356 a = self._tab.Vector(o) 3357 return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 3358 return 0 3359 3360 # ReshapeOptions 3361 def NewShapeAsNumpy(self): 3362 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 3363 if o != 0: 3364 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) 3365 return 0 3366 3367 # ReshapeOptions 3368 def NewShapeLength(self): 3369 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 3370 if o != 0: 3371 return self._tab.VectorLen(o) 3372 return 0 3373 3374 # ReshapeOptions 3375 def NewShapeIsNone(self): 3376 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 3377 return o == 0 3378 3379def ReshapeOptionsStart(builder): builder.StartObject(1) 3380def ReshapeOptionsAddNewShape(builder, newShape): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(newShape), 0) 3381def ReshapeOptionsStartNewShapeVector(builder, numElems): return builder.StartVector(4, numElems, 4) 3382def ReshapeOptionsEnd(builder): return builder.EndObject() 3383 3384try: 3385 from typing import List 3386except: 3387 pass 3388 3389class ReshapeOptionsT(object): 3390 3391 # ReshapeOptionsT 3392 def __init__(self): 3393 self.newShape = None # type: List[int] 3394 3395 @classmethod 3396 def InitFromBuf(cls, buf, pos): 3397 reshapeOptions = ReshapeOptions() 3398 reshapeOptions.Init(buf, pos) 3399 return cls.InitFromObj(reshapeOptions) 3400 3401 @classmethod 3402 def InitFromObj(cls, reshapeOptions): 3403 x = ReshapeOptionsT() 3404 x._UnPack(reshapeOptions) 3405 return x 3406 3407 # ReshapeOptionsT 3408 def _UnPack(self, reshapeOptions): 3409 if reshapeOptions is None: 3410 return 3411 if not reshapeOptions.NewShapeIsNone(): 3412 if np is None: 3413 self.newShape = [] 3414 for i in range(reshapeOptions.NewShapeLength()): 3415 self.newShape.append(reshapeOptions.NewShape(i)) 3416 else: 3417 self.newShape = reshapeOptions.NewShapeAsNumpy() 3418 3419 # ReshapeOptionsT 3420 def Pack(self, builder): 3421 if self.newShape is not None: 3422 if np is not None and type(self.newShape) is np.ndarray: 3423 newShape = builder.CreateNumpyVector(self.newShape) 3424 else: 3425 ReshapeOptionsStartNewShapeVector(builder, len(self.newShape)) 3426 for i in reversed(range(len(self.newShape))): 3427 builder.PrependInt32(self.newShape[i]) 3428 newShape = builder.EndVector(len(self.newShape)) 3429 ReshapeOptionsStart(builder) 3430 if self.newShape is not None: 3431 ReshapeOptionsAddNewShape(builder, newShape) 3432 reshapeOptions = ReshapeOptionsEnd(builder) 3433 return reshapeOptions 3434# automatically generated by the FlatBuffers compiler, do not modify 3435 3436# namespace: tflite 3437 3438from tflite_support.flatbuffers.compat import import_numpy 3439np = import_numpy() 3440 3441class ReducerOptions(object): 3442 __slots__ = ['_tab'] 3443 3444 @classmethod 3445 def GetRootAsReducerOptions(cls, buf, offset): 3446 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 3447 x = ReducerOptions() 3448 x.Init(buf, n + offset) 3449 return x 3450 3451 @classmethod 3452 def ReducerOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 3453 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 3454 3455 # ReducerOptions 3456 def Init(self, buf, pos): 3457 self._tab = flatbuffers.table.Table(buf, pos) 3458 3459 # ReducerOptions 3460 def KeepDims(self): 3461 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 3462 if o != 0: 3463 return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) 3464 return False 3465 3466def ReducerOptionsStart(builder): builder.StartObject(1) 3467def ReducerOptionsAddKeepDims(builder, keepDims): builder.PrependBoolSlot(0, keepDims, 0) 3468def ReducerOptionsEnd(builder): return builder.EndObject() 3469 3470 3471class ReducerOptionsT(object): 3472 3473 # ReducerOptionsT 3474 def __init__(self): 3475 self.keepDims = False # type: bool 3476 3477 @classmethod 3478 def InitFromBuf(cls, buf, pos): 3479 reducerOptions = ReducerOptions() 3480 reducerOptions.Init(buf, pos) 3481 return cls.InitFromObj(reducerOptions) 3482 3483 @classmethod 3484 def InitFromObj(cls, reducerOptions): 3485 x = ReducerOptionsT() 3486 x._UnPack(reducerOptions) 3487 return x 3488 3489 # ReducerOptionsT 3490 def _UnPack(self, reducerOptions): 3491 if reducerOptions is None: 3492 return 3493 self.keepDims = reducerOptions.KeepDims() 3494 3495 # ReducerOptionsT 3496 def Pack(self, builder): 3497 ReducerOptionsStart(builder) 3498 ReducerOptionsAddKeepDims(builder, self.keepDims) 3499 reducerOptions = ReducerOptionsEnd(builder) 3500 return reducerOptions 3501# automatically generated by the FlatBuffers compiler, do not modify 3502 3503# namespace: tflite 3504 3505from tflite_support.flatbuffers.compat import import_numpy 3506np = import_numpy() 3507 3508class RankOptions(object): 3509 __slots__ = ['_tab'] 3510 3511 @classmethod 3512 def GetRootAsRankOptions(cls, buf, offset): 3513 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 3514 x = RankOptions() 3515 x.Init(buf, n + offset) 3516 return x 3517 3518 @classmethod 3519 def RankOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 3520 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 3521 3522 # RankOptions 3523 def Init(self, buf, pos): 3524 self._tab = flatbuffers.table.Table(buf, pos) 3525 3526def RankOptionsStart(builder): builder.StartObject(0) 3527def RankOptionsEnd(builder): return builder.EndObject() 3528 3529 3530class RankOptionsT(object): 3531 3532 # RankOptionsT 3533 def __init__(self): 3534 pass 3535 3536 @classmethod 3537 def InitFromBuf(cls, buf, pos): 3538 rankOptions = RankOptions() 3539 rankOptions.Init(buf, pos) 3540 return cls.InitFromObj(rankOptions) 3541 3542 @classmethod 3543 def InitFromObj(cls, rankOptions): 3544 x = RankOptionsT() 3545 x._UnPack(rankOptions) 3546 return x 3547 3548 # RankOptionsT 3549 def _UnPack(self, rankOptions): 3550 if rankOptions is None: 3551 return 3552 3553 # RankOptionsT 3554 def Pack(self, builder): 3555 RankOptionsStart(builder) 3556 rankOptions = RankOptionsEnd(builder) 3557 return rankOptions 3558# automatically generated by the FlatBuffers compiler, do not modify 3559 3560# namespace: tflite 3561 3562from tflite_support.flatbuffers.compat import import_numpy 3563np = import_numpy() 3564 3565class RangeOptions(object): 3566 __slots__ = ['_tab'] 3567 3568 @classmethod 3569 def GetRootAsRangeOptions(cls, buf, offset): 3570 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 3571 x = RangeOptions() 3572 x.Init(buf, n + offset) 3573 return x 3574 3575 @classmethod 3576 def RangeOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 3577 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 3578 3579 # RangeOptions 3580 def Init(self, buf, pos): 3581 self._tab = flatbuffers.table.Table(buf, pos) 3582 3583def RangeOptionsStart(builder): builder.StartObject(0) 3584def RangeOptionsEnd(builder): return builder.EndObject() 3585 3586 3587class RangeOptionsT(object): 3588 3589 # RangeOptionsT 3590 def __init__(self): 3591 pass 3592 3593 @classmethod 3594 def InitFromBuf(cls, buf, pos): 3595 rangeOptions = RangeOptions() 3596 rangeOptions.Init(buf, pos) 3597 return cls.InitFromObj(rangeOptions) 3598 3599 @classmethod 3600 def InitFromObj(cls, rangeOptions): 3601 x = RangeOptionsT() 3602 x._UnPack(rangeOptions) 3603 return x 3604 3605 # RangeOptionsT 3606 def _UnPack(self, rangeOptions): 3607 if rangeOptions is None: 3608 return 3609 3610 # RangeOptionsT 3611 def Pack(self, builder): 3612 RangeOptionsStart(builder) 3613 rangeOptions = RangeOptionsEnd(builder) 3614 return rangeOptions 3615# automatically generated by the FlatBuffers compiler, do not modify 3616 3617# namespace: tflite 3618 3619from tflite_support.flatbuffers.compat import import_numpy 3620np = import_numpy() 3621 3622class RNNOptions(object): 3623 __slots__ = ['_tab'] 3624 3625 @classmethod 3626 def GetRootAsRNNOptions(cls, buf, offset): 3627 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 3628 x = RNNOptions() 3629 x.Init(buf, n + offset) 3630 return x 3631 3632 @classmethod 3633 def RNNOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 3634 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 3635 3636 # RNNOptions 3637 def Init(self, buf, pos): 3638 self._tab = flatbuffers.table.Table(buf, pos) 3639 3640 # RNNOptions 3641 def FusedActivationFunction(self): 3642 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 3643 if o != 0: 3644 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 3645 return 0 3646 3647def RNNOptionsStart(builder): builder.StartObject(1) 3648def RNNOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0) 3649def RNNOptionsEnd(builder): return builder.EndObject() 3650 3651 3652class RNNOptionsT(object): 3653 3654 # RNNOptionsT 3655 def __init__(self): 3656 self.fusedActivationFunction = 0 # type: int 3657 3658 @classmethod 3659 def InitFromBuf(cls, buf, pos): 3660 rNNOptions = RNNOptions() 3661 rNNOptions.Init(buf, pos) 3662 return cls.InitFromObj(rNNOptions) 3663 3664 @classmethod 3665 def InitFromObj(cls, rNNOptions): 3666 x = RNNOptionsT() 3667 x._UnPack(rNNOptions) 3668 return x 3669 3670 # RNNOptionsT 3671 def _UnPack(self, rNNOptions): 3672 if rNNOptions is None: 3673 return 3674 self.fusedActivationFunction = rNNOptions.FusedActivationFunction() 3675 3676 # RNNOptionsT 3677 def Pack(self, builder): 3678 RNNOptionsStart(builder) 3679 RNNOptionsAddFusedActivationFunction(builder, self.fusedActivationFunction) 3680 rNNOptions = RNNOptionsEnd(builder) 3681 return rNNOptions 3682# automatically generated by the FlatBuffers compiler, do not modify 3683 3684# namespace: tflite 3685 3686from tflite_support.flatbuffers.compat import import_numpy 3687np = import_numpy() 3688 3689class QuantizeOptions(object): 3690 __slots__ = ['_tab'] 3691 3692 @classmethod 3693 def GetRootAsQuantizeOptions(cls, buf, offset): 3694 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 3695 x = QuantizeOptions() 3696 x.Init(buf, n + offset) 3697 return x 3698 3699 @classmethod 3700 def QuantizeOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 3701 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 3702 3703 # QuantizeOptions 3704 def Init(self, buf, pos): 3705 self._tab = flatbuffers.table.Table(buf, pos) 3706 3707def QuantizeOptionsStart(builder): builder.StartObject(0) 3708def QuantizeOptionsEnd(builder): return builder.EndObject() 3709 3710 3711class QuantizeOptionsT(object): 3712 3713 # QuantizeOptionsT 3714 def __init__(self): 3715 pass 3716 3717 @classmethod 3718 def InitFromBuf(cls, buf, pos): 3719 quantizeOptions = QuantizeOptions() 3720 quantizeOptions.Init(buf, pos) 3721 return cls.InitFromObj(quantizeOptions) 3722 3723 @classmethod 3724 def InitFromObj(cls, quantizeOptions): 3725 x = QuantizeOptionsT() 3726 x._UnPack(quantizeOptions) 3727 return x 3728 3729 # QuantizeOptionsT 3730 def _UnPack(self, quantizeOptions): 3731 if quantizeOptions is None: 3732 return 3733 3734 # QuantizeOptionsT 3735 def Pack(self, builder): 3736 QuantizeOptionsStart(builder) 3737 quantizeOptions = QuantizeOptionsEnd(builder) 3738 return quantizeOptions 3739# automatically generated by the FlatBuffers compiler, do not modify 3740 3741# namespace: tflite 3742 3743from tflite_support.flatbuffers.compat import import_numpy 3744np = import_numpy() 3745 3746class QuantizationParameters(object): 3747 __slots__ = ['_tab'] 3748 3749 @classmethod 3750 def GetRootAsQuantizationParameters(cls, buf, offset): 3751 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 3752 x = QuantizationParameters() 3753 x.Init(buf, n + offset) 3754 return x 3755 3756 @classmethod 3757 def QuantizationParametersBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 3758 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 3759 3760 # QuantizationParameters 3761 def Init(self, buf, pos): 3762 self._tab = flatbuffers.table.Table(buf, pos) 3763 3764 # QuantizationParameters 3765 def Min(self, j): 3766 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 3767 if o != 0: 3768 a = self._tab.Vector(o) 3769 return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 3770 return 0 3771 3772 # QuantizationParameters 3773 def MinAsNumpy(self): 3774 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 3775 if o != 0: 3776 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o) 3777 return 0 3778 3779 # QuantizationParameters 3780 def MinLength(self): 3781 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 3782 if o != 0: 3783 return self._tab.VectorLen(o) 3784 return 0 3785 3786 # QuantizationParameters 3787 def MinIsNone(self): 3788 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 3789 return o == 0 3790 3791 # QuantizationParameters 3792 def Max(self, j): 3793 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 3794 if o != 0: 3795 a = self._tab.Vector(o) 3796 return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 3797 return 0 3798 3799 # QuantizationParameters 3800 def MaxAsNumpy(self): 3801 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 3802 if o != 0: 3803 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o) 3804 return 0 3805 3806 # QuantizationParameters 3807 def MaxLength(self): 3808 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 3809 if o != 0: 3810 return self._tab.VectorLen(o) 3811 return 0 3812 3813 # QuantizationParameters 3814 def MaxIsNone(self): 3815 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 3816 return o == 0 3817 3818 # QuantizationParameters 3819 def Scale(self, j): 3820 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 3821 if o != 0: 3822 a = self._tab.Vector(o) 3823 return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 3824 return 0 3825 3826 # QuantizationParameters 3827 def ScaleAsNumpy(self): 3828 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 3829 if o != 0: 3830 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o) 3831 return 0 3832 3833 # QuantizationParameters 3834 def ScaleLength(self): 3835 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 3836 if o != 0: 3837 return self._tab.VectorLen(o) 3838 return 0 3839 3840 # QuantizationParameters 3841 def ScaleIsNone(self): 3842 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 3843 return o == 0 3844 3845 # QuantizationParameters 3846 def ZeroPoint(self, j): 3847 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 3848 if o != 0: 3849 a = self._tab.Vector(o) 3850 return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) 3851 return 0 3852 3853 # QuantizationParameters 3854 def ZeroPointAsNumpy(self): 3855 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 3856 if o != 0: 3857 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) 3858 return 0 3859 3860 # QuantizationParameters 3861 def ZeroPointLength(self): 3862 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 3863 if o != 0: 3864 return self._tab.VectorLen(o) 3865 return 0 3866 3867 # QuantizationParameters 3868 def ZeroPointIsNone(self): 3869 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 3870 return o == 0 3871 3872 # QuantizationParameters 3873 def DetailsType(self): 3874 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) 3875 if o != 0: 3876 return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) 3877 return 0 3878 3879 # QuantizationParameters 3880 def Details(self): 3881 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) 3882 if o != 0: 3883 from tflite_support.flatbuffers.table import Table 3884 obj = Table(bytearray(), 0) 3885 self._tab.Union(obj, o) 3886 return obj 3887 return None 3888 3889 # QuantizationParameters 3890 def QuantizedDimension(self): 3891 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) 3892 if o != 0: 3893 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 3894 return 0 3895 3896def QuantizationParametersStart(builder): builder.StartObject(7) 3897def QuantizationParametersAddMin(builder, min): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(min), 0) 3898def QuantizationParametersStartMinVector(builder, numElems): return builder.StartVector(4, numElems, 4) 3899def QuantizationParametersAddMax(builder, max): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(max), 0) 3900def QuantizationParametersStartMaxVector(builder, numElems): return builder.StartVector(4, numElems, 4) 3901def QuantizationParametersAddScale(builder, scale): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(scale), 0) 3902def QuantizationParametersStartScaleVector(builder, numElems): return builder.StartVector(4, numElems, 4) 3903def QuantizationParametersAddZeroPoint(builder, zeroPoint): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(zeroPoint), 0) 3904def QuantizationParametersStartZeroPointVector(builder, numElems): return builder.StartVector(8, numElems, 8) 3905def QuantizationParametersAddDetailsType(builder, detailsType): builder.PrependUint8Slot(4, detailsType, 0) 3906def QuantizationParametersAddDetails(builder, details): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(details), 0) 3907def QuantizationParametersAddQuantizedDimension(builder, quantizedDimension): builder.PrependInt32Slot(6, quantizedDimension, 0) 3908def QuantizationParametersEnd(builder): return builder.EndObject() 3909 3910try: 3911 from typing import List, Union 3912except: 3913 pass 3914 3915class QuantizationParametersT(object): 3916 3917 # QuantizationParametersT 3918 def __init__(self): 3919 self.min = None # type: List[float] 3920 self.max = None # type: List[float] 3921 self.scale = None # type: List[float] 3922 self.zeroPoint = None # type: List[int] 3923 self.detailsType = 0 # type: int 3924 self.details = None # type: Union[None, CustomQuantizationT] 3925 self.quantizedDimension = 0 # type: int 3926 3927 @classmethod 3928 def InitFromBuf(cls, buf, pos): 3929 quantizationParameters = QuantizationParameters() 3930 quantizationParameters.Init(buf, pos) 3931 return cls.InitFromObj(quantizationParameters) 3932 3933 @classmethod 3934 def InitFromObj(cls, quantizationParameters): 3935 x = QuantizationParametersT() 3936 x._UnPack(quantizationParameters) 3937 return x 3938 3939 # QuantizationParametersT 3940 def _UnPack(self, quantizationParameters): 3941 if quantizationParameters is None: 3942 return 3943 if not quantizationParameters.MinIsNone(): 3944 if np is None: 3945 self.min = [] 3946 for i in range(quantizationParameters.MinLength()): 3947 self.min.append(quantizationParameters.Min(i)) 3948 else: 3949 self.min = quantizationParameters.MinAsNumpy() 3950 if not quantizationParameters.MaxIsNone(): 3951 if np is None: 3952 self.max = [] 3953 for i in range(quantizationParameters.MaxLength()): 3954 self.max.append(quantizationParameters.Max(i)) 3955 else: 3956 self.max = quantizationParameters.MaxAsNumpy() 3957 if not quantizationParameters.ScaleIsNone(): 3958 if np is None: 3959 self.scale = [] 3960 for i in range(quantizationParameters.ScaleLength()): 3961 self.scale.append(quantizationParameters.Scale(i)) 3962 else: 3963 self.scale = quantizationParameters.ScaleAsNumpy() 3964 if not quantizationParameters.ZeroPointIsNone(): 3965 if np is None: 3966 self.zeroPoint = [] 3967 for i in range(quantizationParameters.ZeroPointLength()): 3968 self.zeroPoint.append(quantizationParameters.ZeroPoint(i)) 3969 else: 3970 self.zeroPoint = quantizationParameters.ZeroPointAsNumpy() 3971 self.detailsType = quantizationParameters.DetailsType() 3972 self.details = QuantizationDetailsCreator(self.detailsType, quantizationParameters.Details()) 3973 self.quantizedDimension = quantizationParameters.QuantizedDimension() 3974 3975 # QuantizationParametersT 3976 def Pack(self, builder): 3977 if self.min is not None: 3978 if np is not None and type(self.min) is np.ndarray: 3979 min = builder.CreateNumpyVector(self.min) 3980 else: 3981 QuantizationParametersStartMinVector(builder, len(self.min)) 3982 for i in reversed(range(len(self.min))): 3983 builder.PrependFloat32(self.min[i]) 3984 min = builder.EndVector(len(self.min)) 3985 if self.max is not None: 3986 if np is not None and type(self.max) is np.ndarray: 3987 max = builder.CreateNumpyVector(self.max) 3988 else: 3989 QuantizationParametersStartMaxVector(builder, len(self.max)) 3990 for i in reversed(range(len(self.max))): 3991 builder.PrependFloat32(self.max[i]) 3992 max = builder.EndVector(len(self.max)) 3993 if self.scale is not None: 3994 if np is not None and type(self.scale) is np.ndarray: 3995 scale = builder.CreateNumpyVector(self.scale) 3996 else: 3997 QuantizationParametersStartScaleVector(builder, len(self.scale)) 3998 for i in reversed(range(len(self.scale))): 3999 builder.PrependFloat32(self.scale[i]) 4000 scale = builder.EndVector(len(self.scale)) 4001 if self.zeroPoint is not None: 4002 if np is not None and type(self.zeroPoint) is np.ndarray: 4003 zeroPoint = builder.CreateNumpyVector(self.zeroPoint) 4004 else: 4005 QuantizationParametersStartZeroPointVector(builder, len(self.zeroPoint)) 4006 for i in reversed(range(len(self.zeroPoint))): 4007 builder.PrependInt64(self.zeroPoint[i]) 4008 zeroPoint = builder.EndVector(len(self.zeroPoint)) 4009 if self.details is not None: 4010 details = self.details.Pack(builder) 4011 QuantizationParametersStart(builder) 4012 if self.min is not None: 4013 QuantizationParametersAddMin(builder, min) 4014 if self.max is not None: 4015 QuantizationParametersAddMax(builder, max) 4016 if self.scale is not None: 4017 QuantizationParametersAddScale(builder, scale) 4018 if self.zeroPoint is not None: 4019 QuantizationParametersAddZeroPoint(builder, zeroPoint) 4020 QuantizationParametersAddDetailsType(builder, self.detailsType) 4021 if self.details is not None: 4022 QuantizationParametersAddDetails(builder, details) 4023 QuantizationParametersAddQuantizedDimension(builder, self.quantizedDimension) 4024 quantizationParameters = QuantizationParametersEnd(builder) 4025 return quantizationParameters 4026# automatically generated by the FlatBuffers compiler, do not modify 4027 4028# namespace: tflite 4029 4030class QuantizationDetails(object): 4031 NONE = 0 4032 CustomQuantization = 1 4033 4034 4035def QuantizationDetailsCreator(unionType, table): 4036 from tflite_support.flatbuffers.table import Table 4037 if not isinstance(table, Table): 4038 return None 4039 if unionType == QuantizationDetails().CustomQuantization: 4040 return CustomQuantizationT.InitFromBuf(table.Bytes, table.Pos) 4041 return None 4042# automatically generated by the FlatBuffers compiler, do not modify 4043 4044# namespace: tflite 4045 4046from tflite_support.flatbuffers.compat import import_numpy 4047np = import_numpy() 4048 4049class PowOptions(object): 4050 __slots__ = ['_tab'] 4051 4052 @classmethod 4053 def GetRootAsPowOptions(cls, buf, offset): 4054 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 4055 x = PowOptions() 4056 x.Init(buf, n + offset) 4057 return x 4058 4059 @classmethod 4060 def PowOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 4061 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 4062 4063 # PowOptions 4064 def Init(self, buf, pos): 4065 self._tab = flatbuffers.table.Table(buf, pos) 4066 4067def PowOptionsStart(builder): builder.StartObject(0) 4068def PowOptionsEnd(builder): return builder.EndObject() 4069 4070 4071class PowOptionsT(object): 4072 4073 # PowOptionsT 4074 def __init__(self): 4075 pass 4076 4077 @classmethod 4078 def InitFromBuf(cls, buf, pos): 4079 powOptions = PowOptions() 4080 powOptions.Init(buf, pos) 4081 return cls.InitFromObj(powOptions) 4082 4083 @classmethod 4084 def InitFromObj(cls, powOptions): 4085 x = PowOptionsT() 4086 x._UnPack(powOptions) 4087 return x 4088 4089 # PowOptionsT 4090 def _UnPack(self, powOptions): 4091 if powOptions is None: 4092 return 4093 4094 # PowOptionsT 4095 def Pack(self, builder): 4096 PowOptionsStart(builder) 4097 powOptions = PowOptionsEnd(builder) 4098 return powOptions 4099# automatically generated by the FlatBuffers compiler, do not modify 4100 4101# namespace: tflite 4102 4103from tflite_support.flatbuffers.compat import import_numpy 4104np = import_numpy() 4105 4106class Pool2DOptions(object): 4107 __slots__ = ['_tab'] 4108 4109 @classmethod 4110 def GetRootAsPool2DOptions(cls, buf, offset): 4111 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 4112 x = Pool2DOptions() 4113 x.Init(buf, n + offset) 4114 return x 4115 4116 @classmethod 4117 def Pool2DOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 4118 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 4119 4120 # Pool2DOptions 4121 def Init(self, buf, pos): 4122 self._tab = flatbuffers.table.Table(buf, pos) 4123 4124 # Pool2DOptions 4125 def Padding(self): 4126 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 4127 if o != 0: 4128 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 4129 return 0 4130 4131 # Pool2DOptions 4132 def StrideW(self): 4133 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 4134 if o != 0: 4135 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 4136 return 0 4137 4138 # Pool2DOptions 4139 def StrideH(self): 4140 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 4141 if o != 0: 4142 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 4143 return 0 4144 4145 # Pool2DOptions 4146 def FilterWidth(self): 4147 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 4148 if o != 0: 4149 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 4150 return 0 4151 4152 # Pool2DOptions 4153 def FilterHeight(self): 4154 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) 4155 if o != 0: 4156 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 4157 return 0 4158 4159 # Pool2DOptions 4160 def FusedActivationFunction(self): 4161 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) 4162 if o != 0: 4163 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 4164 return 0 4165 4166def Pool2DOptionsStart(builder): builder.StartObject(6) 4167def Pool2DOptionsAddPadding(builder, padding): builder.PrependInt8Slot(0, padding, 0) 4168def Pool2DOptionsAddStrideW(builder, strideW): builder.PrependInt32Slot(1, strideW, 0) 4169def Pool2DOptionsAddStrideH(builder, strideH): builder.PrependInt32Slot(2, strideH, 0) 4170def Pool2DOptionsAddFilterWidth(builder, filterWidth): builder.PrependInt32Slot(3, filterWidth, 0) 4171def Pool2DOptionsAddFilterHeight(builder, filterHeight): builder.PrependInt32Slot(4, filterHeight, 0) 4172def Pool2DOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(5, fusedActivationFunction, 0) 4173def Pool2DOptionsEnd(builder): return builder.EndObject() 4174 4175 4176class Pool2DOptionsT(object): 4177 4178 # Pool2DOptionsT 4179 def __init__(self): 4180 self.padding = 0 # type: int 4181 self.strideW = 0 # type: int 4182 self.strideH = 0 # type: int 4183 self.filterWidth = 0 # type: int 4184 self.filterHeight = 0 # type: int 4185 self.fusedActivationFunction = 0 # type: int 4186 4187 @classmethod 4188 def InitFromBuf(cls, buf, pos): 4189 pool2DOptions = Pool2DOptions() 4190 pool2DOptions.Init(buf, pos) 4191 return cls.InitFromObj(pool2DOptions) 4192 4193 @classmethod 4194 def InitFromObj(cls, pool2DOptions): 4195 x = Pool2DOptionsT() 4196 x._UnPack(pool2DOptions) 4197 return x 4198 4199 # Pool2DOptionsT 4200 def _UnPack(self, pool2DOptions): 4201 if pool2DOptions is None: 4202 return 4203 self.padding = pool2DOptions.Padding() 4204 self.strideW = pool2DOptions.StrideW() 4205 self.strideH = pool2DOptions.StrideH() 4206 self.filterWidth = pool2DOptions.FilterWidth() 4207 self.filterHeight = pool2DOptions.FilterHeight() 4208 self.fusedActivationFunction = pool2DOptions.FusedActivationFunction() 4209 4210 # Pool2DOptionsT 4211 def Pack(self, builder): 4212 Pool2DOptionsStart(builder) 4213 Pool2DOptionsAddPadding(builder, self.padding) 4214 Pool2DOptionsAddStrideW(builder, self.strideW) 4215 Pool2DOptionsAddStrideH(builder, self.strideH) 4216 Pool2DOptionsAddFilterWidth(builder, self.filterWidth) 4217 Pool2DOptionsAddFilterHeight(builder, self.filterHeight) 4218 Pool2DOptionsAddFusedActivationFunction(builder, self.fusedActivationFunction) 4219 pool2DOptions = Pool2DOptionsEnd(builder) 4220 return pool2DOptions 4221# automatically generated by the FlatBuffers compiler, do not modify 4222 4223# namespace: tflite 4224 4225class Padding(object): 4226 SAME = 0 4227 VALID = 1 4228 4229# automatically generated by the FlatBuffers compiler, do not modify 4230 4231# namespace: tflite 4232 4233from tflite_support.flatbuffers.compat import import_numpy 4234np = import_numpy() 4235 4236class PadV2Options(object): 4237 __slots__ = ['_tab'] 4238 4239 @classmethod 4240 def GetRootAsPadV2Options(cls, buf, offset): 4241 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 4242 x = PadV2Options() 4243 x.Init(buf, n + offset) 4244 return x 4245 4246 @classmethod 4247 def PadV2OptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 4248 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 4249 4250 # PadV2Options 4251 def Init(self, buf, pos): 4252 self._tab = flatbuffers.table.Table(buf, pos) 4253 4254def PadV2OptionsStart(builder): builder.StartObject(0) 4255def PadV2OptionsEnd(builder): return builder.EndObject() 4256 4257 4258class PadV2OptionsT(object): 4259 4260 # PadV2OptionsT 4261 def __init__(self): 4262 pass 4263 4264 @classmethod 4265 def InitFromBuf(cls, buf, pos): 4266 padV2Options = PadV2Options() 4267 padV2Options.Init(buf, pos) 4268 return cls.InitFromObj(padV2Options) 4269 4270 @classmethod 4271 def InitFromObj(cls, padV2Options): 4272 x = PadV2OptionsT() 4273 x._UnPack(padV2Options) 4274 return x 4275 4276 # PadV2OptionsT 4277 def _UnPack(self, padV2Options): 4278 if padV2Options is None: 4279 return 4280 4281 # PadV2OptionsT 4282 def Pack(self, builder): 4283 PadV2OptionsStart(builder) 4284 padV2Options = PadV2OptionsEnd(builder) 4285 return padV2Options 4286# automatically generated by the FlatBuffers compiler, do not modify 4287 4288# namespace: tflite 4289 4290from tflite_support.flatbuffers.compat import import_numpy 4291np = import_numpy() 4292 4293class PadOptions(object): 4294 __slots__ = ['_tab'] 4295 4296 @classmethod 4297 def GetRootAsPadOptions(cls, buf, offset): 4298 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 4299 x = PadOptions() 4300 x.Init(buf, n + offset) 4301 return x 4302 4303 @classmethod 4304 def PadOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 4305 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 4306 4307 # PadOptions 4308 def Init(self, buf, pos): 4309 self._tab = flatbuffers.table.Table(buf, pos) 4310 4311def PadOptionsStart(builder): builder.StartObject(0) 4312def PadOptionsEnd(builder): return builder.EndObject() 4313 4314 4315class PadOptionsT(object): 4316 4317 # PadOptionsT 4318 def __init__(self): 4319 pass 4320 4321 @classmethod 4322 def InitFromBuf(cls, buf, pos): 4323 padOptions = PadOptions() 4324 padOptions.Init(buf, pos) 4325 return cls.InitFromObj(padOptions) 4326 4327 @classmethod 4328 def InitFromObj(cls, padOptions): 4329 x = PadOptionsT() 4330 x._UnPack(padOptions) 4331 return x 4332 4333 # PadOptionsT 4334 def _UnPack(self, padOptions): 4335 if padOptions is None: 4336 return 4337 4338 # PadOptionsT 4339 def Pack(self, builder): 4340 PadOptionsStart(builder) 4341 padOptions = PadOptionsEnd(builder) 4342 return padOptions 4343# automatically generated by the FlatBuffers compiler, do not modify 4344 4345# namespace: tflite 4346 4347from tflite_support.flatbuffers.compat import import_numpy 4348np = import_numpy() 4349 4350class PackOptions(object): 4351 __slots__ = ['_tab'] 4352 4353 @classmethod 4354 def GetRootAsPackOptions(cls, buf, offset): 4355 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 4356 x = PackOptions() 4357 x.Init(buf, n + offset) 4358 return x 4359 4360 @classmethod 4361 def PackOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 4362 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 4363 4364 # PackOptions 4365 def Init(self, buf, pos): 4366 self._tab = flatbuffers.table.Table(buf, pos) 4367 4368 # PackOptions 4369 def ValuesCount(self): 4370 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 4371 if o != 0: 4372 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 4373 return 0 4374 4375 # PackOptions 4376 def Axis(self): 4377 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 4378 if o != 0: 4379 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 4380 return 0 4381 4382def PackOptionsStart(builder): builder.StartObject(2) 4383def PackOptionsAddValuesCount(builder, valuesCount): builder.PrependInt32Slot(0, valuesCount, 0) 4384def PackOptionsAddAxis(builder, axis): builder.PrependInt32Slot(1, axis, 0) 4385def PackOptionsEnd(builder): return builder.EndObject() 4386 4387 4388class PackOptionsT(object): 4389 4390 # PackOptionsT 4391 def __init__(self): 4392 self.valuesCount = 0 # type: int 4393 self.axis = 0 # type: int 4394 4395 @classmethod 4396 def InitFromBuf(cls, buf, pos): 4397 packOptions = PackOptions() 4398 packOptions.Init(buf, pos) 4399 return cls.InitFromObj(packOptions) 4400 4401 @classmethod 4402 def InitFromObj(cls, packOptions): 4403 x = PackOptionsT() 4404 x._UnPack(packOptions) 4405 return x 4406 4407 # PackOptionsT 4408 def _UnPack(self, packOptions): 4409 if packOptions is None: 4410 return 4411 self.valuesCount = packOptions.ValuesCount() 4412 self.axis = packOptions.Axis() 4413 4414 # PackOptionsT 4415 def Pack(self, builder): 4416 PackOptionsStart(builder) 4417 PackOptionsAddValuesCount(builder, self.valuesCount) 4418 PackOptionsAddAxis(builder, self.axis) 4419 packOptions = PackOptionsEnd(builder) 4420 return packOptions 4421# automatically generated by the FlatBuffers compiler, do not modify 4422 4423# namespace: tflite 4424 4425from tflite_support.flatbuffers.compat import import_numpy 4426np = import_numpy() 4427 4428class OperatorCode(object): 4429 __slots__ = ['_tab'] 4430 4431 @classmethod 4432 def GetRootAsOperatorCode(cls, buf, offset): 4433 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 4434 x = OperatorCode() 4435 x.Init(buf, n + offset) 4436 return x 4437 4438 @classmethod 4439 def OperatorCodeBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 4440 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 4441 4442 # OperatorCode 4443 def Init(self, buf, pos): 4444 self._tab = flatbuffers.table.Table(buf, pos) 4445 4446 # OperatorCode 4447 def BuiltinCode(self): 4448 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 4449 if o != 0: 4450 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 4451 return 0 4452 4453 # OperatorCode 4454 def CustomCode(self): 4455 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 4456 if o != 0: 4457 return self._tab.String(o + self._tab.Pos) 4458 return None 4459 4460 # OperatorCode 4461 def Version(self): 4462 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 4463 if o != 0: 4464 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 4465 return 1 4466 4467def OperatorCodeStart(builder): builder.StartObject(3) 4468def OperatorCodeAddBuiltinCode(builder, builtinCode): builder.PrependInt8Slot(0, builtinCode, 0) 4469def OperatorCodeAddCustomCode(builder, customCode): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(customCode), 0) 4470def OperatorCodeAddVersion(builder, version): builder.PrependInt32Slot(2, version, 1) 4471def OperatorCodeEnd(builder): return builder.EndObject() 4472 4473 4474class OperatorCodeT(object): 4475 4476 # OperatorCodeT 4477 def __init__(self): 4478 self.builtinCode = 0 # type: int 4479 self.customCode = None # type: str 4480 self.version = 1 # type: int 4481 4482 @classmethod 4483 def InitFromBuf(cls, buf, pos): 4484 operatorCode = OperatorCode() 4485 operatorCode.Init(buf, pos) 4486 return cls.InitFromObj(operatorCode) 4487 4488 @classmethod 4489 def InitFromObj(cls, operatorCode): 4490 x = OperatorCodeT() 4491 x._UnPack(operatorCode) 4492 return x 4493 4494 # OperatorCodeT 4495 def _UnPack(self, operatorCode): 4496 if operatorCode is None: 4497 return 4498 self.builtinCode = operatorCode.BuiltinCode() 4499 self.customCode = operatorCode.CustomCode() 4500 self.version = operatorCode.Version() 4501 4502 # OperatorCodeT 4503 def Pack(self, builder): 4504 if self.customCode is not None: 4505 customCode = builder.CreateString(self.customCode) 4506 OperatorCodeStart(builder) 4507 OperatorCodeAddBuiltinCode(builder, self.builtinCode) 4508 if self.customCode is not None: 4509 OperatorCodeAddCustomCode(builder, customCode) 4510 OperatorCodeAddVersion(builder, self.version) 4511 operatorCode = OperatorCodeEnd(builder) 4512 return operatorCode 4513# automatically generated by the FlatBuffers compiler, do not modify 4514 4515# namespace: tflite 4516 4517from tflite_support.flatbuffers.compat import import_numpy 4518np = import_numpy() 4519 4520class Operator(object): 4521 __slots__ = ['_tab'] 4522 4523 @classmethod 4524 def GetRootAsOperator(cls, buf, offset): 4525 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 4526 x = Operator() 4527 x.Init(buf, n + offset) 4528 return x 4529 4530 @classmethod 4531 def OperatorBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 4532 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 4533 4534 # Operator 4535 def Init(self, buf, pos): 4536 self._tab = flatbuffers.table.Table(buf, pos) 4537 4538 # Operator 4539 def OpcodeIndex(self): 4540 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 4541 if o != 0: 4542 return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos) 4543 return 0 4544 4545 # Operator 4546 def Inputs(self, j): 4547 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 4548 if o != 0: 4549 a = self._tab.Vector(o) 4550 return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 4551 return 0 4552 4553 # Operator 4554 def InputsAsNumpy(self): 4555 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 4556 if o != 0: 4557 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) 4558 return 0 4559 4560 # Operator 4561 def InputsLength(self): 4562 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 4563 if o != 0: 4564 return self._tab.VectorLen(o) 4565 return 0 4566 4567 # Operator 4568 def InputsIsNone(self): 4569 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 4570 return o == 0 4571 4572 # Operator 4573 def Outputs(self, j): 4574 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 4575 if o != 0: 4576 a = self._tab.Vector(o) 4577 return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 4578 return 0 4579 4580 # Operator 4581 def OutputsAsNumpy(self): 4582 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 4583 if o != 0: 4584 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) 4585 return 0 4586 4587 # Operator 4588 def OutputsLength(self): 4589 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 4590 if o != 0: 4591 return self._tab.VectorLen(o) 4592 return 0 4593 4594 # Operator 4595 def OutputsIsNone(self): 4596 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 4597 return o == 0 4598 4599 # Operator 4600 def BuiltinOptionsType(self): 4601 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 4602 if o != 0: 4603 return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) 4604 return 0 4605 4606 # Operator 4607 def BuiltinOptions(self): 4608 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) 4609 if o != 0: 4610 from tflite_support.flatbuffers.table import Table 4611 obj = Table(bytearray(), 0) 4612 self._tab.Union(obj, o) 4613 return obj 4614 return None 4615 4616 # Operator 4617 def CustomOptions(self, j): 4618 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) 4619 if o != 0: 4620 a = self._tab.Vector(o) 4621 return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) 4622 return 0 4623 4624 # Operator 4625 def CustomOptionsAsNumpy(self): 4626 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) 4627 if o != 0: 4628 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) 4629 return 0 4630 4631 # Operator 4632 def CustomOptionsLength(self): 4633 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) 4634 if o != 0: 4635 return self._tab.VectorLen(o) 4636 return 0 4637 4638 # Operator 4639 def CustomOptionsIsNone(self): 4640 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) 4641 return o == 0 4642 4643 # Operator 4644 def CustomOptionsFormat(self): 4645 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) 4646 if o != 0: 4647 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 4648 return 0 4649 4650 # Operator 4651 def MutatingVariableInputs(self, j): 4652 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) 4653 if o != 0: 4654 a = self._tab.Vector(o) 4655 return self._tab.Get(flatbuffers.number_types.BoolFlags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) 4656 return 0 4657 4658 # Operator 4659 def MutatingVariableInputsAsNumpy(self): 4660 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) 4661 if o != 0: 4662 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.BoolFlags, o) 4663 return 0 4664 4665 # Operator 4666 def MutatingVariableInputsLength(self): 4667 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) 4668 if o != 0: 4669 return self._tab.VectorLen(o) 4670 return 0 4671 4672 # Operator 4673 def MutatingVariableInputsIsNone(self): 4674 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) 4675 return o == 0 4676 4677 # Operator 4678 def Intermediates(self, j): 4679 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) 4680 if o != 0: 4681 a = self._tab.Vector(o) 4682 return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 4683 return 0 4684 4685 # Operator 4686 def IntermediatesAsNumpy(self): 4687 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) 4688 if o != 0: 4689 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) 4690 return 0 4691 4692 # Operator 4693 def IntermediatesLength(self): 4694 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) 4695 if o != 0: 4696 return self._tab.VectorLen(o) 4697 return 0 4698 4699 # Operator 4700 def IntermediatesIsNone(self): 4701 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) 4702 return o == 0 4703 4704def OperatorStart(builder): builder.StartObject(9) 4705def OperatorAddOpcodeIndex(builder, opcodeIndex): builder.PrependUint32Slot(0, opcodeIndex, 0) 4706def OperatorAddInputs(builder, inputs): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(inputs), 0) 4707def OperatorStartInputsVector(builder, numElems): return builder.StartVector(4, numElems, 4) 4708def OperatorAddOutputs(builder, outputs): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(outputs), 0) 4709def OperatorStartOutputsVector(builder, numElems): return builder.StartVector(4, numElems, 4) 4710def OperatorAddBuiltinOptionsType(builder, builtinOptionsType): builder.PrependUint8Slot(3, builtinOptionsType, 0) 4711def OperatorAddBuiltinOptions(builder, builtinOptions): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(builtinOptions), 0) 4712def OperatorAddCustomOptions(builder, customOptions): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(customOptions), 0) 4713def OperatorStartCustomOptionsVector(builder, numElems): return builder.StartVector(1, numElems, 1) 4714def OperatorAddCustomOptionsFormat(builder, customOptionsFormat): builder.PrependInt8Slot(6, customOptionsFormat, 0) 4715def OperatorAddMutatingVariableInputs(builder, mutatingVariableInputs): builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(mutatingVariableInputs), 0) 4716def OperatorStartMutatingVariableInputsVector(builder, numElems): return builder.StartVector(1, numElems, 1) 4717def OperatorAddIntermediates(builder, intermediates): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(intermediates), 0) 4718def OperatorStartIntermediatesVector(builder, numElems): return builder.StartVector(4, numElems, 4) 4719def OperatorEnd(builder): return builder.EndObject() 4720 4721try: 4722 from typing import List, Union 4723except: 4724 pass 4725 4726class OperatorT(object): 4727 4728 # OperatorT 4729 def __init__(self): 4730 self.opcodeIndex = 0 # type: int 4731 self.inputs = None # type: List[int] 4732 self.outputs = None # type: List[int] 4733 self.builtinOptionsType = 0 # type: int 4734 self.builtinOptions = None # type: Union[None, Conv2DOptionsT, DepthwiseConv2DOptionsT, ConcatEmbeddingsOptionsT, LSHProjectionOptionsT, Pool2DOptionsT, SVDFOptionsT, RNNOptionsT, FullyConnectedOptionsT, SoftmaxOptionsT, ConcatenationOptionsT, AddOptionsT, L2NormOptionsT, LocalResponseNormalizationOptionsT, LSTMOptionsT, ResizeBilinearOptionsT, CallOptionsT, ReshapeOptionsT, SkipGramOptionsT, SpaceToDepthOptionsT, EmbeddingLookupSparseOptionsT, MulOptionsT, PadOptionsT, GatherOptionsT, BatchToSpaceNDOptionsT, SpaceToBatchNDOptionsT, TransposeOptionsT, ReducerOptionsT, SubOptionsT, DivOptionsT, SqueezeOptionsT, SequenceRNNOptionsT, StridedSliceOptionsT, ExpOptionsT, TopKV2OptionsT, SplitOptionsT, LogSoftmaxOptionsT, CastOptionsT, DequantizeOptionsT, MaximumMinimumOptionsT, ArgMaxOptionsT, LessOptionsT, NegOptionsT, PadV2OptionsT, GreaterOptionsT, GreaterEqualOptionsT, LessEqualOptionsT, SelectOptionsT, SliceOptionsT, TransposeConvOptionsT, SparseToDenseOptionsT, TileOptionsT, ExpandDimsOptionsT, EqualOptionsT, NotEqualOptionsT, ShapeOptionsT, PowOptionsT, ArgMinOptionsT, FakeQuantOptionsT, PackOptionsT, LogicalOrOptionsT, OneHotOptionsT, LogicalAndOptionsT, LogicalNotOptionsT, UnpackOptionsT, FloorDivOptionsT, SquareOptionsT, ZerosLikeOptionsT, FillOptionsT, BidirectionalSequenceLSTMOptionsT, BidirectionalSequenceRNNOptionsT, UnidirectionalSequenceLSTMOptionsT, FloorModOptionsT, RangeOptionsT, ResizeNearestNeighborOptionsT, LeakyReluOptionsT, SquaredDifferenceOptionsT, MirrorPadOptionsT, AbsOptionsT, SplitVOptionsT, UniqueOptionsT, ReverseV2OptionsT, AddNOptionsT, GatherNdOptionsT, CosOptionsT, WhereOptionsT, RankOptionsT, ReverseSequenceOptionsT, MatrixDiagOptionsT, QuantizeOptionsT, MatrixSetDiagOptionsT, HardSwishOptionsT, IfOptionsT, WhileOptionsT, DepthToSpaceOptionsT, NonMaxSuppressionV4OptionsT, NonMaxSuppressionV5OptionsT, ScatterNdOptionsT, SelectV2OptionsT, DensifyOptionsT, SegmentSumOptionsT] 4735 self.customOptions = None # type: List[int] 4736 self.customOptionsFormat = 0 # type: int 4737 self.mutatingVariableInputs = None # type: List[bool] 4738 self.intermediates = None # type: List[int] 4739 4740 @classmethod 4741 def InitFromBuf(cls, buf, pos): 4742 operator = Operator() 4743 operator.Init(buf, pos) 4744 return cls.InitFromObj(operator) 4745 4746 @classmethod 4747 def InitFromObj(cls, operator): 4748 x = OperatorT() 4749 x._UnPack(operator) 4750 return x 4751 4752 # OperatorT 4753 def _UnPack(self, operator): 4754 if operator is None: 4755 return 4756 self.opcodeIndex = operator.OpcodeIndex() 4757 if not operator.InputsIsNone(): 4758 if np is None: 4759 self.inputs = [] 4760 for i in range(operator.InputsLength()): 4761 self.inputs.append(operator.Inputs(i)) 4762 else: 4763 self.inputs = operator.InputsAsNumpy() 4764 if not operator.OutputsIsNone(): 4765 if np is None: 4766 self.outputs = [] 4767 for i in range(operator.OutputsLength()): 4768 self.outputs.append(operator.Outputs(i)) 4769 else: 4770 self.outputs = operator.OutputsAsNumpy() 4771 self.builtinOptionsType = operator.BuiltinOptionsType() 4772 self.builtinOptions = BuiltinOptionsCreator(self.builtinOptionsType, operator.BuiltinOptions()) 4773 if not operator.CustomOptionsIsNone(): 4774 if np is None: 4775 self.customOptions = [] 4776 for i in range(operator.CustomOptionsLength()): 4777 self.customOptions.append(operator.CustomOptions(i)) 4778 else: 4779 self.customOptions = operator.CustomOptionsAsNumpy() 4780 self.customOptionsFormat = operator.CustomOptionsFormat() 4781 if not operator.MutatingVariableInputsIsNone(): 4782 if np is None: 4783 self.mutatingVariableInputs = [] 4784 for i in range(operator.MutatingVariableInputsLength()): 4785 self.mutatingVariableInputs.append(operator.MutatingVariableInputs(i)) 4786 else: 4787 self.mutatingVariableInputs = operator.MutatingVariableInputsAsNumpy() 4788 if not operator.IntermediatesIsNone(): 4789 if np is None: 4790 self.intermediates = [] 4791 for i in range(operator.IntermediatesLength()): 4792 self.intermediates.append(operator.Intermediates(i)) 4793 else: 4794 self.intermediates = operator.IntermediatesAsNumpy() 4795 4796 # OperatorT 4797 def Pack(self, builder): 4798 if self.inputs is not None: 4799 if np is not None and type(self.inputs) is np.ndarray: 4800 inputs = builder.CreateNumpyVector(self.inputs) 4801 else: 4802 OperatorStartInputsVector(builder, len(self.inputs)) 4803 for i in reversed(range(len(self.inputs))): 4804 builder.PrependInt32(self.inputs[i]) 4805 inputs = builder.EndVector(len(self.inputs)) 4806 if self.outputs is not None: 4807 if np is not None and type(self.outputs) is np.ndarray: 4808 outputs = builder.CreateNumpyVector(self.outputs) 4809 else: 4810 OperatorStartOutputsVector(builder, len(self.outputs)) 4811 for i in reversed(range(len(self.outputs))): 4812 builder.PrependInt32(self.outputs[i]) 4813 outputs = builder.EndVector(len(self.outputs)) 4814 if self.builtinOptions is not None: 4815 builtinOptions = self.builtinOptions.Pack(builder) 4816 if self.customOptions is not None: 4817 if np is not None and type(self.customOptions) is np.ndarray: 4818 customOptions = builder.CreateNumpyVector(self.customOptions) 4819 else: 4820 OperatorStartCustomOptionsVector(builder, len(self.customOptions)) 4821 for i in reversed(range(len(self.customOptions))): 4822 builder.PrependUint8(self.customOptions[i]) 4823 customOptions = builder.EndVector(len(self.customOptions)) 4824 if self.mutatingVariableInputs is not None: 4825 if np is not None and type(self.mutatingVariableInputs) is np.ndarray: 4826 mutatingVariableInputs = builder.CreateNumpyVector(self.mutatingVariableInputs) 4827 else: 4828 OperatorStartMutatingVariableInputsVector(builder, len(self.mutatingVariableInputs)) 4829 for i in reversed(range(len(self.mutatingVariableInputs))): 4830 builder.PrependBool(self.mutatingVariableInputs[i]) 4831 mutatingVariableInputs = builder.EndVector(len(self.mutatingVariableInputs)) 4832 if self.intermediates is not None: 4833 if np is not None and type(self.intermediates) is np.ndarray: 4834 intermediates = builder.CreateNumpyVector(self.intermediates) 4835 else: 4836 OperatorStartIntermediatesVector(builder, len(self.intermediates)) 4837 for i in reversed(range(len(self.intermediates))): 4838 builder.PrependInt32(self.intermediates[i]) 4839 intermediates = builder.EndVector(len(self.intermediates)) 4840 OperatorStart(builder) 4841 OperatorAddOpcodeIndex(builder, self.opcodeIndex) 4842 if self.inputs is not None: 4843 OperatorAddInputs(builder, inputs) 4844 if self.outputs is not None: 4845 OperatorAddOutputs(builder, outputs) 4846 OperatorAddBuiltinOptionsType(builder, self.builtinOptionsType) 4847 if self.builtinOptions is not None: 4848 OperatorAddBuiltinOptions(builder, builtinOptions) 4849 if self.customOptions is not None: 4850 OperatorAddCustomOptions(builder, customOptions) 4851 OperatorAddCustomOptionsFormat(builder, self.customOptionsFormat) 4852 if self.mutatingVariableInputs is not None: 4853 OperatorAddMutatingVariableInputs(builder, mutatingVariableInputs) 4854 if self.intermediates is not None: 4855 OperatorAddIntermediates(builder, intermediates) 4856 operator = OperatorEnd(builder) 4857 return operator 4858# automatically generated by the FlatBuffers compiler, do not modify 4859 4860# namespace: tflite 4861 4862from tflite_support.flatbuffers.compat import import_numpy 4863np = import_numpy() 4864 4865class OneHotOptions(object): 4866 __slots__ = ['_tab'] 4867 4868 @classmethod 4869 def GetRootAsOneHotOptions(cls, buf, offset): 4870 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 4871 x = OneHotOptions() 4872 x.Init(buf, n + offset) 4873 return x 4874 4875 @classmethod 4876 def OneHotOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 4877 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 4878 4879 # OneHotOptions 4880 def Init(self, buf, pos): 4881 self._tab = flatbuffers.table.Table(buf, pos) 4882 4883 # OneHotOptions 4884 def Axis(self): 4885 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 4886 if o != 0: 4887 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 4888 return 0 4889 4890def OneHotOptionsStart(builder): builder.StartObject(1) 4891def OneHotOptionsAddAxis(builder, axis): builder.PrependInt32Slot(0, axis, 0) 4892def OneHotOptionsEnd(builder): return builder.EndObject() 4893 4894 4895class OneHotOptionsT(object): 4896 4897 # OneHotOptionsT 4898 def __init__(self): 4899 self.axis = 0 # type: int 4900 4901 @classmethod 4902 def InitFromBuf(cls, buf, pos): 4903 oneHotOptions = OneHotOptions() 4904 oneHotOptions.Init(buf, pos) 4905 return cls.InitFromObj(oneHotOptions) 4906 4907 @classmethod 4908 def InitFromObj(cls, oneHotOptions): 4909 x = OneHotOptionsT() 4910 x._UnPack(oneHotOptions) 4911 return x 4912 4913 # OneHotOptionsT 4914 def _UnPack(self, oneHotOptions): 4915 if oneHotOptions is None: 4916 return 4917 self.axis = oneHotOptions.Axis() 4918 4919 # OneHotOptionsT 4920 def Pack(self, builder): 4921 OneHotOptionsStart(builder) 4922 OneHotOptionsAddAxis(builder, self.axis) 4923 oneHotOptions = OneHotOptionsEnd(builder) 4924 return oneHotOptions 4925# automatically generated by the FlatBuffers compiler, do not modify 4926 4927# namespace: tflite 4928 4929from tflite_support.flatbuffers.compat import import_numpy 4930np = import_numpy() 4931 4932class NotEqualOptions(object): 4933 __slots__ = ['_tab'] 4934 4935 @classmethod 4936 def GetRootAsNotEqualOptions(cls, buf, offset): 4937 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 4938 x = NotEqualOptions() 4939 x.Init(buf, n + offset) 4940 return x 4941 4942 @classmethod 4943 def NotEqualOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 4944 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 4945 4946 # NotEqualOptions 4947 def Init(self, buf, pos): 4948 self._tab = flatbuffers.table.Table(buf, pos) 4949 4950def NotEqualOptionsStart(builder): builder.StartObject(0) 4951def NotEqualOptionsEnd(builder): return builder.EndObject() 4952 4953 4954class NotEqualOptionsT(object): 4955 4956 # NotEqualOptionsT 4957 def __init__(self): 4958 pass 4959 4960 @classmethod 4961 def InitFromBuf(cls, buf, pos): 4962 notEqualOptions = NotEqualOptions() 4963 notEqualOptions.Init(buf, pos) 4964 return cls.InitFromObj(notEqualOptions) 4965 4966 @classmethod 4967 def InitFromObj(cls, notEqualOptions): 4968 x = NotEqualOptionsT() 4969 x._UnPack(notEqualOptions) 4970 return x 4971 4972 # NotEqualOptionsT 4973 def _UnPack(self, notEqualOptions): 4974 if notEqualOptions is None: 4975 return 4976 4977 # NotEqualOptionsT 4978 def Pack(self, builder): 4979 NotEqualOptionsStart(builder) 4980 notEqualOptions = NotEqualOptionsEnd(builder) 4981 return notEqualOptions 4982# automatically generated by the FlatBuffers compiler, do not modify 4983 4984# namespace: tflite 4985 4986from tflite_support.flatbuffers.compat import import_numpy 4987np = import_numpy() 4988 4989class NonMaxSuppressionV5Options(object): 4990 __slots__ = ['_tab'] 4991 4992 @classmethod 4993 def GetRootAsNonMaxSuppressionV5Options(cls, buf, offset): 4994 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 4995 x = NonMaxSuppressionV5Options() 4996 x.Init(buf, n + offset) 4997 return x 4998 4999 @classmethod 5000 def NonMaxSuppressionV5OptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 5001 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 5002 5003 # NonMaxSuppressionV5Options 5004 def Init(self, buf, pos): 5005 self._tab = flatbuffers.table.Table(buf, pos) 5006 5007def NonMaxSuppressionV5OptionsStart(builder): builder.StartObject(0) 5008def NonMaxSuppressionV5OptionsEnd(builder): return builder.EndObject() 5009 5010 5011class NonMaxSuppressionV5OptionsT(object): 5012 5013 # NonMaxSuppressionV5OptionsT 5014 def __init__(self): 5015 pass 5016 5017 @classmethod 5018 def InitFromBuf(cls, buf, pos): 5019 nonMaxSuppressionV5Options = NonMaxSuppressionV5Options() 5020 nonMaxSuppressionV5Options.Init(buf, pos) 5021 return cls.InitFromObj(nonMaxSuppressionV5Options) 5022 5023 @classmethod 5024 def InitFromObj(cls, nonMaxSuppressionV5Options): 5025 x = NonMaxSuppressionV5OptionsT() 5026 x._UnPack(nonMaxSuppressionV5Options) 5027 return x 5028 5029 # NonMaxSuppressionV5OptionsT 5030 def _UnPack(self, nonMaxSuppressionV5Options): 5031 if nonMaxSuppressionV5Options is None: 5032 return 5033 5034 # NonMaxSuppressionV5OptionsT 5035 def Pack(self, builder): 5036 NonMaxSuppressionV5OptionsStart(builder) 5037 nonMaxSuppressionV5Options = NonMaxSuppressionV5OptionsEnd(builder) 5038 return nonMaxSuppressionV5Options 5039# automatically generated by the FlatBuffers compiler, do not modify 5040 5041# namespace: tflite 5042 5043from tflite_support.flatbuffers.compat import import_numpy 5044np = import_numpy() 5045 5046class NonMaxSuppressionV4Options(object): 5047 __slots__ = ['_tab'] 5048 5049 @classmethod 5050 def GetRootAsNonMaxSuppressionV4Options(cls, buf, offset): 5051 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 5052 x = NonMaxSuppressionV4Options() 5053 x.Init(buf, n + offset) 5054 return x 5055 5056 @classmethod 5057 def NonMaxSuppressionV4OptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 5058 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 5059 5060 # NonMaxSuppressionV4Options 5061 def Init(self, buf, pos): 5062 self._tab = flatbuffers.table.Table(buf, pos) 5063 5064def NonMaxSuppressionV4OptionsStart(builder): builder.StartObject(0) 5065def NonMaxSuppressionV4OptionsEnd(builder): return builder.EndObject() 5066 5067 5068class NonMaxSuppressionV4OptionsT(object): 5069 5070 # NonMaxSuppressionV4OptionsT 5071 def __init__(self): 5072 pass 5073 5074 @classmethod 5075 def InitFromBuf(cls, buf, pos): 5076 nonMaxSuppressionV4Options = NonMaxSuppressionV4Options() 5077 nonMaxSuppressionV4Options.Init(buf, pos) 5078 return cls.InitFromObj(nonMaxSuppressionV4Options) 5079 5080 @classmethod 5081 def InitFromObj(cls, nonMaxSuppressionV4Options): 5082 x = NonMaxSuppressionV4OptionsT() 5083 x._UnPack(nonMaxSuppressionV4Options) 5084 return x 5085 5086 # NonMaxSuppressionV4OptionsT 5087 def _UnPack(self, nonMaxSuppressionV4Options): 5088 if nonMaxSuppressionV4Options is None: 5089 return 5090 5091 # NonMaxSuppressionV4OptionsT 5092 def Pack(self, builder): 5093 NonMaxSuppressionV4OptionsStart(builder) 5094 nonMaxSuppressionV4Options = NonMaxSuppressionV4OptionsEnd(builder) 5095 return nonMaxSuppressionV4Options 5096# automatically generated by the FlatBuffers compiler, do not modify 5097 5098# namespace: tflite 5099 5100from tflite_support.flatbuffers.compat import import_numpy 5101np = import_numpy() 5102 5103class NegOptions(object): 5104 __slots__ = ['_tab'] 5105 5106 @classmethod 5107 def GetRootAsNegOptions(cls, buf, offset): 5108 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 5109 x = NegOptions() 5110 x.Init(buf, n + offset) 5111 return x 5112 5113 @classmethod 5114 def NegOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 5115 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 5116 5117 # NegOptions 5118 def Init(self, buf, pos): 5119 self._tab = flatbuffers.table.Table(buf, pos) 5120 5121def NegOptionsStart(builder): builder.StartObject(0) 5122def NegOptionsEnd(builder): return builder.EndObject() 5123 5124 5125class NegOptionsT(object): 5126 5127 # NegOptionsT 5128 def __init__(self): 5129 pass 5130 5131 @classmethod 5132 def InitFromBuf(cls, buf, pos): 5133 negOptions = NegOptions() 5134 negOptions.Init(buf, pos) 5135 return cls.InitFromObj(negOptions) 5136 5137 @classmethod 5138 def InitFromObj(cls, negOptions): 5139 x = NegOptionsT() 5140 x._UnPack(negOptions) 5141 return x 5142 5143 # NegOptionsT 5144 def _UnPack(self, negOptions): 5145 if negOptions is None: 5146 return 5147 5148 # NegOptionsT 5149 def Pack(self, builder): 5150 NegOptionsStart(builder) 5151 negOptions = NegOptionsEnd(builder) 5152 return negOptions 5153# automatically generated by the FlatBuffers compiler, do not modify 5154 5155# namespace: tflite 5156 5157from tflite_support.flatbuffers.compat import import_numpy 5158np = import_numpy() 5159 5160class MulOptions(object): 5161 __slots__ = ['_tab'] 5162 5163 @classmethod 5164 def GetRootAsMulOptions(cls, buf, offset): 5165 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 5166 x = MulOptions() 5167 x.Init(buf, n + offset) 5168 return x 5169 5170 @classmethod 5171 def MulOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 5172 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 5173 5174 # MulOptions 5175 def Init(self, buf, pos): 5176 self._tab = flatbuffers.table.Table(buf, pos) 5177 5178 # MulOptions 5179 def FusedActivationFunction(self): 5180 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 5181 if o != 0: 5182 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 5183 return 0 5184 5185def MulOptionsStart(builder): builder.StartObject(1) 5186def MulOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0) 5187def MulOptionsEnd(builder): return builder.EndObject() 5188 5189 5190class MulOptionsT(object): 5191 5192 # MulOptionsT 5193 def __init__(self): 5194 self.fusedActivationFunction = 0 # type: int 5195 5196 @classmethod 5197 def InitFromBuf(cls, buf, pos): 5198 mulOptions = MulOptions() 5199 mulOptions.Init(buf, pos) 5200 return cls.InitFromObj(mulOptions) 5201 5202 @classmethod 5203 def InitFromObj(cls, mulOptions): 5204 x = MulOptionsT() 5205 x._UnPack(mulOptions) 5206 return x 5207 5208 # MulOptionsT 5209 def _UnPack(self, mulOptions): 5210 if mulOptions is None: 5211 return 5212 self.fusedActivationFunction = mulOptions.FusedActivationFunction() 5213 5214 # MulOptionsT 5215 def Pack(self, builder): 5216 MulOptionsStart(builder) 5217 MulOptionsAddFusedActivationFunction(builder, self.fusedActivationFunction) 5218 mulOptions = MulOptionsEnd(builder) 5219 return mulOptions 5220# automatically generated by the FlatBuffers compiler, do not modify 5221 5222# namespace: tflite 5223 5224from tflite_support.flatbuffers.compat import import_numpy 5225np = import_numpy() 5226 5227class Model(object): 5228 __slots__ = ['_tab'] 5229 5230 @classmethod 5231 def GetRootAsModel(cls, buf, offset): 5232 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 5233 x = Model() 5234 x.Init(buf, n + offset) 5235 return x 5236 5237 @classmethod 5238 def ModelBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 5239 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 5240 5241 # Model 5242 def Init(self, buf, pos): 5243 self._tab = flatbuffers.table.Table(buf, pos) 5244 5245 # Model 5246 def Version(self): 5247 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 5248 if o != 0: 5249 return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos) 5250 return 0 5251 5252 # Model 5253 def OperatorCodes(self, j): 5254 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 5255 if o != 0: 5256 x = self._tab.Vector(o) 5257 x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 5258 x = self._tab.Indirect(x) 5259 obj = OperatorCode() 5260 obj.Init(self._tab.Bytes, x) 5261 return obj 5262 return None 5263 5264 # Model 5265 def OperatorCodesLength(self): 5266 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 5267 if o != 0: 5268 return self._tab.VectorLen(o) 5269 return 0 5270 5271 # Model 5272 def OperatorCodesIsNone(self): 5273 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 5274 return o == 0 5275 5276 # Model 5277 def Subgraphs(self, j): 5278 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 5279 if o != 0: 5280 x = self._tab.Vector(o) 5281 x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 5282 x = self._tab.Indirect(x) 5283 obj = SubGraph() 5284 obj.Init(self._tab.Bytes, x) 5285 return obj 5286 return None 5287 5288 # Model 5289 def SubgraphsLength(self): 5290 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 5291 if o != 0: 5292 return self._tab.VectorLen(o) 5293 return 0 5294 5295 # Model 5296 def SubgraphsIsNone(self): 5297 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 5298 return o == 0 5299 5300 # Model 5301 def Description(self): 5302 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 5303 if o != 0: 5304 return self._tab.String(o + self._tab.Pos) 5305 return None 5306 5307 # Model 5308 def Buffers(self, j): 5309 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) 5310 if o != 0: 5311 x = self._tab.Vector(o) 5312 x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 5313 x = self._tab.Indirect(x) 5314 obj = Buffer() 5315 obj.Init(self._tab.Bytes, x) 5316 return obj 5317 return None 5318 5319 # Model 5320 def BuffersLength(self): 5321 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) 5322 if o != 0: 5323 return self._tab.VectorLen(o) 5324 return 0 5325 5326 # Model 5327 def BuffersIsNone(self): 5328 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) 5329 return o == 0 5330 5331 # Model 5332 def MetadataBuffer(self, j): 5333 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) 5334 if o != 0: 5335 a = self._tab.Vector(o) 5336 return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 5337 return 0 5338 5339 # Model 5340 def MetadataBufferAsNumpy(self): 5341 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) 5342 if o != 0: 5343 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) 5344 return 0 5345 5346 # Model 5347 def MetadataBufferLength(self): 5348 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) 5349 if o != 0: 5350 return self._tab.VectorLen(o) 5351 return 0 5352 5353 # Model 5354 def MetadataBufferIsNone(self): 5355 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) 5356 return o == 0 5357 5358 # Model 5359 def Metadata(self, j): 5360 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) 5361 if o != 0: 5362 x = self._tab.Vector(o) 5363 x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 5364 x = self._tab.Indirect(x) 5365 obj = Metadata() 5366 obj.Init(self._tab.Bytes, x) 5367 return obj 5368 return None 5369 5370 # Model 5371 def MetadataLength(self): 5372 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) 5373 if o != 0: 5374 return self._tab.VectorLen(o) 5375 return 0 5376 5377 # Model 5378 def MetadataIsNone(self): 5379 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) 5380 return o == 0 5381 5382def ModelStart(builder): builder.StartObject(7) 5383def ModelAddVersion(builder, version): builder.PrependUint32Slot(0, version, 0) 5384def ModelAddOperatorCodes(builder, operatorCodes): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(operatorCodes), 0) 5385def ModelStartOperatorCodesVector(builder, numElems): return builder.StartVector(4, numElems, 4) 5386def ModelAddSubgraphs(builder, subgraphs): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(subgraphs), 0) 5387def ModelStartSubgraphsVector(builder, numElems): return builder.StartVector(4, numElems, 4) 5388def ModelAddDescription(builder, description): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(description), 0) 5389def ModelAddBuffers(builder, buffers): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(buffers), 0) 5390def ModelStartBuffersVector(builder, numElems): return builder.StartVector(4, numElems, 4) 5391def ModelAddMetadataBuffer(builder, metadataBuffer): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(metadataBuffer), 0) 5392def ModelStartMetadataBufferVector(builder, numElems): return builder.StartVector(4, numElems, 4) 5393def ModelAddMetadata(builder, metadata): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(metadata), 0) 5394def ModelStartMetadataVector(builder, numElems): return builder.StartVector(4, numElems, 4) 5395def ModelEnd(builder): return builder.EndObject() 5396 5397try: 5398 from typing import List 5399except: 5400 pass 5401 5402class ModelT(object): 5403 5404 # ModelT 5405 def __init__(self): 5406 self.version = 0 # type: int 5407 self.operatorCodes = None # type: List[OperatorCodeT] 5408 self.subgraphs = None # type: List[SubGraphT] 5409 self.description = None # type: str 5410 self.buffers = None # type: List[BufferT] 5411 self.metadataBuffer = None # type: List[int] 5412 self.metadata = None # type: List[MetadataT] 5413 5414 @classmethod 5415 def InitFromBuf(cls, buf, pos): 5416 model = Model() 5417 model.Init(buf, pos) 5418 return cls.InitFromObj(model) 5419 5420 @classmethod 5421 def InitFromObj(cls, model): 5422 x = ModelT() 5423 x._UnPack(model) 5424 return x 5425 5426 # ModelT 5427 def _UnPack(self, model): 5428 if model is None: 5429 return 5430 self.version = model.Version() 5431 if not model.OperatorCodesIsNone(): 5432 self.operatorCodes = [] 5433 for i in range(model.OperatorCodesLength()): 5434 if model.OperatorCodes(i) is None: 5435 self.operatorCodes.append(None) 5436 else: 5437 operatorCode_ = OperatorCodeT.InitFromObj(model.OperatorCodes(i)) 5438 self.operatorCodes.append(operatorCode_) 5439 if not model.SubgraphsIsNone(): 5440 self.subgraphs = [] 5441 for i in range(model.SubgraphsLength()): 5442 if model.Subgraphs(i) is None: 5443 self.subgraphs.append(None) 5444 else: 5445 subGraph_ = SubGraphT.InitFromObj(model.Subgraphs(i)) 5446 self.subgraphs.append(subGraph_) 5447 self.description = model.Description() 5448 if not model.BuffersIsNone(): 5449 self.buffers = [] 5450 for i in range(model.BuffersLength()): 5451 if model.Buffers(i) is None: 5452 self.buffers.append(None) 5453 else: 5454 buffer_ = BufferT.InitFromObj(model.Buffers(i)) 5455 self.buffers.append(buffer_) 5456 if not model.MetadataBufferIsNone(): 5457 if np is None: 5458 self.metadataBuffer = [] 5459 for i in range(model.MetadataBufferLength()): 5460 self.metadataBuffer.append(model.MetadataBuffer(i)) 5461 else: 5462 self.metadataBuffer = model.MetadataBufferAsNumpy() 5463 if not model.MetadataIsNone(): 5464 self.metadata = [] 5465 for i in range(model.MetadataLength()): 5466 if model.Metadata(i) is None: 5467 self.metadata.append(None) 5468 else: 5469 metadata_ = MetadataT.InitFromObj(model.Metadata(i)) 5470 self.metadata.append(metadata_) 5471 5472 # ModelT 5473 def Pack(self, builder): 5474 if self.operatorCodes is not None: 5475 operatorCodeslist = [] 5476 for i in range(len(self.operatorCodes)): 5477 operatorCodeslist.append(self.operatorCodes[i].Pack(builder)) 5478 ModelStartOperatorCodesVector(builder, len(self.operatorCodes)) 5479 for i in reversed(range(len(self.operatorCodes))): 5480 builder.PrependUOffsetTRelative(operatorCodeslist[i]) 5481 operatorCodes = builder.EndVector(len(self.operatorCodes)) 5482 if self.subgraphs is not None: 5483 subgraphslist = [] 5484 for i in range(len(self.subgraphs)): 5485 subgraphslist.append(self.subgraphs[i].Pack(builder)) 5486 ModelStartSubgraphsVector(builder, len(self.subgraphs)) 5487 for i in reversed(range(len(self.subgraphs))): 5488 builder.PrependUOffsetTRelative(subgraphslist[i]) 5489 subgraphs = builder.EndVector(len(self.subgraphs)) 5490 if self.description is not None: 5491 description = builder.CreateString(self.description) 5492 if self.buffers is not None: 5493 bufferslist = [] 5494 for i in range(len(self.buffers)): 5495 bufferslist.append(self.buffers[i].Pack(builder)) 5496 ModelStartBuffersVector(builder, len(self.buffers)) 5497 for i in reversed(range(len(self.buffers))): 5498 builder.PrependUOffsetTRelative(bufferslist[i]) 5499 buffers = builder.EndVector(len(self.buffers)) 5500 if self.metadataBuffer is not None: 5501 if np is not None and type(self.metadataBuffer) is np.ndarray: 5502 metadataBuffer = builder.CreateNumpyVector(self.metadataBuffer) 5503 else: 5504 ModelStartMetadataBufferVector(builder, len(self.metadataBuffer)) 5505 for i in reversed(range(len(self.metadataBuffer))): 5506 builder.PrependInt32(self.metadataBuffer[i]) 5507 metadataBuffer = builder.EndVector(len(self.metadataBuffer)) 5508 if self.metadata is not None: 5509 metadatalist = [] 5510 for i in range(len(self.metadata)): 5511 metadatalist.append(self.metadata[i].Pack(builder)) 5512 ModelStartMetadataVector(builder, len(self.metadata)) 5513 for i in reversed(range(len(self.metadata))): 5514 builder.PrependUOffsetTRelative(metadatalist[i]) 5515 metadata = builder.EndVector(len(self.metadata)) 5516 ModelStart(builder) 5517 ModelAddVersion(builder, self.version) 5518 if self.operatorCodes is not None: 5519 ModelAddOperatorCodes(builder, operatorCodes) 5520 if self.subgraphs is not None: 5521 ModelAddSubgraphs(builder, subgraphs) 5522 if self.description is not None: 5523 ModelAddDescription(builder, description) 5524 if self.buffers is not None: 5525 ModelAddBuffers(builder, buffers) 5526 if self.metadataBuffer is not None: 5527 ModelAddMetadataBuffer(builder, metadataBuffer) 5528 if self.metadata is not None: 5529 ModelAddMetadata(builder, metadata) 5530 model = ModelEnd(builder) 5531 return model 5532# automatically generated by the FlatBuffers compiler, do not modify 5533 5534# namespace: tflite 5535 5536from tflite_support.flatbuffers.compat import import_numpy 5537np = import_numpy() 5538 5539class MirrorPadOptions(object): 5540 __slots__ = ['_tab'] 5541 5542 @classmethod 5543 def GetRootAsMirrorPadOptions(cls, buf, offset): 5544 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 5545 x = MirrorPadOptions() 5546 x.Init(buf, n + offset) 5547 return x 5548 5549 @classmethod 5550 def MirrorPadOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 5551 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 5552 5553 # MirrorPadOptions 5554 def Init(self, buf, pos): 5555 self._tab = flatbuffers.table.Table(buf, pos) 5556 5557 # MirrorPadOptions 5558 def Mode(self): 5559 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 5560 if o != 0: 5561 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 5562 return 0 5563 5564def MirrorPadOptionsStart(builder): builder.StartObject(1) 5565def MirrorPadOptionsAddMode(builder, mode): builder.PrependInt8Slot(0, mode, 0) 5566def MirrorPadOptionsEnd(builder): return builder.EndObject() 5567 5568 5569class MirrorPadOptionsT(object): 5570 5571 # MirrorPadOptionsT 5572 def __init__(self): 5573 self.mode = 0 # type: int 5574 5575 @classmethod 5576 def InitFromBuf(cls, buf, pos): 5577 mirrorPadOptions = MirrorPadOptions() 5578 mirrorPadOptions.Init(buf, pos) 5579 return cls.InitFromObj(mirrorPadOptions) 5580 5581 @classmethod 5582 def InitFromObj(cls, mirrorPadOptions): 5583 x = MirrorPadOptionsT() 5584 x._UnPack(mirrorPadOptions) 5585 return x 5586 5587 # MirrorPadOptionsT 5588 def _UnPack(self, mirrorPadOptions): 5589 if mirrorPadOptions is None: 5590 return 5591 self.mode = mirrorPadOptions.Mode() 5592 5593 # MirrorPadOptionsT 5594 def Pack(self, builder): 5595 MirrorPadOptionsStart(builder) 5596 MirrorPadOptionsAddMode(builder, self.mode) 5597 mirrorPadOptions = MirrorPadOptionsEnd(builder) 5598 return mirrorPadOptions 5599# automatically generated by the FlatBuffers compiler, do not modify 5600 5601# namespace: tflite 5602 5603class MirrorPadMode(object): 5604 REFLECT = 0 5605 SYMMETRIC = 1 5606 5607# automatically generated by the FlatBuffers compiler, do not modify 5608 5609# namespace: tflite 5610 5611from tflite_support.flatbuffers.compat import import_numpy 5612np = import_numpy() 5613 5614class Metadata(object): 5615 __slots__ = ['_tab'] 5616 5617 @classmethod 5618 def GetRootAsMetadata(cls, buf, offset): 5619 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 5620 x = Metadata() 5621 x.Init(buf, n + offset) 5622 return x 5623 5624 @classmethod 5625 def MetadataBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 5626 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 5627 5628 # Metadata 5629 def Init(self, buf, pos): 5630 self._tab = flatbuffers.table.Table(buf, pos) 5631 5632 # Metadata 5633 def Name(self): 5634 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 5635 if o != 0: 5636 return self._tab.String(o + self._tab.Pos) 5637 return None 5638 5639 # Metadata 5640 def Buffer(self): 5641 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 5642 if o != 0: 5643 return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos) 5644 return 0 5645 5646def MetadataStart(builder): builder.StartObject(2) 5647def MetadataAddName(builder, name): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0) 5648def MetadataAddBuffer(builder, buffer): builder.PrependUint32Slot(1, buffer, 0) 5649def MetadataEnd(builder): return builder.EndObject() 5650 5651 5652class MetadataT(object): 5653 5654 # MetadataT 5655 def __init__(self): 5656 self.name = None # type: str 5657 self.buffer = 0 # type: int 5658 5659 @classmethod 5660 def InitFromBuf(cls, buf, pos): 5661 metadata = Metadata() 5662 metadata.Init(buf, pos) 5663 return cls.InitFromObj(metadata) 5664 5665 @classmethod 5666 def InitFromObj(cls, metadata): 5667 x = MetadataT() 5668 x._UnPack(metadata) 5669 return x 5670 5671 # MetadataT 5672 def _UnPack(self, metadata): 5673 if metadata is None: 5674 return 5675 self.name = metadata.Name() 5676 self.buffer = metadata.Buffer() 5677 5678 # MetadataT 5679 def Pack(self, builder): 5680 if self.name is not None: 5681 name = builder.CreateString(self.name) 5682 MetadataStart(builder) 5683 if self.name is not None: 5684 MetadataAddName(builder, name) 5685 MetadataAddBuffer(builder, self.buffer) 5686 metadata = MetadataEnd(builder) 5687 return metadata 5688# automatically generated by the FlatBuffers compiler, do not modify 5689 5690# namespace: tflite 5691 5692from tflite_support.flatbuffers.compat import import_numpy 5693np = import_numpy() 5694 5695class MaximumMinimumOptions(object): 5696 __slots__ = ['_tab'] 5697 5698 @classmethod 5699 def GetRootAsMaximumMinimumOptions(cls, buf, offset): 5700 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 5701 x = MaximumMinimumOptions() 5702 x.Init(buf, n + offset) 5703 return x 5704 5705 @classmethod 5706 def MaximumMinimumOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 5707 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 5708 5709 # MaximumMinimumOptions 5710 def Init(self, buf, pos): 5711 self._tab = flatbuffers.table.Table(buf, pos) 5712 5713def MaximumMinimumOptionsStart(builder): builder.StartObject(0) 5714def MaximumMinimumOptionsEnd(builder): return builder.EndObject() 5715 5716 5717class MaximumMinimumOptionsT(object): 5718 5719 # MaximumMinimumOptionsT 5720 def __init__(self): 5721 pass 5722 5723 @classmethod 5724 def InitFromBuf(cls, buf, pos): 5725 maximumMinimumOptions = MaximumMinimumOptions() 5726 maximumMinimumOptions.Init(buf, pos) 5727 return cls.InitFromObj(maximumMinimumOptions) 5728 5729 @classmethod 5730 def InitFromObj(cls, maximumMinimumOptions): 5731 x = MaximumMinimumOptionsT() 5732 x._UnPack(maximumMinimumOptions) 5733 return x 5734 5735 # MaximumMinimumOptionsT 5736 def _UnPack(self, maximumMinimumOptions): 5737 if maximumMinimumOptions is None: 5738 return 5739 5740 # MaximumMinimumOptionsT 5741 def Pack(self, builder): 5742 MaximumMinimumOptionsStart(builder) 5743 maximumMinimumOptions = MaximumMinimumOptionsEnd(builder) 5744 return maximumMinimumOptions 5745# automatically generated by the FlatBuffers compiler, do not modify 5746 5747# namespace: tflite 5748 5749from tflite_support.flatbuffers.compat import import_numpy 5750np = import_numpy() 5751 5752class MatrixSetDiagOptions(object): 5753 __slots__ = ['_tab'] 5754 5755 @classmethod 5756 def GetRootAsMatrixSetDiagOptions(cls, buf, offset): 5757 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 5758 x = MatrixSetDiagOptions() 5759 x.Init(buf, n + offset) 5760 return x 5761 5762 @classmethod 5763 def MatrixSetDiagOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 5764 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 5765 5766 # MatrixSetDiagOptions 5767 def Init(self, buf, pos): 5768 self._tab = flatbuffers.table.Table(buf, pos) 5769 5770def MatrixSetDiagOptionsStart(builder): builder.StartObject(0) 5771def MatrixSetDiagOptionsEnd(builder): return builder.EndObject() 5772 5773 5774class MatrixSetDiagOptionsT(object): 5775 5776 # MatrixSetDiagOptionsT 5777 def __init__(self): 5778 pass 5779 5780 @classmethod 5781 def InitFromBuf(cls, buf, pos): 5782 matrixSetDiagOptions = MatrixSetDiagOptions() 5783 matrixSetDiagOptions.Init(buf, pos) 5784 return cls.InitFromObj(matrixSetDiagOptions) 5785 5786 @classmethod 5787 def InitFromObj(cls, matrixSetDiagOptions): 5788 x = MatrixSetDiagOptionsT() 5789 x._UnPack(matrixSetDiagOptions) 5790 return x 5791 5792 # MatrixSetDiagOptionsT 5793 def _UnPack(self, matrixSetDiagOptions): 5794 if matrixSetDiagOptions is None: 5795 return 5796 5797 # MatrixSetDiagOptionsT 5798 def Pack(self, builder): 5799 MatrixSetDiagOptionsStart(builder) 5800 matrixSetDiagOptions = MatrixSetDiagOptionsEnd(builder) 5801 return matrixSetDiagOptions 5802# automatically generated by the FlatBuffers compiler, do not modify 5803 5804# namespace: tflite 5805 5806from tflite_support.flatbuffers.compat import import_numpy 5807np = import_numpy() 5808 5809class MatrixDiagOptions(object): 5810 __slots__ = ['_tab'] 5811 5812 @classmethod 5813 def GetRootAsMatrixDiagOptions(cls, buf, offset): 5814 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 5815 x = MatrixDiagOptions() 5816 x.Init(buf, n + offset) 5817 return x 5818 5819 @classmethod 5820 def MatrixDiagOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 5821 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 5822 5823 # MatrixDiagOptions 5824 def Init(self, buf, pos): 5825 self._tab = flatbuffers.table.Table(buf, pos) 5826 5827def MatrixDiagOptionsStart(builder): builder.StartObject(0) 5828def MatrixDiagOptionsEnd(builder): return builder.EndObject() 5829 5830 5831class MatrixDiagOptionsT(object): 5832 5833 # MatrixDiagOptionsT 5834 def __init__(self): 5835 pass 5836 5837 @classmethod 5838 def InitFromBuf(cls, buf, pos): 5839 matrixDiagOptions = MatrixDiagOptions() 5840 matrixDiagOptions.Init(buf, pos) 5841 return cls.InitFromObj(matrixDiagOptions) 5842 5843 @classmethod 5844 def InitFromObj(cls, matrixDiagOptions): 5845 x = MatrixDiagOptionsT() 5846 x._UnPack(matrixDiagOptions) 5847 return x 5848 5849 # MatrixDiagOptionsT 5850 def _UnPack(self, matrixDiagOptions): 5851 if matrixDiagOptions is None: 5852 return 5853 5854 # MatrixDiagOptionsT 5855 def Pack(self, builder): 5856 MatrixDiagOptionsStart(builder) 5857 matrixDiagOptions = MatrixDiagOptionsEnd(builder) 5858 return matrixDiagOptions 5859# automatically generated by the FlatBuffers compiler, do not modify 5860 5861# namespace: tflite 5862 5863from tflite_support.flatbuffers.compat import import_numpy 5864np = import_numpy() 5865 5866class LogicalOrOptions(object): 5867 __slots__ = ['_tab'] 5868 5869 @classmethod 5870 def GetRootAsLogicalOrOptions(cls, buf, offset): 5871 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 5872 x = LogicalOrOptions() 5873 x.Init(buf, n + offset) 5874 return x 5875 5876 @classmethod 5877 def LogicalOrOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 5878 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 5879 5880 # LogicalOrOptions 5881 def Init(self, buf, pos): 5882 self._tab = flatbuffers.table.Table(buf, pos) 5883 5884def LogicalOrOptionsStart(builder): builder.StartObject(0) 5885def LogicalOrOptionsEnd(builder): return builder.EndObject() 5886 5887 5888class LogicalOrOptionsT(object): 5889 5890 # LogicalOrOptionsT 5891 def __init__(self): 5892 pass 5893 5894 @classmethod 5895 def InitFromBuf(cls, buf, pos): 5896 logicalOrOptions = LogicalOrOptions() 5897 logicalOrOptions.Init(buf, pos) 5898 return cls.InitFromObj(logicalOrOptions) 5899 5900 @classmethod 5901 def InitFromObj(cls, logicalOrOptions): 5902 x = LogicalOrOptionsT() 5903 x._UnPack(logicalOrOptions) 5904 return x 5905 5906 # LogicalOrOptionsT 5907 def _UnPack(self, logicalOrOptions): 5908 if logicalOrOptions is None: 5909 return 5910 5911 # LogicalOrOptionsT 5912 def Pack(self, builder): 5913 LogicalOrOptionsStart(builder) 5914 logicalOrOptions = LogicalOrOptionsEnd(builder) 5915 return logicalOrOptions 5916# automatically generated by the FlatBuffers compiler, do not modify 5917 5918# namespace: tflite 5919 5920from tflite_support.flatbuffers.compat import import_numpy 5921np = import_numpy() 5922 5923class LogicalNotOptions(object): 5924 __slots__ = ['_tab'] 5925 5926 @classmethod 5927 def GetRootAsLogicalNotOptions(cls, buf, offset): 5928 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 5929 x = LogicalNotOptions() 5930 x.Init(buf, n + offset) 5931 return x 5932 5933 @classmethod 5934 def LogicalNotOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 5935 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 5936 5937 # LogicalNotOptions 5938 def Init(self, buf, pos): 5939 self._tab = flatbuffers.table.Table(buf, pos) 5940 5941def LogicalNotOptionsStart(builder): builder.StartObject(0) 5942def LogicalNotOptionsEnd(builder): return builder.EndObject() 5943 5944 5945class LogicalNotOptionsT(object): 5946 5947 # LogicalNotOptionsT 5948 def __init__(self): 5949 pass 5950 5951 @classmethod 5952 def InitFromBuf(cls, buf, pos): 5953 logicalNotOptions = LogicalNotOptions() 5954 logicalNotOptions.Init(buf, pos) 5955 return cls.InitFromObj(logicalNotOptions) 5956 5957 @classmethod 5958 def InitFromObj(cls, logicalNotOptions): 5959 x = LogicalNotOptionsT() 5960 x._UnPack(logicalNotOptions) 5961 return x 5962 5963 # LogicalNotOptionsT 5964 def _UnPack(self, logicalNotOptions): 5965 if logicalNotOptions is None: 5966 return 5967 5968 # LogicalNotOptionsT 5969 def Pack(self, builder): 5970 LogicalNotOptionsStart(builder) 5971 logicalNotOptions = LogicalNotOptionsEnd(builder) 5972 return logicalNotOptions 5973# automatically generated by the FlatBuffers compiler, do not modify 5974 5975# namespace: tflite 5976 5977from tflite_support.flatbuffers.compat import import_numpy 5978np = import_numpy() 5979 5980class LogicalAndOptions(object): 5981 __slots__ = ['_tab'] 5982 5983 @classmethod 5984 def GetRootAsLogicalAndOptions(cls, buf, offset): 5985 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 5986 x = LogicalAndOptions() 5987 x.Init(buf, n + offset) 5988 return x 5989 5990 @classmethod 5991 def LogicalAndOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 5992 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 5993 5994 # LogicalAndOptions 5995 def Init(self, buf, pos): 5996 self._tab = flatbuffers.table.Table(buf, pos) 5997 5998def LogicalAndOptionsStart(builder): builder.StartObject(0) 5999def LogicalAndOptionsEnd(builder): return builder.EndObject() 6000 6001 6002class LogicalAndOptionsT(object): 6003 6004 # LogicalAndOptionsT 6005 def __init__(self): 6006 pass 6007 6008 @classmethod 6009 def InitFromBuf(cls, buf, pos): 6010 logicalAndOptions = LogicalAndOptions() 6011 logicalAndOptions.Init(buf, pos) 6012 return cls.InitFromObj(logicalAndOptions) 6013 6014 @classmethod 6015 def InitFromObj(cls, logicalAndOptions): 6016 x = LogicalAndOptionsT() 6017 x._UnPack(logicalAndOptions) 6018 return x 6019 6020 # LogicalAndOptionsT 6021 def _UnPack(self, logicalAndOptions): 6022 if logicalAndOptions is None: 6023 return 6024 6025 # LogicalAndOptionsT 6026 def Pack(self, builder): 6027 LogicalAndOptionsStart(builder) 6028 logicalAndOptions = LogicalAndOptionsEnd(builder) 6029 return logicalAndOptions 6030# automatically generated by the FlatBuffers compiler, do not modify 6031 6032# namespace: tflite 6033 6034from tflite_support.flatbuffers.compat import import_numpy 6035np = import_numpy() 6036 6037class LogSoftmaxOptions(object): 6038 __slots__ = ['_tab'] 6039 6040 @classmethod 6041 def GetRootAsLogSoftmaxOptions(cls, buf, offset): 6042 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 6043 x = LogSoftmaxOptions() 6044 x.Init(buf, n + offset) 6045 return x 6046 6047 @classmethod 6048 def LogSoftmaxOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 6049 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 6050 6051 # LogSoftmaxOptions 6052 def Init(self, buf, pos): 6053 self._tab = flatbuffers.table.Table(buf, pos) 6054 6055def LogSoftmaxOptionsStart(builder): builder.StartObject(0) 6056def LogSoftmaxOptionsEnd(builder): return builder.EndObject() 6057 6058 6059class LogSoftmaxOptionsT(object): 6060 6061 # LogSoftmaxOptionsT 6062 def __init__(self): 6063 pass 6064 6065 @classmethod 6066 def InitFromBuf(cls, buf, pos): 6067 logSoftmaxOptions = LogSoftmaxOptions() 6068 logSoftmaxOptions.Init(buf, pos) 6069 return cls.InitFromObj(logSoftmaxOptions) 6070 6071 @classmethod 6072 def InitFromObj(cls, logSoftmaxOptions): 6073 x = LogSoftmaxOptionsT() 6074 x._UnPack(logSoftmaxOptions) 6075 return x 6076 6077 # LogSoftmaxOptionsT 6078 def _UnPack(self, logSoftmaxOptions): 6079 if logSoftmaxOptions is None: 6080 return 6081 6082 # LogSoftmaxOptionsT 6083 def Pack(self, builder): 6084 LogSoftmaxOptionsStart(builder) 6085 logSoftmaxOptions = LogSoftmaxOptionsEnd(builder) 6086 return logSoftmaxOptions 6087# automatically generated by the FlatBuffers compiler, do not modify 6088 6089# namespace: tflite 6090 6091from tflite_support.flatbuffers.compat import import_numpy 6092np = import_numpy() 6093 6094class LocalResponseNormalizationOptions(object): 6095 __slots__ = ['_tab'] 6096 6097 @classmethod 6098 def GetRootAsLocalResponseNormalizationOptions(cls, buf, offset): 6099 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 6100 x = LocalResponseNormalizationOptions() 6101 x.Init(buf, n + offset) 6102 return x 6103 6104 @classmethod 6105 def LocalResponseNormalizationOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 6106 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 6107 6108 # LocalResponseNormalizationOptions 6109 def Init(self, buf, pos): 6110 self._tab = flatbuffers.table.Table(buf, pos) 6111 6112 # LocalResponseNormalizationOptions 6113 def Radius(self): 6114 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 6115 if o != 0: 6116 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 6117 return 0 6118 6119 # LocalResponseNormalizationOptions 6120 def Bias(self): 6121 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 6122 if o != 0: 6123 return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) 6124 return 0.0 6125 6126 # LocalResponseNormalizationOptions 6127 def Alpha(self): 6128 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 6129 if o != 0: 6130 return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) 6131 return 0.0 6132 6133 # LocalResponseNormalizationOptions 6134 def Beta(self): 6135 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 6136 if o != 0: 6137 return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) 6138 return 0.0 6139 6140def LocalResponseNormalizationOptionsStart(builder): builder.StartObject(4) 6141def LocalResponseNormalizationOptionsAddRadius(builder, radius): builder.PrependInt32Slot(0, radius, 0) 6142def LocalResponseNormalizationOptionsAddBias(builder, bias): builder.PrependFloat32Slot(1, bias, 0.0) 6143def LocalResponseNormalizationOptionsAddAlpha(builder, alpha): builder.PrependFloat32Slot(2, alpha, 0.0) 6144def LocalResponseNormalizationOptionsAddBeta(builder, beta): builder.PrependFloat32Slot(3, beta, 0.0) 6145def LocalResponseNormalizationOptionsEnd(builder): return builder.EndObject() 6146 6147 6148class LocalResponseNormalizationOptionsT(object): 6149 6150 # LocalResponseNormalizationOptionsT 6151 def __init__(self): 6152 self.radius = 0 # type: int 6153 self.bias = 0.0 # type: float 6154 self.alpha = 0.0 # type: float 6155 self.beta = 0.0 # type: float 6156 6157 @classmethod 6158 def InitFromBuf(cls, buf, pos): 6159 localResponseNormalizationOptions = LocalResponseNormalizationOptions() 6160 localResponseNormalizationOptions.Init(buf, pos) 6161 return cls.InitFromObj(localResponseNormalizationOptions) 6162 6163 @classmethod 6164 def InitFromObj(cls, localResponseNormalizationOptions): 6165 x = LocalResponseNormalizationOptionsT() 6166 x._UnPack(localResponseNormalizationOptions) 6167 return x 6168 6169 # LocalResponseNormalizationOptionsT 6170 def _UnPack(self, localResponseNormalizationOptions): 6171 if localResponseNormalizationOptions is None: 6172 return 6173 self.radius = localResponseNormalizationOptions.Radius() 6174 self.bias = localResponseNormalizationOptions.Bias() 6175 self.alpha = localResponseNormalizationOptions.Alpha() 6176 self.beta = localResponseNormalizationOptions.Beta() 6177 6178 # LocalResponseNormalizationOptionsT 6179 def Pack(self, builder): 6180 LocalResponseNormalizationOptionsStart(builder) 6181 LocalResponseNormalizationOptionsAddRadius(builder, self.radius) 6182 LocalResponseNormalizationOptionsAddBias(builder, self.bias) 6183 LocalResponseNormalizationOptionsAddAlpha(builder, self.alpha) 6184 LocalResponseNormalizationOptionsAddBeta(builder, self.beta) 6185 localResponseNormalizationOptions = LocalResponseNormalizationOptionsEnd(builder) 6186 return localResponseNormalizationOptions 6187# automatically generated by the FlatBuffers compiler, do not modify 6188 6189# namespace: tflite 6190 6191from tflite_support.flatbuffers.compat import import_numpy 6192np = import_numpy() 6193 6194class LessOptions(object): 6195 __slots__ = ['_tab'] 6196 6197 @classmethod 6198 def GetRootAsLessOptions(cls, buf, offset): 6199 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 6200 x = LessOptions() 6201 x.Init(buf, n + offset) 6202 return x 6203 6204 @classmethod 6205 def LessOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 6206 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 6207 6208 # LessOptions 6209 def Init(self, buf, pos): 6210 self._tab = flatbuffers.table.Table(buf, pos) 6211 6212def LessOptionsStart(builder): builder.StartObject(0) 6213def LessOptionsEnd(builder): return builder.EndObject() 6214 6215 6216class LessOptionsT(object): 6217 6218 # LessOptionsT 6219 def __init__(self): 6220 pass 6221 6222 @classmethod 6223 def InitFromBuf(cls, buf, pos): 6224 lessOptions = LessOptions() 6225 lessOptions.Init(buf, pos) 6226 return cls.InitFromObj(lessOptions) 6227 6228 @classmethod 6229 def InitFromObj(cls, lessOptions): 6230 x = LessOptionsT() 6231 x._UnPack(lessOptions) 6232 return x 6233 6234 # LessOptionsT 6235 def _UnPack(self, lessOptions): 6236 if lessOptions is None: 6237 return 6238 6239 # LessOptionsT 6240 def Pack(self, builder): 6241 LessOptionsStart(builder) 6242 lessOptions = LessOptionsEnd(builder) 6243 return lessOptions 6244# automatically generated by the FlatBuffers compiler, do not modify 6245 6246# namespace: tflite 6247 6248from tflite_support.flatbuffers.compat import import_numpy 6249np = import_numpy() 6250 6251class LessEqualOptions(object): 6252 __slots__ = ['_tab'] 6253 6254 @classmethod 6255 def GetRootAsLessEqualOptions(cls, buf, offset): 6256 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 6257 x = LessEqualOptions() 6258 x.Init(buf, n + offset) 6259 return x 6260 6261 @classmethod 6262 def LessEqualOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 6263 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 6264 6265 # LessEqualOptions 6266 def Init(self, buf, pos): 6267 self._tab = flatbuffers.table.Table(buf, pos) 6268 6269def LessEqualOptionsStart(builder): builder.StartObject(0) 6270def LessEqualOptionsEnd(builder): return builder.EndObject() 6271 6272 6273class LessEqualOptionsT(object): 6274 6275 # LessEqualOptionsT 6276 def __init__(self): 6277 pass 6278 6279 @classmethod 6280 def InitFromBuf(cls, buf, pos): 6281 lessEqualOptions = LessEqualOptions() 6282 lessEqualOptions.Init(buf, pos) 6283 return cls.InitFromObj(lessEqualOptions) 6284 6285 @classmethod 6286 def InitFromObj(cls, lessEqualOptions): 6287 x = LessEqualOptionsT() 6288 x._UnPack(lessEqualOptions) 6289 return x 6290 6291 # LessEqualOptionsT 6292 def _UnPack(self, lessEqualOptions): 6293 if lessEqualOptions is None: 6294 return 6295 6296 # LessEqualOptionsT 6297 def Pack(self, builder): 6298 LessEqualOptionsStart(builder) 6299 lessEqualOptions = LessEqualOptionsEnd(builder) 6300 return lessEqualOptions 6301# automatically generated by the FlatBuffers compiler, do not modify 6302 6303# namespace: tflite 6304 6305from tflite_support.flatbuffers.compat import import_numpy 6306np = import_numpy() 6307 6308class LeakyReluOptions(object): 6309 __slots__ = ['_tab'] 6310 6311 @classmethod 6312 def GetRootAsLeakyReluOptions(cls, buf, offset): 6313 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 6314 x = LeakyReluOptions() 6315 x.Init(buf, n + offset) 6316 return x 6317 6318 @classmethod 6319 def LeakyReluOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 6320 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 6321 6322 # LeakyReluOptions 6323 def Init(self, buf, pos): 6324 self._tab = flatbuffers.table.Table(buf, pos) 6325 6326 # LeakyReluOptions 6327 def Alpha(self): 6328 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 6329 if o != 0: 6330 return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) 6331 return 0.0 6332 6333def LeakyReluOptionsStart(builder): builder.StartObject(1) 6334def LeakyReluOptionsAddAlpha(builder, alpha): builder.PrependFloat32Slot(0, alpha, 0.0) 6335def LeakyReluOptionsEnd(builder): return builder.EndObject() 6336 6337 6338class LeakyReluOptionsT(object): 6339 6340 # LeakyReluOptionsT 6341 def __init__(self): 6342 self.alpha = 0.0 # type: float 6343 6344 @classmethod 6345 def InitFromBuf(cls, buf, pos): 6346 leakyReluOptions = LeakyReluOptions() 6347 leakyReluOptions.Init(buf, pos) 6348 return cls.InitFromObj(leakyReluOptions) 6349 6350 @classmethod 6351 def InitFromObj(cls, leakyReluOptions): 6352 x = LeakyReluOptionsT() 6353 x._UnPack(leakyReluOptions) 6354 return x 6355 6356 # LeakyReluOptionsT 6357 def _UnPack(self, leakyReluOptions): 6358 if leakyReluOptions is None: 6359 return 6360 self.alpha = leakyReluOptions.Alpha() 6361 6362 # LeakyReluOptionsT 6363 def Pack(self, builder): 6364 LeakyReluOptionsStart(builder) 6365 LeakyReluOptionsAddAlpha(builder, self.alpha) 6366 leakyReluOptions = LeakyReluOptionsEnd(builder) 6367 return leakyReluOptions 6368# automatically generated by the FlatBuffers compiler, do not modify 6369 6370# namespace: tflite 6371 6372from tflite_support.flatbuffers.compat import import_numpy 6373np = import_numpy() 6374 6375class LSTMOptions(object): 6376 __slots__ = ['_tab'] 6377 6378 @classmethod 6379 def GetRootAsLSTMOptions(cls, buf, offset): 6380 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 6381 x = LSTMOptions() 6382 x.Init(buf, n + offset) 6383 return x 6384 6385 @classmethod 6386 def LSTMOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 6387 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 6388 6389 # LSTMOptions 6390 def Init(self, buf, pos): 6391 self._tab = flatbuffers.table.Table(buf, pos) 6392 6393 # LSTMOptions 6394 def FusedActivationFunction(self): 6395 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 6396 if o != 0: 6397 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 6398 return 0 6399 6400 # LSTMOptions 6401 def CellClip(self): 6402 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 6403 if o != 0: 6404 return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) 6405 return 0.0 6406 6407 # LSTMOptions 6408 def ProjClip(self): 6409 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 6410 if o != 0: 6411 return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) 6412 return 0.0 6413 6414 # LSTMOptions 6415 def KernelType(self): 6416 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 6417 if o != 0: 6418 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 6419 return 0 6420 6421def LSTMOptionsStart(builder): builder.StartObject(4) 6422def LSTMOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0) 6423def LSTMOptionsAddCellClip(builder, cellClip): builder.PrependFloat32Slot(1, cellClip, 0.0) 6424def LSTMOptionsAddProjClip(builder, projClip): builder.PrependFloat32Slot(2, projClip, 0.0) 6425def LSTMOptionsAddKernelType(builder, kernelType): builder.PrependInt8Slot(3, kernelType, 0) 6426def LSTMOptionsEnd(builder): return builder.EndObject() 6427 6428 6429class LSTMOptionsT(object): 6430 6431 # LSTMOptionsT 6432 def __init__(self): 6433 self.fusedActivationFunction = 0 # type: int 6434 self.cellClip = 0.0 # type: float 6435 self.projClip = 0.0 # type: float 6436 self.kernelType = 0 # type: int 6437 6438 @classmethod 6439 def InitFromBuf(cls, buf, pos): 6440 lSTMOptions = LSTMOptions() 6441 lSTMOptions.Init(buf, pos) 6442 return cls.InitFromObj(lSTMOptions) 6443 6444 @classmethod 6445 def InitFromObj(cls, lSTMOptions): 6446 x = LSTMOptionsT() 6447 x._UnPack(lSTMOptions) 6448 return x 6449 6450 # LSTMOptionsT 6451 def _UnPack(self, lSTMOptions): 6452 if lSTMOptions is None: 6453 return 6454 self.fusedActivationFunction = lSTMOptions.FusedActivationFunction() 6455 self.cellClip = lSTMOptions.CellClip() 6456 self.projClip = lSTMOptions.ProjClip() 6457 self.kernelType = lSTMOptions.KernelType() 6458 6459 # LSTMOptionsT 6460 def Pack(self, builder): 6461 LSTMOptionsStart(builder) 6462 LSTMOptionsAddFusedActivationFunction(builder, self.fusedActivationFunction) 6463 LSTMOptionsAddCellClip(builder, self.cellClip) 6464 LSTMOptionsAddProjClip(builder, self.projClip) 6465 LSTMOptionsAddKernelType(builder, self.kernelType) 6466 lSTMOptions = LSTMOptionsEnd(builder) 6467 return lSTMOptions 6468# automatically generated by the FlatBuffers compiler, do not modify 6469 6470# namespace: tflite 6471 6472class LSTMKernelType(object): 6473 FULL = 0 6474 BASIC = 1 6475 6476# automatically generated by the FlatBuffers compiler, do not modify 6477 6478# namespace: tflite 6479 6480class LSHProjectionType(object): 6481 UNKNOWN = 0 6482 SPARSE = 1 6483 DENSE = 2 6484 6485# automatically generated by the FlatBuffers compiler, do not modify 6486 6487# namespace: tflite 6488 6489from tflite_support.flatbuffers.compat import import_numpy 6490np = import_numpy() 6491 6492class LSHProjectionOptions(object): 6493 __slots__ = ['_tab'] 6494 6495 @classmethod 6496 def GetRootAsLSHProjectionOptions(cls, buf, offset): 6497 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 6498 x = LSHProjectionOptions() 6499 x.Init(buf, n + offset) 6500 return x 6501 6502 @classmethod 6503 def LSHProjectionOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 6504 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 6505 6506 # LSHProjectionOptions 6507 def Init(self, buf, pos): 6508 self._tab = flatbuffers.table.Table(buf, pos) 6509 6510 # LSHProjectionOptions 6511 def Type(self): 6512 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 6513 if o != 0: 6514 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 6515 return 0 6516 6517def LSHProjectionOptionsStart(builder): builder.StartObject(1) 6518def LSHProjectionOptionsAddType(builder, type): builder.PrependInt8Slot(0, type, 0) 6519def LSHProjectionOptionsEnd(builder): return builder.EndObject() 6520 6521 6522class LSHProjectionOptionsT(object): 6523 6524 # LSHProjectionOptionsT 6525 def __init__(self): 6526 self.type = 0 # type: int 6527 6528 @classmethod 6529 def InitFromBuf(cls, buf, pos): 6530 lSHProjectionOptions = LSHProjectionOptions() 6531 lSHProjectionOptions.Init(buf, pos) 6532 return cls.InitFromObj(lSHProjectionOptions) 6533 6534 @classmethod 6535 def InitFromObj(cls, lSHProjectionOptions): 6536 x = LSHProjectionOptionsT() 6537 x._UnPack(lSHProjectionOptions) 6538 return x 6539 6540 # LSHProjectionOptionsT 6541 def _UnPack(self, lSHProjectionOptions): 6542 if lSHProjectionOptions is None: 6543 return 6544 self.type = lSHProjectionOptions.Type() 6545 6546 # LSHProjectionOptionsT 6547 def Pack(self, builder): 6548 LSHProjectionOptionsStart(builder) 6549 LSHProjectionOptionsAddType(builder, self.type) 6550 lSHProjectionOptions = LSHProjectionOptionsEnd(builder) 6551 return lSHProjectionOptions 6552# automatically generated by the FlatBuffers compiler, do not modify 6553 6554# namespace: tflite 6555 6556from tflite_support.flatbuffers.compat import import_numpy 6557np = import_numpy() 6558 6559class L2NormOptions(object): 6560 __slots__ = ['_tab'] 6561 6562 @classmethod 6563 def GetRootAsL2NormOptions(cls, buf, offset): 6564 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 6565 x = L2NormOptions() 6566 x.Init(buf, n + offset) 6567 return x 6568 6569 @classmethod 6570 def L2NormOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 6571 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 6572 6573 # L2NormOptions 6574 def Init(self, buf, pos): 6575 self._tab = flatbuffers.table.Table(buf, pos) 6576 6577 # L2NormOptions 6578 def FusedActivationFunction(self): 6579 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 6580 if o != 0: 6581 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 6582 return 0 6583 6584def L2NormOptionsStart(builder): builder.StartObject(1) 6585def L2NormOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0) 6586def L2NormOptionsEnd(builder): return builder.EndObject() 6587 6588 6589class L2NormOptionsT(object): 6590 6591 # L2NormOptionsT 6592 def __init__(self): 6593 self.fusedActivationFunction = 0 # type: int 6594 6595 @classmethod 6596 def InitFromBuf(cls, buf, pos): 6597 l2NormOptions = L2NormOptions() 6598 l2NormOptions.Init(buf, pos) 6599 return cls.InitFromObj(l2NormOptions) 6600 6601 @classmethod 6602 def InitFromObj(cls, l2NormOptions): 6603 x = L2NormOptionsT() 6604 x._UnPack(l2NormOptions) 6605 return x 6606 6607 # L2NormOptionsT 6608 def _UnPack(self, l2NormOptions): 6609 if l2NormOptions is None: 6610 return 6611 self.fusedActivationFunction = l2NormOptions.FusedActivationFunction() 6612 6613 # L2NormOptionsT 6614 def Pack(self, builder): 6615 L2NormOptionsStart(builder) 6616 L2NormOptionsAddFusedActivationFunction(builder, self.fusedActivationFunction) 6617 l2NormOptions = L2NormOptionsEnd(builder) 6618 return l2NormOptions 6619# automatically generated by the FlatBuffers compiler, do not modify 6620 6621# namespace: tflite 6622 6623from tflite_support.flatbuffers.compat import import_numpy 6624np = import_numpy() 6625 6626class Int32Vector(object): 6627 __slots__ = ['_tab'] 6628 6629 @classmethod 6630 def GetRootAsInt32Vector(cls, buf, offset): 6631 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 6632 x = Int32Vector() 6633 x.Init(buf, n + offset) 6634 return x 6635 6636 @classmethod 6637 def Int32VectorBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 6638 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 6639 6640 # Int32Vector 6641 def Init(self, buf, pos): 6642 self._tab = flatbuffers.table.Table(buf, pos) 6643 6644 # Int32Vector 6645 def Values(self, j): 6646 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 6647 if o != 0: 6648 a = self._tab.Vector(o) 6649 return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 6650 return 0 6651 6652 # Int32Vector 6653 def ValuesAsNumpy(self): 6654 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 6655 if o != 0: 6656 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) 6657 return 0 6658 6659 # Int32Vector 6660 def ValuesLength(self): 6661 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 6662 if o != 0: 6663 return self._tab.VectorLen(o) 6664 return 0 6665 6666 # Int32Vector 6667 def ValuesIsNone(self): 6668 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 6669 return o == 0 6670 6671def Int32VectorStart(builder): builder.StartObject(1) 6672def Int32VectorAddValues(builder, values): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(values), 0) 6673def Int32VectorStartValuesVector(builder, numElems): return builder.StartVector(4, numElems, 4) 6674def Int32VectorEnd(builder): return builder.EndObject() 6675 6676try: 6677 from typing import List 6678except: 6679 pass 6680 6681class Int32VectorT(object): 6682 6683 # Int32VectorT 6684 def __init__(self): 6685 self.values = None # type: List[int] 6686 6687 @classmethod 6688 def InitFromBuf(cls, buf, pos): 6689 int32Vector = Int32Vector() 6690 int32Vector.Init(buf, pos) 6691 return cls.InitFromObj(int32Vector) 6692 6693 @classmethod 6694 def InitFromObj(cls, int32Vector): 6695 x = Int32VectorT() 6696 x._UnPack(int32Vector) 6697 return x 6698 6699 # Int32VectorT 6700 def _UnPack(self, int32Vector): 6701 if int32Vector is None: 6702 return 6703 if not int32Vector.ValuesIsNone(): 6704 if np is None: 6705 self.values = [] 6706 for i in range(int32Vector.ValuesLength()): 6707 self.values.append(int32Vector.Values(i)) 6708 else: 6709 self.values = int32Vector.ValuesAsNumpy() 6710 6711 # Int32VectorT 6712 def Pack(self, builder): 6713 if self.values is not None: 6714 if np is not None and type(self.values) is np.ndarray: 6715 values = builder.CreateNumpyVector(self.values) 6716 else: 6717 Int32VectorStartValuesVector(builder, len(self.values)) 6718 for i in reversed(range(len(self.values))): 6719 builder.PrependInt32(self.values[i]) 6720 values = builder.EndVector(len(self.values)) 6721 Int32VectorStart(builder) 6722 if self.values is not None: 6723 Int32VectorAddValues(builder, values) 6724 int32Vector = Int32VectorEnd(builder) 6725 return int32Vector 6726# automatically generated by the FlatBuffers compiler, do not modify 6727 6728# namespace: tflite 6729 6730from tflite_support.flatbuffers.compat import import_numpy 6731np = import_numpy() 6732 6733class IfOptions(object): 6734 __slots__ = ['_tab'] 6735 6736 @classmethod 6737 def GetRootAsIfOptions(cls, buf, offset): 6738 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 6739 x = IfOptions() 6740 x.Init(buf, n + offset) 6741 return x 6742 6743 @classmethod 6744 def IfOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 6745 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 6746 6747 # IfOptions 6748 def Init(self, buf, pos): 6749 self._tab = flatbuffers.table.Table(buf, pos) 6750 6751 # IfOptions 6752 def ThenSubgraphIndex(self): 6753 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 6754 if o != 0: 6755 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 6756 return 0 6757 6758 # IfOptions 6759 def ElseSubgraphIndex(self): 6760 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 6761 if o != 0: 6762 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 6763 return 0 6764 6765def IfOptionsStart(builder): builder.StartObject(2) 6766def IfOptionsAddThenSubgraphIndex(builder, thenSubgraphIndex): builder.PrependInt32Slot(0, thenSubgraphIndex, 0) 6767def IfOptionsAddElseSubgraphIndex(builder, elseSubgraphIndex): builder.PrependInt32Slot(1, elseSubgraphIndex, 0) 6768def IfOptionsEnd(builder): return builder.EndObject() 6769 6770 6771class IfOptionsT(object): 6772 6773 # IfOptionsT 6774 def __init__(self): 6775 self.thenSubgraphIndex = 0 # type: int 6776 self.elseSubgraphIndex = 0 # type: int 6777 6778 @classmethod 6779 def InitFromBuf(cls, buf, pos): 6780 ifOptions = IfOptions() 6781 ifOptions.Init(buf, pos) 6782 return cls.InitFromObj(ifOptions) 6783 6784 @classmethod 6785 def InitFromObj(cls, ifOptions): 6786 x = IfOptionsT() 6787 x._UnPack(ifOptions) 6788 return x 6789 6790 # IfOptionsT 6791 def _UnPack(self, ifOptions): 6792 if ifOptions is None: 6793 return 6794 self.thenSubgraphIndex = ifOptions.ThenSubgraphIndex() 6795 self.elseSubgraphIndex = ifOptions.ElseSubgraphIndex() 6796 6797 # IfOptionsT 6798 def Pack(self, builder): 6799 IfOptionsStart(builder) 6800 IfOptionsAddThenSubgraphIndex(builder, self.thenSubgraphIndex) 6801 IfOptionsAddElseSubgraphIndex(builder, self.elseSubgraphIndex) 6802 ifOptions = IfOptionsEnd(builder) 6803 return ifOptions 6804# automatically generated by the FlatBuffers compiler, do not modify 6805 6806# namespace: tflite 6807 6808from tflite_support.flatbuffers.compat import import_numpy 6809np = import_numpy() 6810 6811class HardSwishOptions(object): 6812 __slots__ = ['_tab'] 6813 6814 @classmethod 6815 def GetRootAsHardSwishOptions(cls, buf, offset): 6816 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 6817 x = HardSwishOptions() 6818 x.Init(buf, n + offset) 6819 return x 6820 6821 @classmethod 6822 def HardSwishOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 6823 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 6824 6825 # HardSwishOptions 6826 def Init(self, buf, pos): 6827 self._tab = flatbuffers.table.Table(buf, pos) 6828 6829def HardSwishOptionsStart(builder): builder.StartObject(0) 6830def HardSwishOptionsEnd(builder): return builder.EndObject() 6831 6832 6833class HardSwishOptionsT(object): 6834 6835 # HardSwishOptionsT 6836 def __init__(self): 6837 pass 6838 6839 @classmethod 6840 def InitFromBuf(cls, buf, pos): 6841 hardSwishOptions = HardSwishOptions() 6842 hardSwishOptions.Init(buf, pos) 6843 return cls.InitFromObj(hardSwishOptions) 6844 6845 @classmethod 6846 def InitFromObj(cls, hardSwishOptions): 6847 x = HardSwishOptionsT() 6848 x._UnPack(hardSwishOptions) 6849 return x 6850 6851 # HardSwishOptionsT 6852 def _UnPack(self, hardSwishOptions): 6853 if hardSwishOptions is None: 6854 return 6855 6856 # HardSwishOptionsT 6857 def Pack(self, builder): 6858 HardSwishOptionsStart(builder) 6859 hardSwishOptions = HardSwishOptionsEnd(builder) 6860 return hardSwishOptions 6861# automatically generated by the FlatBuffers compiler, do not modify 6862 6863# namespace: tflite 6864 6865from tflite_support.flatbuffers.compat import import_numpy 6866np = import_numpy() 6867 6868class GreaterOptions(object): 6869 __slots__ = ['_tab'] 6870 6871 @classmethod 6872 def GetRootAsGreaterOptions(cls, buf, offset): 6873 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 6874 x = GreaterOptions() 6875 x.Init(buf, n + offset) 6876 return x 6877 6878 @classmethod 6879 def GreaterOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 6880 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 6881 6882 # GreaterOptions 6883 def Init(self, buf, pos): 6884 self._tab = flatbuffers.table.Table(buf, pos) 6885 6886def GreaterOptionsStart(builder): builder.StartObject(0) 6887def GreaterOptionsEnd(builder): return builder.EndObject() 6888 6889 6890class GreaterOptionsT(object): 6891 6892 # GreaterOptionsT 6893 def __init__(self): 6894 pass 6895 6896 @classmethod 6897 def InitFromBuf(cls, buf, pos): 6898 greaterOptions = GreaterOptions() 6899 greaterOptions.Init(buf, pos) 6900 return cls.InitFromObj(greaterOptions) 6901 6902 @classmethod 6903 def InitFromObj(cls, greaterOptions): 6904 x = GreaterOptionsT() 6905 x._UnPack(greaterOptions) 6906 return x 6907 6908 # GreaterOptionsT 6909 def _UnPack(self, greaterOptions): 6910 if greaterOptions is None: 6911 return 6912 6913 # GreaterOptionsT 6914 def Pack(self, builder): 6915 GreaterOptionsStart(builder) 6916 greaterOptions = GreaterOptionsEnd(builder) 6917 return greaterOptions 6918# automatically generated by the FlatBuffers compiler, do not modify 6919 6920# namespace: tflite 6921 6922from tflite_support.flatbuffers.compat import import_numpy 6923np = import_numpy() 6924 6925class GreaterEqualOptions(object): 6926 __slots__ = ['_tab'] 6927 6928 @classmethod 6929 def GetRootAsGreaterEqualOptions(cls, buf, offset): 6930 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 6931 x = GreaterEqualOptions() 6932 x.Init(buf, n + offset) 6933 return x 6934 6935 @classmethod 6936 def GreaterEqualOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 6937 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 6938 6939 # GreaterEqualOptions 6940 def Init(self, buf, pos): 6941 self._tab = flatbuffers.table.Table(buf, pos) 6942 6943def GreaterEqualOptionsStart(builder): builder.StartObject(0) 6944def GreaterEqualOptionsEnd(builder): return builder.EndObject() 6945 6946 6947class GreaterEqualOptionsT(object): 6948 6949 # GreaterEqualOptionsT 6950 def __init__(self): 6951 pass 6952 6953 @classmethod 6954 def InitFromBuf(cls, buf, pos): 6955 greaterEqualOptions = GreaterEqualOptions() 6956 greaterEqualOptions.Init(buf, pos) 6957 return cls.InitFromObj(greaterEqualOptions) 6958 6959 @classmethod 6960 def InitFromObj(cls, greaterEqualOptions): 6961 x = GreaterEqualOptionsT() 6962 x._UnPack(greaterEqualOptions) 6963 return x 6964 6965 # GreaterEqualOptionsT 6966 def _UnPack(self, greaterEqualOptions): 6967 if greaterEqualOptions is None: 6968 return 6969 6970 # GreaterEqualOptionsT 6971 def Pack(self, builder): 6972 GreaterEqualOptionsStart(builder) 6973 greaterEqualOptions = GreaterEqualOptionsEnd(builder) 6974 return greaterEqualOptions 6975# automatically generated by the FlatBuffers compiler, do not modify 6976 6977# namespace: tflite 6978 6979from tflite_support.flatbuffers.compat import import_numpy 6980np = import_numpy() 6981 6982class GatherOptions(object): 6983 __slots__ = ['_tab'] 6984 6985 @classmethod 6986 def GetRootAsGatherOptions(cls, buf, offset): 6987 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 6988 x = GatherOptions() 6989 x.Init(buf, n + offset) 6990 return x 6991 6992 @classmethod 6993 def GatherOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 6994 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 6995 6996 # GatherOptions 6997 def Init(self, buf, pos): 6998 self._tab = flatbuffers.table.Table(buf, pos) 6999 7000 # GatherOptions 7001 def Axis(self): 7002 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 7003 if o != 0: 7004 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 7005 return 0 7006 7007def GatherOptionsStart(builder): builder.StartObject(1) 7008def GatherOptionsAddAxis(builder, axis): builder.PrependInt32Slot(0, axis, 0) 7009def GatherOptionsEnd(builder): return builder.EndObject() 7010 7011 7012class GatherOptionsT(object): 7013 7014 # GatherOptionsT 7015 def __init__(self): 7016 self.axis = 0 # type: int 7017 7018 @classmethod 7019 def InitFromBuf(cls, buf, pos): 7020 gatherOptions = GatherOptions() 7021 gatherOptions.Init(buf, pos) 7022 return cls.InitFromObj(gatherOptions) 7023 7024 @classmethod 7025 def InitFromObj(cls, gatherOptions): 7026 x = GatherOptionsT() 7027 x._UnPack(gatherOptions) 7028 return x 7029 7030 # GatherOptionsT 7031 def _UnPack(self, gatherOptions): 7032 if gatherOptions is None: 7033 return 7034 self.axis = gatherOptions.Axis() 7035 7036 # GatherOptionsT 7037 def Pack(self, builder): 7038 GatherOptionsStart(builder) 7039 GatherOptionsAddAxis(builder, self.axis) 7040 gatherOptions = GatherOptionsEnd(builder) 7041 return gatherOptions 7042# automatically generated by the FlatBuffers compiler, do not modify 7043 7044# namespace: tflite 7045 7046from tflite_support.flatbuffers.compat import import_numpy 7047np = import_numpy() 7048 7049class GatherNdOptions(object): 7050 __slots__ = ['_tab'] 7051 7052 @classmethod 7053 def GetRootAsGatherNdOptions(cls, buf, offset): 7054 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 7055 x = GatherNdOptions() 7056 x.Init(buf, n + offset) 7057 return x 7058 7059 @classmethod 7060 def GatherNdOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 7061 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 7062 7063 # GatherNdOptions 7064 def Init(self, buf, pos): 7065 self._tab = flatbuffers.table.Table(buf, pos) 7066 7067def GatherNdOptionsStart(builder): builder.StartObject(0) 7068def GatherNdOptionsEnd(builder): return builder.EndObject() 7069 7070 7071class GatherNdOptionsT(object): 7072 7073 # GatherNdOptionsT 7074 def __init__(self): 7075 pass 7076 7077 @classmethod 7078 def InitFromBuf(cls, buf, pos): 7079 gatherNdOptions = GatherNdOptions() 7080 gatherNdOptions.Init(buf, pos) 7081 return cls.InitFromObj(gatherNdOptions) 7082 7083 @classmethod 7084 def InitFromObj(cls, gatherNdOptions): 7085 x = GatherNdOptionsT() 7086 x._UnPack(gatherNdOptions) 7087 return x 7088 7089 # GatherNdOptionsT 7090 def _UnPack(self, gatherNdOptions): 7091 if gatherNdOptions is None: 7092 return 7093 7094 # GatherNdOptionsT 7095 def Pack(self, builder): 7096 GatherNdOptionsStart(builder) 7097 gatherNdOptions = GatherNdOptionsEnd(builder) 7098 return gatherNdOptions 7099# automatically generated by the FlatBuffers compiler, do not modify 7100 7101# namespace: tflite 7102 7103class FullyConnectedOptionsWeightsFormat(object): 7104 DEFAULT = 0 7105 SHUFFLED4x16INT8 = 1 7106 7107# automatically generated by the FlatBuffers compiler, do not modify 7108 7109# namespace: tflite 7110 7111from tflite_support.flatbuffers.compat import import_numpy 7112np = import_numpy() 7113 7114class FullyConnectedOptions(object): 7115 __slots__ = ['_tab'] 7116 7117 @classmethod 7118 def GetRootAsFullyConnectedOptions(cls, buf, offset): 7119 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 7120 x = FullyConnectedOptions() 7121 x.Init(buf, n + offset) 7122 return x 7123 7124 @classmethod 7125 def FullyConnectedOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 7126 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 7127 7128 # FullyConnectedOptions 7129 def Init(self, buf, pos): 7130 self._tab = flatbuffers.table.Table(buf, pos) 7131 7132 # FullyConnectedOptions 7133 def FusedActivationFunction(self): 7134 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 7135 if o != 0: 7136 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 7137 return 0 7138 7139 # FullyConnectedOptions 7140 def WeightsFormat(self): 7141 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 7142 if o != 0: 7143 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 7144 return 0 7145 7146 # FullyConnectedOptions 7147 def KeepNumDims(self): 7148 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 7149 if o != 0: 7150 return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) 7151 return False 7152 7153def FullyConnectedOptionsStart(builder): builder.StartObject(3) 7154def FullyConnectedOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0) 7155def FullyConnectedOptionsAddWeightsFormat(builder, weightsFormat): builder.PrependInt8Slot(1, weightsFormat, 0) 7156def FullyConnectedOptionsAddKeepNumDims(builder, keepNumDims): builder.PrependBoolSlot(2, keepNumDims, 0) 7157def FullyConnectedOptionsEnd(builder): return builder.EndObject() 7158 7159 7160class FullyConnectedOptionsT(object): 7161 7162 # FullyConnectedOptionsT 7163 def __init__(self): 7164 self.fusedActivationFunction = 0 # type: int 7165 self.weightsFormat = 0 # type: int 7166 self.keepNumDims = False # type: bool 7167 7168 @classmethod 7169 def InitFromBuf(cls, buf, pos): 7170 fullyConnectedOptions = FullyConnectedOptions() 7171 fullyConnectedOptions.Init(buf, pos) 7172 return cls.InitFromObj(fullyConnectedOptions) 7173 7174 @classmethod 7175 def InitFromObj(cls, fullyConnectedOptions): 7176 x = FullyConnectedOptionsT() 7177 x._UnPack(fullyConnectedOptions) 7178 return x 7179 7180 # FullyConnectedOptionsT 7181 def _UnPack(self, fullyConnectedOptions): 7182 if fullyConnectedOptions is None: 7183 return 7184 self.fusedActivationFunction = fullyConnectedOptions.FusedActivationFunction() 7185 self.weightsFormat = fullyConnectedOptions.WeightsFormat() 7186 self.keepNumDims = fullyConnectedOptions.KeepNumDims() 7187 7188 # FullyConnectedOptionsT 7189 def Pack(self, builder): 7190 FullyConnectedOptionsStart(builder) 7191 FullyConnectedOptionsAddFusedActivationFunction(builder, self.fusedActivationFunction) 7192 FullyConnectedOptionsAddWeightsFormat(builder, self.weightsFormat) 7193 FullyConnectedOptionsAddKeepNumDims(builder, self.keepNumDims) 7194 fullyConnectedOptions = FullyConnectedOptionsEnd(builder) 7195 return fullyConnectedOptions 7196# automatically generated by the FlatBuffers compiler, do not modify 7197 7198# namespace: tflite 7199 7200from tflite_support.flatbuffers.compat import import_numpy 7201np = import_numpy() 7202 7203class FloorModOptions(object): 7204 __slots__ = ['_tab'] 7205 7206 @classmethod 7207 def GetRootAsFloorModOptions(cls, buf, offset): 7208 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 7209 x = FloorModOptions() 7210 x.Init(buf, n + offset) 7211 return x 7212 7213 @classmethod 7214 def FloorModOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 7215 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 7216 7217 # FloorModOptions 7218 def Init(self, buf, pos): 7219 self._tab = flatbuffers.table.Table(buf, pos) 7220 7221def FloorModOptionsStart(builder): builder.StartObject(0) 7222def FloorModOptionsEnd(builder): return builder.EndObject() 7223 7224 7225class FloorModOptionsT(object): 7226 7227 # FloorModOptionsT 7228 def __init__(self): 7229 pass 7230 7231 @classmethod 7232 def InitFromBuf(cls, buf, pos): 7233 floorModOptions = FloorModOptions() 7234 floorModOptions.Init(buf, pos) 7235 return cls.InitFromObj(floorModOptions) 7236 7237 @classmethod 7238 def InitFromObj(cls, floorModOptions): 7239 x = FloorModOptionsT() 7240 x._UnPack(floorModOptions) 7241 return x 7242 7243 # FloorModOptionsT 7244 def _UnPack(self, floorModOptions): 7245 if floorModOptions is None: 7246 return 7247 7248 # FloorModOptionsT 7249 def Pack(self, builder): 7250 FloorModOptionsStart(builder) 7251 floorModOptions = FloorModOptionsEnd(builder) 7252 return floorModOptions 7253# automatically generated by the FlatBuffers compiler, do not modify 7254 7255# namespace: tflite 7256 7257from tflite_support.flatbuffers.compat import import_numpy 7258np = import_numpy() 7259 7260class FloorDivOptions(object): 7261 __slots__ = ['_tab'] 7262 7263 @classmethod 7264 def GetRootAsFloorDivOptions(cls, buf, offset): 7265 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 7266 x = FloorDivOptions() 7267 x.Init(buf, n + offset) 7268 return x 7269 7270 @classmethod 7271 def FloorDivOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 7272 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 7273 7274 # FloorDivOptions 7275 def Init(self, buf, pos): 7276 self._tab = flatbuffers.table.Table(buf, pos) 7277 7278def FloorDivOptionsStart(builder): builder.StartObject(0) 7279def FloorDivOptionsEnd(builder): return builder.EndObject() 7280 7281 7282class FloorDivOptionsT(object): 7283 7284 # FloorDivOptionsT 7285 def __init__(self): 7286 pass 7287 7288 @classmethod 7289 def InitFromBuf(cls, buf, pos): 7290 floorDivOptions = FloorDivOptions() 7291 floorDivOptions.Init(buf, pos) 7292 return cls.InitFromObj(floorDivOptions) 7293 7294 @classmethod 7295 def InitFromObj(cls, floorDivOptions): 7296 x = FloorDivOptionsT() 7297 x._UnPack(floorDivOptions) 7298 return x 7299 7300 # FloorDivOptionsT 7301 def _UnPack(self, floorDivOptions): 7302 if floorDivOptions is None: 7303 return 7304 7305 # FloorDivOptionsT 7306 def Pack(self, builder): 7307 FloorDivOptionsStart(builder) 7308 floorDivOptions = FloorDivOptionsEnd(builder) 7309 return floorDivOptions 7310# automatically generated by the FlatBuffers compiler, do not modify 7311 7312# namespace: tflite 7313 7314from tflite_support.flatbuffers.compat import import_numpy 7315np = import_numpy() 7316 7317class FillOptions(object): 7318 __slots__ = ['_tab'] 7319 7320 @classmethod 7321 def GetRootAsFillOptions(cls, buf, offset): 7322 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 7323 x = FillOptions() 7324 x.Init(buf, n + offset) 7325 return x 7326 7327 @classmethod 7328 def FillOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 7329 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 7330 7331 # FillOptions 7332 def Init(self, buf, pos): 7333 self._tab = flatbuffers.table.Table(buf, pos) 7334 7335def FillOptionsStart(builder): builder.StartObject(0) 7336def FillOptionsEnd(builder): return builder.EndObject() 7337 7338 7339class FillOptionsT(object): 7340 7341 # FillOptionsT 7342 def __init__(self): 7343 pass 7344 7345 @classmethod 7346 def InitFromBuf(cls, buf, pos): 7347 fillOptions = FillOptions() 7348 fillOptions.Init(buf, pos) 7349 return cls.InitFromObj(fillOptions) 7350 7351 @classmethod 7352 def InitFromObj(cls, fillOptions): 7353 x = FillOptionsT() 7354 x._UnPack(fillOptions) 7355 return x 7356 7357 # FillOptionsT 7358 def _UnPack(self, fillOptions): 7359 if fillOptions is None: 7360 return 7361 7362 # FillOptionsT 7363 def Pack(self, builder): 7364 FillOptionsStart(builder) 7365 fillOptions = FillOptionsEnd(builder) 7366 return fillOptions 7367# automatically generated by the FlatBuffers compiler, do not modify 7368 7369# namespace: tflite 7370 7371from tflite_support.flatbuffers.compat import import_numpy 7372np = import_numpy() 7373 7374class FakeQuantOptions(object): 7375 __slots__ = ['_tab'] 7376 7377 @classmethod 7378 def GetRootAsFakeQuantOptions(cls, buf, offset): 7379 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 7380 x = FakeQuantOptions() 7381 x.Init(buf, n + offset) 7382 return x 7383 7384 @classmethod 7385 def FakeQuantOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 7386 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 7387 7388 # FakeQuantOptions 7389 def Init(self, buf, pos): 7390 self._tab = flatbuffers.table.Table(buf, pos) 7391 7392 # FakeQuantOptions 7393 def Min(self): 7394 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 7395 if o != 0: 7396 return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) 7397 return 0.0 7398 7399 # FakeQuantOptions 7400 def Max(self): 7401 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 7402 if o != 0: 7403 return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) 7404 return 0.0 7405 7406 # FakeQuantOptions 7407 def NumBits(self): 7408 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 7409 if o != 0: 7410 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 7411 return 0 7412 7413 # FakeQuantOptions 7414 def NarrowRange(self): 7415 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 7416 if o != 0: 7417 return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) 7418 return False 7419 7420def FakeQuantOptionsStart(builder): builder.StartObject(4) 7421def FakeQuantOptionsAddMin(builder, min): builder.PrependFloat32Slot(0, min, 0.0) 7422def FakeQuantOptionsAddMax(builder, max): builder.PrependFloat32Slot(1, max, 0.0) 7423def FakeQuantOptionsAddNumBits(builder, numBits): builder.PrependInt32Slot(2, numBits, 0) 7424def FakeQuantOptionsAddNarrowRange(builder, narrowRange): builder.PrependBoolSlot(3, narrowRange, 0) 7425def FakeQuantOptionsEnd(builder): return builder.EndObject() 7426 7427 7428class FakeQuantOptionsT(object): 7429 7430 # FakeQuantOptionsT 7431 def __init__(self): 7432 self.min = 0.0 # type: float 7433 self.max = 0.0 # type: float 7434 self.numBits = 0 # type: int 7435 self.narrowRange = False # type: bool 7436 7437 @classmethod 7438 def InitFromBuf(cls, buf, pos): 7439 fakeQuantOptions = FakeQuantOptions() 7440 fakeQuantOptions.Init(buf, pos) 7441 return cls.InitFromObj(fakeQuantOptions) 7442 7443 @classmethod 7444 def InitFromObj(cls, fakeQuantOptions): 7445 x = FakeQuantOptionsT() 7446 x._UnPack(fakeQuantOptions) 7447 return x 7448 7449 # FakeQuantOptionsT 7450 def _UnPack(self, fakeQuantOptions): 7451 if fakeQuantOptions is None: 7452 return 7453 self.min = fakeQuantOptions.Min() 7454 self.max = fakeQuantOptions.Max() 7455 self.numBits = fakeQuantOptions.NumBits() 7456 self.narrowRange = fakeQuantOptions.NarrowRange() 7457 7458 # FakeQuantOptionsT 7459 def Pack(self, builder): 7460 FakeQuantOptionsStart(builder) 7461 FakeQuantOptionsAddMin(builder, self.min) 7462 FakeQuantOptionsAddMax(builder, self.max) 7463 FakeQuantOptionsAddNumBits(builder, self.numBits) 7464 FakeQuantOptionsAddNarrowRange(builder, self.narrowRange) 7465 fakeQuantOptions = FakeQuantOptionsEnd(builder) 7466 return fakeQuantOptions 7467# automatically generated by the FlatBuffers compiler, do not modify 7468 7469# namespace: tflite 7470 7471from tflite_support.flatbuffers.compat import import_numpy 7472np = import_numpy() 7473 7474class ExpandDimsOptions(object): 7475 __slots__ = ['_tab'] 7476 7477 @classmethod 7478 def GetRootAsExpandDimsOptions(cls, buf, offset): 7479 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 7480 x = ExpandDimsOptions() 7481 x.Init(buf, n + offset) 7482 return x 7483 7484 @classmethod 7485 def ExpandDimsOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 7486 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 7487 7488 # ExpandDimsOptions 7489 def Init(self, buf, pos): 7490 self._tab = flatbuffers.table.Table(buf, pos) 7491 7492def ExpandDimsOptionsStart(builder): builder.StartObject(0) 7493def ExpandDimsOptionsEnd(builder): return builder.EndObject() 7494 7495 7496class ExpandDimsOptionsT(object): 7497 7498 # ExpandDimsOptionsT 7499 def __init__(self): 7500 pass 7501 7502 @classmethod 7503 def InitFromBuf(cls, buf, pos): 7504 expandDimsOptions = ExpandDimsOptions() 7505 expandDimsOptions.Init(buf, pos) 7506 return cls.InitFromObj(expandDimsOptions) 7507 7508 @classmethod 7509 def InitFromObj(cls, expandDimsOptions): 7510 x = ExpandDimsOptionsT() 7511 x._UnPack(expandDimsOptions) 7512 return x 7513 7514 # ExpandDimsOptionsT 7515 def _UnPack(self, expandDimsOptions): 7516 if expandDimsOptions is None: 7517 return 7518 7519 # ExpandDimsOptionsT 7520 def Pack(self, builder): 7521 ExpandDimsOptionsStart(builder) 7522 expandDimsOptions = ExpandDimsOptionsEnd(builder) 7523 return expandDimsOptions 7524# automatically generated by the FlatBuffers compiler, do not modify 7525 7526# namespace: tflite 7527 7528from tflite_support.flatbuffers.compat import import_numpy 7529np = import_numpy() 7530 7531class ExpOptions(object): 7532 __slots__ = ['_tab'] 7533 7534 @classmethod 7535 def GetRootAsExpOptions(cls, buf, offset): 7536 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 7537 x = ExpOptions() 7538 x.Init(buf, n + offset) 7539 return x 7540 7541 @classmethod 7542 def ExpOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 7543 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 7544 7545 # ExpOptions 7546 def Init(self, buf, pos): 7547 self._tab = flatbuffers.table.Table(buf, pos) 7548 7549def ExpOptionsStart(builder): builder.StartObject(0) 7550def ExpOptionsEnd(builder): return builder.EndObject() 7551 7552 7553class ExpOptionsT(object): 7554 7555 # ExpOptionsT 7556 def __init__(self): 7557 pass 7558 7559 @classmethod 7560 def InitFromBuf(cls, buf, pos): 7561 expOptions = ExpOptions() 7562 expOptions.Init(buf, pos) 7563 return cls.InitFromObj(expOptions) 7564 7565 @classmethod 7566 def InitFromObj(cls, expOptions): 7567 x = ExpOptionsT() 7568 x._UnPack(expOptions) 7569 return x 7570 7571 # ExpOptionsT 7572 def _UnPack(self, expOptions): 7573 if expOptions is None: 7574 return 7575 7576 # ExpOptionsT 7577 def Pack(self, builder): 7578 ExpOptionsStart(builder) 7579 expOptions = ExpOptionsEnd(builder) 7580 return expOptions 7581# automatically generated by the FlatBuffers compiler, do not modify 7582 7583# namespace: tflite 7584 7585from tflite_support.flatbuffers.compat import import_numpy 7586np = import_numpy() 7587 7588class EqualOptions(object): 7589 __slots__ = ['_tab'] 7590 7591 @classmethod 7592 def GetRootAsEqualOptions(cls, buf, offset): 7593 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 7594 x = EqualOptions() 7595 x.Init(buf, n + offset) 7596 return x 7597 7598 @classmethod 7599 def EqualOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 7600 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 7601 7602 # EqualOptions 7603 def Init(self, buf, pos): 7604 self._tab = flatbuffers.table.Table(buf, pos) 7605 7606def EqualOptionsStart(builder): builder.StartObject(0) 7607def EqualOptionsEnd(builder): return builder.EndObject() 7608 7609 7610class EqualOptionsT(object): 7611 7612 # EqualOptionsT 7613 def __init__(self): 7614 pass 7615 7616 @classmethod 7617 def InitFromBuf(cls, buf, pos): 7618 equalOptions = EqualOptions() 7619 equalOptions.Init(buf, pos) 7620 return cls.InitFromObj(equalOptions) 7621 7622 @classmethod 7623 def InitFromObj(cls, equalOptions): 7624 x = EqualOptionsT() 7625 x._UnPack(equalOptions) 7626 return x 7627 7628 # EqualOptionsT 7629 def _UnPack(self, equalOptions): 7630 if equalOptions is None: 7631 return 7632 7633 # EqualOptionsT 7634 def Pack(self, builder): 7635 EqualOptionsStart(builder) 7636 equalOptions = EqualOptionsEnd(builder) 7637 return equalOptions 7638# automatically generated by the FlatBuffers compiler, do not modify 7639 7640# namespace: tflite 7641 7642from tflite_support.flatbuffers.compat import import_numpy 7643np = import_numpy() 7644 7645class EmbeddingLookupSparseOptions(object): 7646 __slots__ = ['_tab'] 7647 7648 @classmethod 7649 def GetRootAsEmbeddingLookupSparseOptions(cls, buf, offset): 7650 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 7651 x = EmbeddingLookupSparseOptions() 7652 x.Init(buf, n + offset) 7653 return x 7654 7655 @classmethod 7656 def EmbeddingLookupSparseOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 7657 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 7658 7659 # EmbeddingLookupSparseOptions 7660 def Init(self, buf, pos): 7661 self._tab = flatbuffers.table.Table(buf, pos) 7662 7663 # EmbeddingLookupSparseOptions 7664 def Combiner(self): 7665 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 7666 if o != 0: 7667 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 7668 return 0 7669 7670def EmbeddingLookupSparseOptionsStart(builder): builder.StartObject(1) 7671def EmbeddingLookupSparseOptionsAddCombiner(builder, combiner): builder.PrependInt8Slot(0, combiner, 0) 7672def EmbeddingLookupSparseOptionsEnd(builder): return builder.EndObject() 7673 7674 7675class EmbeddingLookupSparseOptionsT(object): 7676 7677 # EmbeddingLookupSparseOptionsT 7678 def __init__(self): 7679 self.combiner = 0 # type: int 7680 7681 @classmethod 7682 def InitFromBuf(cls, buf, pos): 7683 embeddingLookupSparseOptions = EmbeddingLookupSparseOptions() 7684 embeddingLookupSparseOptions.Init(buf, pos) 7685 return cls.InitFromObj(embeddingLookupSparseOptions) 7686 7687 @classmethod 7688 def InitFromObj(cls, embeddingLookupSparseOptions): 7689 x = EmbeddingLookupSparseOptionsT() 7690 x._UnPack(embeddingLookupSparseOptions) 7691 return x 7692 7693 # EmbeddingLookupSparseOptionsT 7694 def _UnPack(self, embeddingLookupSparseOptions): 7695 if embeddingLookupSparseOptions is None: 7696 return 7697 self.combiner = embeddingLookupSparseOptions.Combiner() 7698 7699 # EmbeddingLookupSparseOptionsT 7700 def Pack(self, builder): 7701 EmbeddingLookupSparseOptionsStart(builder) 7702 EmbeddingLookupSparseOptionsAddCombiner(builder, self.combiner) 7703 embeddingLookupSparseOptions = EmbeddingLookupSparseOptionsEnd(builder) 7704 return embeddingLookupSparseOptions 7705# automatically generated by the FlatBuffers compiler, do not modify 7706 7707# namespace: tflite 7708 7709from tflite_support.flatbuffers.compat import import_numpy 7710np = import_numpy() 7711 7712class DivOptions(object): 7713 __slots__ = ['_tab'] 7714 7715 @classmethod 7716 def GetRootAsDivOptions(cls, buf, offset): 7717 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 7718 x = DivOptions() 7719 x.Init(buf, n + offset) 7720 return x 7721 7722 @classmethod 7723 def DivOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 7724 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 7725 7726 # DivOptions 7727 def Init(self, buf, pos): 7728 self._tab = flatbuffers.table.Table(buf, pos) 7729 7730 # DivOptions 7731 def FusedActivationFunction(self): 7732 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 7733 if o != 0: 7734 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 7735 return 0 7736 7737def DivOptionsStart(builder): builder.StartObject(1) 7738def DivOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0) 7739def DivOptionsEnd(builder): return builder.EndObject() 7740 7741 7742class DivOptionsT(object): 7743 7744 # DivOptionsT 7745 def __init__(self): 7746 self.fusedActivationFunction = 0 # type: int 7747 7748 @classmethod 7749 def InitFromBuf(cls, buf, pos): 7750 divOptions = DivOptions() 7751 divOptions.Init(buf, pos) 7752 return cls.InitFromObj(divOptions) 7753 7754 @classmethod 7755 def InitFromObj(cls, divOptions): 7756 x = DivOptionsT() 7757 x._UnPack(divOptions) 7758 return x 7759 7760 # DivOptionsT 7761 def _UnPack(self, divOptions): 7762 if divOptions is None: 7763 return 7764 self.fusedActivationFunction = divOptions.FusedActivationFunction() 7765 7766 # DivOptionsT 7767 def Pack(self, builder): 7768 DivOptionsStart(builder) 7769 DivOptionsAddFusedActivationFunction(builder, self.fusedActivationFunction) 7770 divOptions = DivOptionsEnd(builder) 7771 return divOptions 7772# automatically generated by the FlatBuffers compiler, do not modify 7773 7774# namespace: tflite 7775 7776class DimensionType(object): 7777 DENSE = 0 7778 SPARSE_CSR = 1 7779 7780# automatically generated by the FlatBuffers compiler, do not modify 7781 7782# namespace: tflite 7783 7784from tflite_support.flatbuffers.compat import import_numpy 7785np = import_numpy() 7786 7787class DimensionMetadata(object): 7788 __slots__ = ['_tab'] 7789 7790 @classmethod 7791 def GetRootAsDimensionMetadata(cls, buf, offset): 7792 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 7793 x = DimensionMetadata() 7794 x.Init(buf, n + offset) 7795 return x 7796 7797 @classmethod 7798 def DimensionMetadataBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 7799 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 7800 7801 # DimensionMetadata 7802 def Init(self, buf, pos): 7803 self._tab = flatbuffers.table.Table(buf, pos) 7804 7805 # DimensionMetadata 7806 def Format(self): 7807 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 7808 if o != 0: 7809 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 7810 return 0 7811 7812 # DimensionMetadata 7813 def DenseSize(self): 7814 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 7815 if o != 0: 7816 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 7817 return 0 7818 7819 # DimensionMetadata 7820 def ArraySegmentsType(self): 7821 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 7822 if o != 0: 7823 return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) 7824 return 0 7825 7826 # DimensionMetadata 7827 def ArraySegments(self): 7828 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 7829 if o != 0: 7830 from tflite_support.flatbuffers.table import Table 7831 obj = Table(bytearray(), 0) 7832 self._tab.Union(obj, o) 7833 return obj 7834 return None 7835 7836 # DimensionMetadata 7837 def ArrayIndicesType(self): 7838 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) 7839 if o != 0: 7840 return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) 7841 return 0 7842 7843 # DimensionMetadata 7844 def ArrayIndices(self): 7845 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) 7846 if o != 0: 7847 from tflite_support.flatbuffers.table import Table 7848 obj = Table(bytearray(), 0) 7849 self._tab.Union(obj, o) 7850 return obj 7851 return None 7852 7853def DimensionMetadataStart(builder): builder.StartObject(6) 7854def DimensionMetadataAddFormat(builder, format): builder.PrependInt8Slot(0, format, 0) 7855def DimensionMetadataAddDenseSize(builder, denseSize): builder.PrependInt32Slot(1, denseSize, 0) 7856def DimensionMetadataAddArraySegmentsType(builder, arraySegmentsType): builder.PrependUint8Slot(2, arraySegmentsType, 0) 7857def DimensionMetadataAddArraySegments(builder, arraySegments): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(arraySegments), 0) 7858def DimensionMetadataAddArrayIndicesType(builder, arrayIndicesType): builder.PrependUint8Slot(4, arrayIndicesType, 0) 7859def DimensionMetadataAddArrayIndices(builder, arrayIndices): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(arrayIndices), 0) 7860def DimensionMetadataEnd(builder): return builder.EndObject() 7861 7862try: 7863 from typing import Union 7864except: 7865 pass 7866 7867class DimensionMetadataT(object): 7868 7869 # DimensionMetadataT 7870 def __init__(self): 7871 self.format = 0 # type: int 7872 self.denseSize = 0 # type: int 7873 self.arraySegmentsType = 0 # type: int 7874 self.arraySegments = None # type: Union[None, Int32VectorT, Uint16VectorT, Uint8VectorT] 7875 self.arrayIndicesType = 0 # type: int 7876 self.arrayIndices = None # type: Union[None, Int32VectorT, Uint16VectorT, Uint8VectorT] 7877 7878 @classmethod 7879 def InitFromBuf(cls, buf, pos): 7880 dimensionMetadata = DimensionMetadata() 7881 dimensionMetadata.Init(buf, pos) 7882 return cls.InitFromObj(dimensionMetadata) 7883 7884 @classmethod 7885 def InitFromObj(cls, dimensionMetadata): 7886 x = DimensionMetadataT() 7887 x._UnPack(dimensionMetadata) 7888 return x 7889 7890 # DimensionMetadataT 7891 def _UnPack(self, dimensionMetadata): 7892 if dimensionMetadata is None: 7893 return 7894 self.format = dimensionMetadata.Format() 7895 self.denseSize = dimensionMetadata.DenseSize() 7896 self.arraySegmentsType = dimensionMetadata.ArraySegmentsType() 7897 self.arraySegments = SparseIndexVectorCreator(self.arraySegmentsType, dimensionMetadata.ArraySegments()) 7898 self.arrayIndicesType = dimensionMetadata.ArrayIndicesType() 7899 self.arrayIndices = SparseIndexVectorCreator(self.arrayIndicesType, dimensionMetadata.ArrayIndices()) 7900 7901 # DimensionMetadataT 7902 def Pack(self, builder): 7903 if self.arraySegments is not None: 7904 arraySegments = self.arraySegments.Pack(builder) 7905 if self.arrayIndices is not None: 7906 arrayIndices = self.arrayIndices.Pack(builder) 7907 DimensionMetadataStart(builder) 7908 DimensionMetadataAddFormat(builder, self.format) 7909 DimensionMetadataAddDenseSize(builder, self.denseSize) 7910 DimensionMetadataAddArraySegmentsType(builder, self.arraySegmentsType) 7911 if self.arraySegments is not None: 7912 DimensionMetadataAddArraySegments(builder, arraySegments) 7913 DimensionMetadataAddArrayIndicesType(builder, self.arrayIndicesType) 7914 if self.arrayIndices is not None: 7915 DimensionMetadataAddArrayIndices(builder, arrayIndices) 7916 dimensionMetadata = DimensionMetadataEnd(builder) 7917 return dimensionMetadata 7918# automatically generated by the FlatBuffers compiler, do not modify 7919 7920# namespace: tflite 7921 7922from tflite_support.flatbuffers.compat import import_numpy 7923np = import_numpy() 7924 7925class DequantizeOptions(object): 7926 __slots__ = ['_tab'] 7927 7928 @classmethod 7929 def GetRootAsDequantizeOptions(cls, buf, offset): 7930 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 7931 x = DequantizeOptions() 7932 x.Init(buf, n + offset) 7933 return x 7934 7935 @classmethod 7936 def DequantizeOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 7937 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 7938 7939 # DequantizeOptions 7940 def Init(self, buf, pos): 7941 self._tab = flatbuffers.table.Table(buf, pos) 7942 7943def DequantizeOptionsStart(builder): builder.StartObject(0) 7944def DequantizeOptionsEnd(builder): return builder.EndObject() 7945 7946 7947class DequantizeOptionsT(object): 7948 7949 # DequantizeOptionsT 7950 def __init__(self): 7951 pass 7952 7953 @classmethod 7954 def InitFromBuf(cls, buf, pos): 7955 dequantizeOptions = DequantizeOptions() 7956 dequantizeOptions.Init(buf, pos) 7957 return cls.InitFromObj(dequantizeOptions) 7958 7959 @classmethod 7960 def InitFromObj(cls, dequantizeOptions): 7961 x = DequantizeOptionsT() 7962 x._UnPack(dequantizeOptions) 7963 return x 7964 7965 # DequantizeOptionsT 7966 def _UnPack(self, dequantizeOptions): 7967 if dequantizeOptions is None: 7968 return 7969 7970 # DequantizeOptionsT 7971 def Pack(self, builder): 7972 DequantizeOptionsStart(builder) 7973 dequantizeOptions = DequantizeOptionsEnd(builder) 7974 return dequantizeOptions 7975# automatically generated by the FlatBuffers compiler, do not modify 7976 7977# namespace: tflite 7978 7979from tflite_support.flatbuffers.compat import import_numpy 7980np = import_numpy() 7981 7982class DepthwiseConv2DOptions(object): 7983 __slots__ = ['_tab'] 7984 7985 @classmethod 7986 def GetRootAsDepthwiseConv2DOptions(cls, buf, offset): 7987 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 7988 x = DepthwiseConv2DOptions() 7989 x.Init(buf, n + offset) 7990 return x 7991 7992 @classmethod 7993 def DepthwiseConv2DOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 7994 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 7995 7996 # DepthwiseConv2DOptions 7997 def Init(self, buf, pos): 7998 self._tab = flatbuffers.table.Table(buf, pos) 7999 8000 # DepthwiseConv2DOptions 8001 def Padding(self): 8002 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 8003 if o != 0: 8004 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 8005 return 0 8006 8007 # DepthwiseConv2DOptions 8008 def StrideW(self): 8009 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 8010 if o != 0: 8011 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 8012 return 0 8013 8014 # DepthwiseConv2DOptions 8015 def StrideH(self): 8016 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 8017 if o != 0: 8018 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 8019 return 0 8020 8021 # DepthwiseConv2DOptions 8022 def DepthMultiplier(self): 8023 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 8024 if o != 0: 8025 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 8026 return 0 8027 8028 # DepthwiseConv2DOptions 8029 def FusedActivationFunction(self): 8030 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) 8031 if o != 0: 8032 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 8033 return 0 8034 8035 # DepthwiseConv2DOptions 8036 def DilationWFactor(self): 8037 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) 8038 if o != 0: 8039 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 8040 return 1 8041 8042 # DepthwiseConv2DOptions 8043 def DilationHFactor(self): 8044 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) 8045 if o != 0: 8046 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 8047 return 1 8048 8049def DepthwiseConv2DOptionsStart(builder): builder.StartObject(7) 8050def DepthwiseConv2DOptionsAddPadding(builder, padding): builder.PrependInt8Slot(0, padding, 0) 8051def DepthwiseConv2DOptionsAddStrideW(builder, strideW): builder.PrependInt32Slot(1, strideW, 0) 8052def DepthwiseConv2DOptionsAddStrideH(builder, strideH): builder.PrependInt32Slot(2, strideH, 0) 8053def DepthwiseConv2DOptionsAddDepthMultiplier(builder, depthMultiplier): builder.PrependInt32Slot(3, depthMultiplier, 0) 8054def DepthwiseConv2DOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(4, fusedActivationFunction, 0) 8055def DepthwiseConv2DOptionsAddDilationWFactor(builder, dilationWFactor): builder.PrependInt32Slot(5, dilationWFactor, 1) 8056def DepthwiseConv2DOptionsAddDilationHFactor(builder, dilationHFactor): builder.PrependInt32Slot(6, dilationHFactor, 1) 8057def DepthwiseConv2DOptionsEnd(builder): return builder.EndObject() 8058 8059 8060class DepthwiseConv2DOptionsT(object): 8061 8062 # DepthwiseConv2DOptionsT 8063 def __init__(self): 8064 self.padding = 0 # type: int 8065 self.strideW = 0 # type: int 8066 self.strideH = 0 # type: int 8067 self.depthMultiplier = 0 # type: int 8068 self.fusedActivationFunction = 0 # type: int 8069 self.dilationWFactor = 1 # type: int 8070 self.dilationHFactor = 1 # type: int 8071 8072 @classmethod 8073 def InitFromBuf(cls, buf, pos): 8074 depthwiseConv2DOptions = DepthwiseConv2DOptions() 8075 depthwiseConv2DOptions.Init(buf, pos) 8076 return cls.InitFromObj(depthwiseConv2DOptions) 8077 8078 @classmethod 8079 def InitFromObj(cls, depthwiseConv2DOptions): 8080 x = DepthwiseConv2DOptionsT() 8081 x._UnPack(depthwiseConv2DOptions) 8082 return x 8083 8084 # DepthwiseConv2DOptionsT 8085 def _UnPack(self, depthwiseConv2DOptions): 8086 if depthwiseConv2DOptions is None: 8087 return 8088 self.padding = depthwiseConv2DOptions.Padding() 8089 self.strideW = depthwiseConv2DOptions.StrideW() 8090 self.strideH = depthwiseConv2DOptions.StrideH() 8091 self.depthMultiplier = depthwiseConv2DOptions.DepthMultiplier() 8092 self.fusedActivationFunction = depthwiseConv2DOptions.FusedActivationFunction() 8093 self.dilationWFactor = depthwiseConv2DOptions.DilationWFactor() 8094 self.dilationHFactor = depthwiseConv2DOptions.DilationHFactor() 8095 8096 # DepthwiseConv2DOptionsT 8097 def Pack(self, builder): 8098 DepthwiseConv2DOptionsStart(builder) 8099 DepthwiseConv2DOptionsAddPadding(builder, self.padding) 8100 DepthwiseConv2DOptionsAddStrideW(builder, self.strideW) 8101 DepthwiseConv2DOptionsAddStrideH(builder, self.strideH) 8102 DepthwiseConv2DOptionsAddDepthMultiplier(builder, self.depthMultiplier) 8103 DepthwiseConv2DOptionsAddFusedActivationFunction(builder, self.fusedActivationFunction) 8104 DepthwiseConv2DOptionsAddDilationWFactor(builder, self.dilationWFactor) 8105 DepthwiseConv2DOptionsAddDilationHFactor(builder, self.dilationHFactor) 8106 depthwiseConv2DOptions = DepthwiseConv2DOptionsEnd(builder) 8107 return depthwiseConv2DOptions 8108# automatically generated by the FlatBuffers compiler, do not modify 8109 8110# namespace: tflite 8111 8112from tflite_support.flatbuffers.compat import import_numpy 8113np = import_numpy() 8114 8115class DepthToSpaceOptions(object): 8116 __slots__ = ['_tab'] 8117 8118 @classmethod 8119 def GetRootAsDepthToSpaceOptions(cls, buf, offset): 8120 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 8121 x = DepthToSpaceOptions() 8122 x.Init(buf, n + offset) 8123 return x 8124 8125 @classmethod 8126 def DepthToSpaceOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 8127 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 8128 8129 # DepthToSpaceOptions 8130 def Init(self, buf, pos): 8131 self._tab = flatbuffers.table.Table(buf, pos) 8132 8133 # DepthToSpaceOptions 8134 def BlockSize(self): 8135 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 8136 if o != 0: 8137 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 8138 return 0 8139 8140def DepthToSpaceOptionsStart(builder): builder.StartObject(1) 8141def DepthToSpaceOptionsAddBlockSize(builder, blockSize): builder.PrependInt32Slot(0, blockSize, 0) 8142def DepthToSpaceOptionsEnd(builder): return builder.EndObject() 8143 8144 8145class DepthToSpaceOptionsT(object): 8146 8147 # DepthToSpaceOptionsT 8148 def __init__(self): 8149 self.blockSize = 0 # type: int 8150 8151 @classmethod 8152 def InitFromBuf(cls, buf, pos): 8153 depthToSpaceOptions = DepthToSpaceOptions() 8154 depthToSpaceOptions.Init(buf, pos) 8155 return cls.InitFromObj(depthToSpaceOptions) 8156 8157 @classmethod 8158 def InitFromObj(cls, depthToSpaceOptions): 8159 x = DepthToSpaceOptionsT() 8160 x._UnPack(depthToSpaceOptions) 8161 return x 8162 8163 # DepthToSpaceOptionsT 8164 def _UnPack(self, depthToSpaceOptions): 8165 if depthToSpaceOptions is None: 8166 return 8167 self.blockSize = depthToSpaceOptions.BlockSize() 8168 8169 # DepthToSpaceOptionsT 8170 def Pack(self, builder): 8171 DepthToSpaceOptionsStart(builder) 8172 DepthToSpaceOptionsAddBlockSize(builder, self.blockSize) 8173 depthToSpaceOptions = DepthToSpaceOptionsEnd(builder) 8174 return depthToSpaceOptions 8175# automatically generated by the FlatBuffers compiler, do not modify 8176 8177# namespace: tflite 8178 8179from tflite_support.flatbuffers.compat import import_numpy 8180np = import_numpy() 8181 8182class DensifyOptions(object): 8183 __slots__ = ['_tab'] 8184 8185 @classmethod 8186 def GetRootAsDensifyOptions(cls, buf, offset): 8187 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 8188 x = DensifyOptions() 8189 x.Init(buf, n + offset) 8190 return x 8191 8192 @classmethod 8193 def DensifyOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 8194 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 8195 8196 # DensifyOptions 8197 def Init(self, buf, pos): 8198 self._tab = flatbuffers.table.Table(buf, pos) 8199 8200def DensifyOptionsStart(builder): builder.StartObject(0) 8201def DensifyOptionsEnd(builder): return builder.EndObject() 8202 8203 8204class DensifyOptionsT(object): 8205 8206 # DensifyOptionsT 8207 def __init__(self): 8208 pass 8209 8210 @classmethod 8211 def InitFromBuf(cls, buf, pos): 8212 densifyOptions = DensifyOptions() 8213 densifyOptions.Init(buf, pos) 8214 return cls.InitFromObj(densifyOptions) 8215 8216 @classmethod 8217 def InitFromObj(cls, densifyOptions): 8218 x = DensifyOptionsT() 8219 x._UnPack(densifyOptions) 8220 return x 8221 8222 # DensifyOptionsT 8223 def _UnPack(self, densifyOptions): 8224 if densifyOptions is None: 8225 return 8226 8227 # DensifyOptionsT 8228 def Pack(self, builder): 8229 DensifyOptionsStart(builder) 8230 densifyOptions = DensifyOptionsEnd(builder) 8231 return densifyOptions 8232# automatically generated by the FlatBuffers compiler, do not modify 8233 8234# namespace: tflite 8235 8236from tflite_support.flatbuffers.compat import import_numpy 8237np = import_numpy() 8238 8239class CustomQuantization(object): 8240 __slots__ = ['_tab'] 8241 8242 @classmethod 8243 def GetRootAsCustomQuantization(cls, buf, offset): 8244 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 8245 x = CustomQuantization() 8246 x.Init(buf, n + offset) 8247 return x 8248 8249 @classmethod 8250 def CustomQuantizationBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 8251 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 8252 8253 # CustomQuantization 8254 def Init(self, buf, pos): 8255 self._tab = flatbuffers.table.Table(buf, pos) 8256 8257 # CustomQuantization 8258 def Custom(self, j): 8259 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 8260 if o != 0: 8261 a = self._tab.Vector(o) 8262 return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) 8263 return 0 8264 8265 # CustomQuantization 8266 def CustomAsNumpy(self): 8267 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 8268 if o != 0: 8269 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) 8270 return 0 8271 8272 # CustomQuantization 8273 def CustomLength(self): 8274 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 8275 if o != 0: 8276 return self._tab.VectorLen(o) 8277 return 0 8278 8279 # CustomQuantization 8280 def CustomIsNone(self): 8281 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 8282 return o == 0 8283 8284def CustomQuantizationStart(builder): builder.StartObject(1) 8285def CustomQuantizationAddCustom(builder, custom): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(custom), 0) 8286def CustomQuantizationStartCustomVector(builder, numElems): return builder.StartVector(1, numElems, 1) 8287def CustomQuantizationEnd(builder): return builder.EndObject() 8288 8289try: 8290 from typing import List 8291except: 8292 pass 8293 8294class CustomQuantizationT(object): 8295 8296 # CustomQuantizationT 8297 def __init__(self): 8298 self.custom = None # type: List[int] 8299 8300 @classmethod 8301 def InitFromBuf(cls, buf, pos): 8302 customQuantization = CustomQuantization() 8303 customQuantization.Init(buf, pos) 8304 return cls.InitFromObj(customQuantization) 8305 8306 @classmethod 8307 def InitFromObj(cls, customQuantization): 8308 x = CustomQuantizationT() 8309 x._UnPack(customQuantization) 8310 return x 8311 8312 # CustomQuantizationT 8313 def _UnPack(self, customQuantization): 8314 if customQuantization is None: 8315 return 8316 if not customQuantization.CustomIsNone(): 8317 if np is None: 8318 self.custom = [] 8319 for i in range(customQuantization.CustomLength()): 8320 self.custom.append(customQuantization.Custom(i)) 8321 else: 8322 self.custom = customQuantization.CustomAsNumpy() 8323 8324 # CustomQuantizationT 8325 def Pack(self, builder): 8326 if self.custom is not None: 8327 if np is not None and type(self.custom) is np.ndarray: 8328 custom = builder.CreateNumpyVector(self.custom) 8329 else: 8330 CustomQuantizationStartCustomVector(builder, len(self.custom)) 8331 for i in reversed(range(len(self.custom))): 8332 builder.PrependUint8(self.custom[i]) 8333 custom = builder.EndVector(len(self.custom)) 8334 CustomQuantizationStart(builder) 8335 if self.custom is not None: 8336 CustomQuantizationAddCustom(builder, custom) 8337 customQuantization = CustomQuantizationEnd(builder) 8338 return customQuantization 8339# automatically generated by the FlatBuffers compiler, do not modify 8340 8341# namespace: tflite 8342 8343class CustomOptionsFormat(object): 8344 FLEXBUFFERS = 0 8345 8346# automatically generated by the FlatBuffers compiler, do not modify 8347 8348# namespace: tflite 8349 8350from tflite_support.flatbuffers.compat import import_numpy 8351np = import_numpy() 8352 8353class CosOptions(object): 8354 __slots__ = ['_tab'] 8355 8356 @classmethod 8357 def GetRootAsCosOptions(cls, buf, offset): 8358 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 8359 x = CosOptions() 8360 x.Init(buf, n + offset) 8361 return x 8362 8363 @classmethod 8364 def CosOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 8365 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 8366 8367 # CosOptions 8368 def Init(self, buf, pos): 8369 self._tab = flatbuffers.table.Table(buf, pos) 8370 8371def CosOptionsStart(builder): builder.StartObject(0) 8372def CosOptionsEnd(builder): return builder.EndObject() 8373 8374 8375class CosOptionsT(object): 8376 8377 # CosOptionsT 8378 def __init__(self): 8379 pass 8380 8381 @classmethod 8382 def InitFromBuf(cls, buf, pos): 8383 cosOptions = CosOptions() 8384 cosOptions.Init(buf, pos) 8385 return cls.InitFromObj(cosOptions) 8386 8387 @classmethod 8388 def InitFromObj(cls, cosOptions): 8389 x = CosOptionsT() 8390 x._UnPack(cosOptions) 8391 return x 8392 8393 # CosOptionsT 8394 def _UnPack(self, cosOptions): 8395 if cosOptions is None: 8396 return 8397 8398 # CosOptionsT 8399 def Pack(self, builder): 8400 CosOptionsStart(builder) 8401 cosOptions = CosOptionsEnd(builder) 8402 return cosOptions 8403# automatically generated by the FlatBuffers compiler, do not modify 8404 8405# namespace: tflite 8406 8407from tflite_support.flatbuffers.compat import import_numpy 8408np = import_numpy() 8409 8410class Conv2DOptions(object): 8411 __slots__ = ['_tab'] 8412 8413 @classmethod 8414 def GetRootAsConv2DOptions(cls, buf, offset): 8415 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 8416 x = Conv2DOptions() 8417 x.Init(buf, n + offset) 8418 return x 8419 8420 @classmethod 8421 def Conv2DOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 8422 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 8423 8424 # Conv2DOptions 8425 def Init(self, buf, pos): 8426 self._tab = flatbuffers.table.Table(buf, pos) 8427 8428 # Conv2DOptions 8429 def Padding(self): 8430 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 8431 if o != 0: 8432 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 8433 return 0 8434 8435 # Conv2DOptions 8436 def StrideW(self): 8437 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 8438 if o != 0: 8439 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 8440 return 0 8441 8442 # Conv2DOptions 8443 def StrideH(self): 8444 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 8445 if o != 0: 8446 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 8447 return 0 8448 8449 # Conv2DOptions 8450 def FusedActivationFunction(self): 8451 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 8452 if o != 0: 8453 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 8454 return 0 8455 8456 # Conv2DOptions 8457 def DilationWFactor(self): 8458 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) 8459 if o != 0: 8460 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 8461 return 1 8462 8463 # Conv2DOptions 8464 def DilationHFactor(self): 8465 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) 8466 if o != 0: 8467 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 8468 return 1 8469 8470def Conv2DOptionsStart(builder): builder.StartObject(6) 8471def Conv2DOptionsAddPadding(builder, padding): builder.PrependInt8Slot(0, padding, 0) 8472def Conv2DOptionsAddStrideW(builder, strideW): builder.PrependInt32Slot(1, strideW, 0) 8473def Conv2DOptionsAddStrideH(builder, strideH): builder.PrependInt32Slot(2, strideH, 0) 8474def Conv2DOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(3, fusedActivationFunction, 0) 8475def Conv2DOptionsAddDilationWFactor(builder, dilationWFactor): builder.PrependInt32Slot(4, dilationWFactor, 1) 8476def Conv2DOptionsAddDilationHFactor(builder, dilationHFactor): builder.PrependInt32Slot(5, dilationHFactor, 1) 8477def Conv2DOptionsEnd(builder): return builder.EndObject() 8478 8479 8480class Conv2DOptionsT(object): 8481 8482 # Conv2DOptionsT 8483 def __init__(self): 8484 self.padding = 0 # type: int 8485 self.strideW = 0 # type: int 8486 self.strideH = 0 # type: int 8487 self.fusedActivationFunction = 0 # type: int 8488 self.dilationWFactor = 1 # type: int 8489 self.dilationHFactor = 1 # type: int 8490 8491 @classmethod 8492 def InitFromBuf(cls, buf, pos): 8493 conv2DOptions = Conv2DOptions() 8494 conv2DOptions.Init(buf, pos) 8495 return cls.InitFromObj(conv2DOptions) 8496 8497 @classmethod 8498 def InitFromObj(cls, conv2DOptions): 8499 x = Conv2DOptionsT() 8500 x._UnPack(conv2DOptions) 8501 return x 8502 8503 # Conv2DOptionsT 8504 def _UnPack(self, conv2DOptions): 8505 if conv2DOptions is None: 8506 return 8507 self.padding = conv2DOptions.Padding() 8508 self.strideW = conv2DOptions.StrideW() 8509 self.strideH = conv2DOptions.StrideH() 8510 self.fusedActivationFunction = conv2DOptions.FusedActivationFunction() 8511 self.dilationWFactor = conv2DOptions.DilationWFactor() 8512 self.dilationHFactor = conv2DOptions.DilationHFactor() 8513 8514 # Conv2DOptionsT 8515 def Pack(self, builder): 8516 Conv2DOptionsStart(builder) 8517 Conv2DOptionsAddPadding(builder, self.padding) 8518 Conv2DOptionsAddStrideW(builder, self.strideW) 8519 Conv2DOptionsAddStrideH(builder, self.strideH) 8520 Conv2DOptionsAddFusedActivationFunction(builder, self.fusedActivationFunction) 8521 Conv2DOptionsAddDilationWFactor(builder, self.dilationWFactor) 8522 Conv2DOptionsAddDilationHFactor(builder, self.dilationHFactor) 8523 conv2DOptions = Conv2DOptionsEnd(builder) 8524 return conv2DOptions 8525# automatically generated by the FlatBuffers compiler, do not modify 8526 8527# namespace: tflite 8528 8529from tflite_support.flatbuffers.compat import import_numpy 8530np = import_numpy() 8531 8532class ConcatenationOptions(object): 8533 __slots__ = ['_tab'] 8534 8535 @classmethod 8536 def GetRootAsConcatenationOptions(cls, buf, offset): 8537 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 8538 x = ConcatenationOptions() 8539 x.Init(buf, n + offset) 8540 return x 8541 8542 @classmethod 8543 def ConcatenationOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 8544 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 8545 8546 # ConcatenationOptions 8547 def Init(self, buf, pos): 8548 self._tab = flatbuffers.table.Table(buf, pos) 8549 8550 # ConcatenationOptions 8551 def Axis(self): 8552 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 8553 if o != 0: 8554 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 8555 return 0 8556 8557 # ConcatenationOptions 8558 def FusedActivationFunction(self): 8559 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 8560 if o != 0: 8561 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 8562 return 0 8563 8564def ConcatenationOptionsStart(builder): builder.StartObject(2) 8565def ConcatenationOptionsAddAxis(builder, axis): builder.PrependInt32Slot(0, axis, 0) 8566def ConcatenationOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(1, fusedActivationFunction, 0) 8567def ConcatenationOptionsEnd(builder): return builder.EndObject() 8568 8569 8570class ConcatenationOptionsT(object): 8571 8572 # ConcatenationOptionsT 8573 def __init__(self): 8574 self.axis = 0 # type: int 8575 self.fusedActivationFunction = 0 # type: int 8576 8577 @classmethod 8578 def InitFromBuf(cls, buf, pos): 8579 concatenationOptions = ConcatenationOptions() 8580 concatenationOptions.Init(buf, pos) 8581 return cls.InitFromObj(concatenationOptions) 8582 8583 @classmethod 8584 def InitFromObj(cls, concatenationOptions): 8585 x = ConcatenationOptionsT() 8586 x._UnPack(concatenationOptions) 8587 return x 8588 8589 # ConcatenationOptionsT 8590 def _UnPack(self, concatenationOptions): 8591 if concatenationOptions is None: 8592 return 8593 self.axis = concatenationOptions.Axis() 8594 self.fusedActivationFunction = concatenationOptions.FusedActivationFunction() 8595 8596 # ConcatenationOptionsT 8597 def Pack(self, builder): 8598 ConcatenationOptionsStart(builder) 8599 ConcatenationOptionsAddAxis(builder, self.axis) 8600 ConcatenationOptionsAddFusedActivationFunction(builder, self.fusedActivationFunction) 8601 concatenationOptions = ConcatenationOptionsEnd(builder) 8602 return concatenationOptions 8603# automatically generated by the FlatBuffers compiler, do not modify 8604 8605# namespace: tflite 8606 8607from tflite_support.flatbuffers.compat import import_numpy 8608np = import_numpy() 8609 8610class ConcatEmbeddingsOptions(object): 8611 __slots__ = ['_tab'] 8612 8613 @classmethod 8614 def GetRootAsConcatEmbeddingsOptions(cls, buf, offset): 8615 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 8616 x = ConcatEmbeddingsOptions() 8617 x.Init(buf, n + offset) 8618 return x 8619 8620 @classmethod 8621 def ConcatEmbeddingsOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 8622 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 8623 8624 # ConcatEmbeddingsOptions 8625 def Init(self, buf, pos): 8626 self._tab = flatbuffers.table.Table(buf, pos) 8627 8628 # ConcatEmbeddingsOptions 8629 def NumChannels(self): 8630 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 8631 if o != 0: 8632 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 8633 return 0 8634 8635 # ConcatEmbeddingsOptions 8636 def NumColumnsPerChannel(self, j): 8637 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 8638 if o != 0: 8639 a = self._tab.Vector(o) 8640 return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 8641 return 0 8642 8643 # ConcatEmbeddingsOptions 8644 def NumColumnsPerChannelAsNumpy(self): 8645 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 8646 if o != 0: 8647 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) 8648 return 0 8649 8650 # ConcatEmbeddingsOptions 8651 def NumColumnsPerChannelLength(self): 8652 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 8653 if o != 0: 8654 return self._tab.VectorLen(o) 8655 return 0 8656 8657 # ConcatEmbeddingsOptions 8658 def NumColumnsPerChannelIsNone(self): 8659 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 8660 return o == 0 8661 8662 # ConcatEmbeddingsOptions 8663 def EmbeddingDimPerChannel(self, j): 8664 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 8665 if o != 0: 8666 a = self._tab.Vector(o) 8667 return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) 8668 return 0 8669 8670 # ConcatEmbeddingsOptions 8671 def EmbeddingDimPerChannelAsNumpy(self): 8672 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 8673 if o != 0: 8674 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) 8675 return 0 8676 8677 # ConcatEmbeddingsOptions 8678 def EmbeddingDimPerChannelLength(self): 8679 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 8680 if o != 0: 8681 return self._tab.VectorLen(o) 8682 return 0 8683 8684 # ConcatEmbeddingsOptions 8685 def EmbeddingDimPerChannelIsNone(self): 8686 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 8687 return o == 0 8688 8689def ConcatEmbeddingsOptionsStart(builder): builder.StartObject(3) 8690def ConcatEmbeddingsOptionsAddNumChannels(builder, numChannels): builder.PrependInt32Slot(0, numChannels, 0) 8691def ConcatEmbeddingsOptionsAddNumColumnsPerChannel(builder, numColumnsPerChannel): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(numColumnsPerChannel), 0) 8692def ConcatEmbeddingsOptionsStartNumColumnsPerChannelVector(builder, numElems): return builder.StartVector(4, numElems, 4) 8693def ConcatEmbeddingsOptionsAddEmbeddingDimPerChannel(builder, embeddingDimPerChannel): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(embeddingDimPerChannel), 0) 8694def ConcatEmbeddingsOptionsStartEmbeddingDimPerChannelVector(builder, numElems): return builder.StartVector(4, numElems, 4) 8695def ConcatEmbeddingsOptionsEnd(builder): return builder.EndObject() 8696 8697try: 8698 from typing import List 8699except: 8700 pass 8701 8702class ConcatEmbeddingsOptionsT(object): 8703 8704 # ConcatEmbeddingsOptionsT 8705 def __init__(self): 8706 self.numChannels = 0 # type: int 8707 self.numColumnsPerChannel = None # type: List[int] 8708 self.embeddingDimPerChannel = None # type: List[int] 8709 8710 @classmethod 8711 def InitFromBuf(cls, buf, pos): 8712 concatEmbeddingsOptions = ConcatEmbeddingsOptions() 8713 concatEmbeddingsOptions.Init(buf, pos) 8714 return cls.InitFromObj(concatEmbeddingsOptions) 8715 8716 @classmethod 8717 def InitFromObj(cls, concatEmbeddingsOptions): 8718 x = ConcatEmbeddingsOptionsT() 8719 x._UnPack(concatEmbeddingsOptions) 8720 return x 8721 8722 # ConcatEmbeddingsOptionsT 8723 def _UnPack(self, concatEmbeddingsOptions): 8724 if concatEmbeddingsOptions is None: 8725 return 8726 self.numChannels = concatEmbeddingsOptions.NumChannels() 8727 if not concatEmbeddingsOptions.NumColumnsPerChannelIsNone(): 8728 if np is None: 8729 self.numColumnsPerChannel = [] 8730 for i in range(concatEmbeddingsOptions.NumColumnsPerChannelLength()): 8731 self.numColumnsPerChannel.append(concatEmbeddingsOptions.NumColumnsPerChannel(i)) 8732 else: 8733 self.numColumnsPerChannel = concatEmbeddingsOptions.NumColumnsPerChannelAsNumpy() 8734 if not concatEmbeddingsOptions.EmbeddingDimPerChannelIsNone(): 8735 if np is None: 8736 self.embeddingDimPerChannel = [] 8737 for i in range(concatEmbeddingsOptions.EmbeddingDimPerChannelLength()): 8738 self.embeddingDimPerChannel.append(concatEmbeddingsOptions.EmbeddingDimPerChannel(i)) 8739 else: 8740 self.embeddingDimPerChannel = concatEmbeddingsOptions.EmbeddingDimPerChannelAsNumpy() 8741 8742 # ConcatEmbeddingsOptionsT 8743 def Pack(self, builder): 8744 if self.numColumnsPerChannel is not None: 8745 if np is not None and type(self.numColumnsPerChannel) is np.ndarray: 8746 numColumnsPerChannel = builder.CreateNumpyVector(self.numColumnsPerChannel) 8747 else: 8748 ConcatEmbeddingsOptionsStartNumColumnsPerChannelVector(builder, len(self.numColumnsPerChannel)) 8749 for i in reversed(range(len(self.numColumnsPerChannel))): 8750 builder.PrependInt32(self.numColumnsPerChannel[i]) 8751 numColumnsPerChannel = builder.EndVector(len(self.numColumnsPerChannel)) 8752 if self.embeddingDimPerChannel is not None: 8753 if np is not None and type(self.embeddingDimPerChannel) is np.ndarray: 8754 embeddingDimPerChannel = builder.CreateNumpyVector(self.embeddingDimPerChannel) 8755 else: 8756 ConcatEmbeddingsOptionsStartEmbeddingDimPerChannelVector(builder, len(self.embeddingDimPerChannel)) 8757 for i in reversed(range(len(self.embeddingDimPerChannel))): 8758 builder.PrependInt32(self.embeddingDimPerChannel[i]) 8759 embeddingDimPerChannel = builder.EndVector(len(self.embeddingDimPerChannel)) 8760 ConcatEmbeddingsOptionsStart(builder) 8761 ConcatEmbeddingsOptionsAddNumChannels(builder, self.numChannels) 8762 if self.numColumnsPerChannel is not None: 8763 ConcatEmbeddingsOptionsAddNumColumnsPerChannel(builder, numColumnsPerChannel) 8764 if self.embeddingDimPerChannel is not None: 8765 ConcatEmbeddingsOptionsAddEmbeddingDimPerChannel(builder, embeddingDimPerChannel) 8766 concatEmbeddingsOptions = ConcatEmbeddingsOptionsEnd(builder) 8767 return concatEmbeddingsOptions 8768# automatically generated by the FlatBuffers compiler, do not modify 8769 8770# namespace: tflite 8771 8772class CombinerType(object): 8773 SUM = 0 8774 MEAN = 1 8775 SQRTN = 2 8776 8777# automatically generated by the FlatBuffers compiler, do not modify 8778 8779# namespace: tflite 8780 8781from tflite_support.flatbuffers.compat import import_numpy 8782np = import_numpy() 8783 8784class CastOptions(object): 8785 __slots__ = ['_tab'] 8786 8787 @classmethod 8788 def GetRootAsCastOptions(cls, buf, offset): 8789 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 8790 x = CastOptions() 8791 x.Init(buf, n + offset) 8792 return x 8793 8794 @classmethod 8795 def CastOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 8796 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 8797 8798 # CastOptions 8799 def Init(self, buf, pos): 8800 self._tab = flatbuffers.table.Table(buf, pos) 8801 8802 # CastOptions 8803 def InDataType(self): 8804 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 8805 if o != 0: 8806 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 8807 return 0 8808 8809 # CastOptions 8810 def OutDataType(self): 8811 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 8812 if o != 0: 8813 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 8814 return 0 8815 8816def CastOptionsStart(builder): builder.StartObject(2) 8817def CastOptionsAddInDataType(builder, inDataType): builder.PrependInt8Slot(0, inDataType, 0) 8818def CastOptionsAddOutDataType(builder, outDataType): builder.PrependInt8Slot(1, outDataType, 0) 8819def CastOptionsEnd(builder): return builder.EndObject() 8820 8821 8822class CastOptionsT(object): 8823 8824 # CastOptionsT 8825 def __init__(self): 8826 self.inDataType = 0 # type: int 8827 self.outDataType = 0 # type: int 8828 8829 @classmethod 8830 def InitFromBuf(cls, buf, pos): 8831 castOptions = CastOptions() 8832 castOptions.Init(buf, pos) 8833 return cls.InitFromObj(castOptions) 8834 8835 @classmethod 8836 def InitFromObj(cls, castOptions): 8837 x = CastOptionsT() 8838 x._UnPack(castOptions) 8839 return x 8840 8841 # CastOptionsT 8842 def _UnPack(self, castOptions): 8843 if castOptions is None: 8844 return 8845 self.inDataType = castOptions.InDataType() 8846 self.outDataType = castOptions.OutDataType() 8847 8848 # CastOptionsT 8849 def Pack(self, builder): 8850 CastOptionsStart(builder) 8851 CastOptionsAddInDataType(builder, self.inDataType) 8852 CastOptionsAddOutDataType(builder, self.outDataType) 8853 castOptions = CastOptionsEnd(builder) 8854 return castOptions 8855# automatically generated by the FlatBuffers compiler, do not modify 8856 8857# namespace: tflite 8858 8859from tflite_support.flatbuffers.compat import import_numpy 8860np = import_numpy() 8861 8862class CallOptions(object): 8863 __slots__ = ['_tab'] 8864 8865 @classmethod 8866 def GetRootAsCallOptions(cls, buf, offset): 8867 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 8868 x = CallOptions() 8869 x.Init(buf, n + offset) 8870 return x 8871 8872 @classmethod 8873 def CallOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 8874 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 8875 8876 # CallOptions 8877 def Init(self, buf, pos): 8878 self._tab = flatbuffers.table.Table(buf, pos) 8879 8880 # CallOptions 8881 def Subgraph(self): 8882 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 8883 if o != 0: 8884 return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos) 8885 return 0 8886 8887def CallOptionsStart(builder): builder.StartObject(1) 8888def CallOptionsAddSubgraph(builder, subgraph): builder.PrependUint32Slot(0, subgraph, 0) 8889def CallOptionsEnd(builder): return builder.EndObject() 8890 8891 8892class CallOptionsT(object): 8893 8894 # CallOptionsT 8895 def __init__(self): 8896 self.subgraph = 0 # type: int 8897 8898 @classmethod 8899 def InitFromBuf(cls, buf, pos): 8900 callOptions = CallOptions() 8901 callOptions.Init(buf, pos) 8902 return cls.InitFromObj(callOptions) 8903 8904 @classmethod 8905 def InitFromObj(cls, callOptions): 8906 x = CallOptionsT() 8907 x._UnPack(callOptions) 8908 return x 8909 8910 # CallOptionsT 8911 def _UnPack(self, callOptions): 8912 if callOptions is None: 8913 return 8914 self.subgraph = callOptions.Subgraph() 8915 8916 # CallOptionsT 8917 def Pack(self, builder): 8918 CallOptionsStart(builder) 8919 CallOptionsAddSubgraph(builder, self.subgraph) 8920 callOptions = CallOptionsEnd(builder) 8921 return callOptions 8922# automatically generated by the FlatBuffers compiler, do not modify 8923 8924# namespace: tflite 8925 8926class BuiltinOptions(object): 8927 NONE = 0 8928 Conv2DOptions = 1 8929 DepthwiseConv2DOptions = 2 8930 ConcatEmbeddingsOptions = 3 8931 LSHProjectionOptions = 4 8932 Pool2DOptions = 5 8933 SVDFOptions = 6 8934 RNNOptions = 7 8935 FullyConnectedOptions = 8 8936 SoftmaxOptions = 9 8937 ConcatenationOptions = 10 8938 AddOptions = 11 8939 L2NormOptions = 12 8940 LocalResponseNormalizationOptions = 13 8941 LSTMOptions = 14 8942 ResizeBilinearOptions = 15 8943 CallOptions = 16 8944 ReshapeOptions = 17 8945 SkipGramOptions = 18 8946 SpaceToDepthOptions = 19 8947 EmbeddingLookupSparseOptions = 20 8948 MulOptions = 21 8949 PadOptions = 22 8950 GatherOptions = 23 8951 BatchToSpaceNDOptions = 24 8952 SpaceToBatchNDOptions = 25 8953 TransposeOptions = 26 8954 ReducerOptions = 27 8955 SubOptions = 28 8956 DivOptions = 29 8957 SqueezeOptions = 30 8958 SequenceRNNOptions = 31 8959 StridedSliceOptions = 32 8960 ExpOptions = 33 8961 TopKV2Options = 34 8962 SplitOptions = 35 8963 LogSoftmaxOptions = 36 8964 CastOptions = 37 8965 DequantizeOptions = 38 8966 MaximumMinimumOptions = 39 8967 ArgMaxOptions = 40 8968 LessOptions = 41 8969 NegOptions = 42 8970 PadV2Options = 43 8971 GreaterOptions = 44 8972 GreaterEqualOptions = 45 8973 LessEqualOptions = 46 8974 SelectOptions = 47 8975 SliceOptions = 48 8976 TransposeConvOptions = 49 8977 SparseToDenseOptions = 50 8978 TileOptions = 51 8979 ExpandDimsOptions = 52 8980 EqualOptions = 53 8981 NotEqualOptions = 54 8982 ShapeOptions = 55 8983 PowOptions = 56 8984 ArgMinOptions = 57 8985 FakeQuantOptions = 58 8986 PackOptions = 59 8987 LogicalOrOptions = 60 8988 OneHotOptions = 61 8989 LogicalAndOptions = 62 8990 LogicalNotOptions = 63 8991 UnpackOptions = 64 8992 FloorDivOptions = 65 8993 SquareOptions = 66 8994 ZerosLikeOptions = 67 8995 FillOptions = 68 8996 BidirectionalSequenceLSTMOptions = 69 8997 BidirectionalSequenceRNNOptions = 70 8998 UnidirectionalSequenceLSTMOptions = 71 8999 FloorModOptions = 72 9000 RangeOptions = 73 9001 ResizeNearestNeighborOptions = 74 9002 LeakyReluOptions = 75 9003 SquaredDifferenceOptions = 76 9004 MirrorPadOptions = 77 9005 AbsOptions = 78 9006 SplitVOptions = 79 9007 UniqueOptions = 80 9008 ReverseV2Options = 81 9009 AddNOptions = 82 9010 GatherNdOptions = 83 9011 CosOptions = 84 9012 WhereOptions = 85 9013 RankOptions = 86 9014 ReverseSequenceOptions = 87 9015 MatrixDiagOptions = 88 9016 QuantizeOptions = 89 9017 MatrixSetDiagOptions = 90 9018 HardSwishOptions = 91 9019 IfOptions = 92 9020 WhileOptions = 93 9021 DepthToSpaceOptions = 94 9022 NonMaxSuppressionV4Options = 95 9023 NonMaxSuppressionV5Options = 96 9024 ScatterNdOptions = 97 9025 SelectV2Options = 98 9026 DensifyOptions = 99 9027 SegmentSumOptions = 100 9028 9029 9030def BuiltinOptionsCreator(unionType, table): 9031 from tflite_support.flatbuffers.table import Table 9032 if not isinstance(table, Table): 9033 return None 9034 if unionType == BuiltinOptions().Conv2DOptions: 9035 return Conv2DOptionsT.InitFromBuf(table.Bytes, table.Pos) 9036 if unionType == BuiltinOptions().DepthwiseConv2DOptions: 9037 return DepthwiseConv2DOptionsT.InitFromBuf(table.Bytes, table.Pos) 9038 if unionType == BuiltinOptions().ConcatEmbeddingsOptions: 9039 return ConcatEmbeddingsOptionsT.InitFromBuf(table.Bytes, table.Pos) 9040 if unionType == BuiltinOptions().LSHProjectionOptions: 9041 return LSHProjectionOptionsT.InitFromBuf(table.Bytes, table.Pos) 9042 if unionType == BuiltinOptions().Pool2DOptions: 9043 return Pool2DOptionsT.InitFromBuf(table.Bytes, table.Pos) 9044 if unionType == BuiltinOptions().SVDFOptions: 9045 return SVDFOptionsT.InitFromBuf(table.Bytes, table.Pos) 9046 if unionType == BuiltinOptions().RNNOptions: 9047 return RNNOptionsT.InitFromBuf(table.Bytes, table.Pos) 9048 if unionType == BuiltinOptions().FullyConnectedOptions: 9049 return FullyConnectedOptionsT.InitFromBuf(table.Bytes, table.Pos) 9050 if unionType == BuiltinOptions().SoftmaxOptions: 9051 return SoftmaxOptionsT.InitFromBuf(table.Bytes, table.Pos) 9052 if unionType == BuiltinOptions().ConcatenationOptions: 9053 return ConcatenationOptionsT.InitFromBuf(table.Bytes, table.Pos) 9054 if unionType == BuiltinOptions().AddOptions: 9055 return AddOptionsT.InitFromBuf(table.Bytes, table.Pos) 9056 if unionType == BuiltinOptions().L2NormOptions: 9057 return L2NormOptionsT.InitFromBuf(table.Bytes, table.Pos) 9058 if unionType == BuiltinOptions().LocalResponseNormalizationOptions: 9059 return LocalResponseNormalizationOptionsT.InitFromBuf(table.Bytes, table.Pos) 9060 if unionType == BuiltinOptions().LSTMOptions: 9061 return LSTMOptionsT.InitFromBuf(table.Bytes, table.Pos) 9062 if unionType == BuiltinOptions().ResizeBilinearOptions: 9063 return ResizeBilinearOptionsT.InitFromBuf(table.Bytes, table.Pos) 9064 if unionType == BuiltinOptions().CallOptions: 9065 return CallOptionsT.InitFromBuf(table.Bytes, table.Pos) 9066 if unionType == BuiltinOptions().ReshapeOptions: 9067 return ReshapeOptionsT.InitFromBuf(table.Bytes, table.Pos) 9068 if unionType == BuiltinOptions().SkipGramOptions: 9069 return SkipGramOptionsT.InitFromBuf(table.Bytes, table.Pos) 9070 if unionType == BuiltinOptions().SpaceToDepthOptions: 9071 return SpaceToDepthOptionsT.InitFromBuf(table.Bytes, table.Pos) 9072 if unionType == BuiltinOptions().EmbeddingLookupSparseOptions: 9073 return EmbeddingLookupSparseOptionsT.InitFromBuf(table.Bytes, table.Pos) 9074 if unionType == BuiltinOptions().MulOptions: 9075 return MulOptionsT.InitFromBuf(table.Bytes, table.Pos) 9076 if unionType == BuiltinOptions().PadOptions: 9077 return PadOptionsT.InitFromBuf(table.Bytes, table.Pos) 9078 if unionType == BuiltinOptions().GatherOptions: 9079 return GatherOptionsT.InitFromBuf(table.Bytes, table.Pos) 9080 if unionType == BuiltinOptions().BatchToSpaceNDOptions: 9081 return BatchToSpaceNDOptionsT.InitFromBuf(table.Bytes, table.Pos) 9082 if unionType == BuiltinOptions().SpaceToBatchNDOptions: 9083 return SpaceToBatchNDOptionsT.InitFromBuf(table.Bytes, table.Pos) 9084 if unionType == BuiltinOptions().TransposeOptions: 9085 return TransposeOptionsT.InitFromBuf(table.Bytes, table.Pos) 9086 if unionType == BuiltinOptions().ReducerOptions: 9087 return ReducerOptionsT.InitFromBuf(table.Bytes, table.Pos) 9088 if unionType == BuiltinOptions().SubOptions: 9089 return SubOptionsT.InitFromBuf(table.Bytes, table.Pos) 9090 if unionType == BuiltinOptions().DivOptions: 9091 return DivOptionsT.InitFromBuf(table.Bytes, table.Pos) 9092 if unionType == BuiltinOptions().SqueezeOptions: 9093 return SqueezeOptionsT.InitFromBuf(table.Bytes, table.Pos) 9094 if unionType == BuiltinOptions().SequenceRNNOptions: 9095 return SequenceRNNOptionsT.InitFromBuf(table.Bytes, table.Pos) 9096 if unionType == BuiltinOptions().StridedSliceOptions: 9097 return StridedSliceOptionsT.InitFromBuf(table.Bytes, table.Pos) 9098 if unionType == BuiltinOptions().ExpOptions: 9099 return ExpOptionsT.InitFromBuf(table.Bytes, table.Pos) 9100 if unionType == BuiltinOptions().TopKV2Options: 9101 return TopKV2OptionsT.InitFromBuf(table.Bytes, table.Pos) 9102 if unionType == BuiltinOptions().SplitOptions: 9103 return SplitOptionsT.InitFromBuf(table.Bytes, table.Pos) 9104 if unionType == BuiltinOptions().LogSoftmaxOptions: 9105 return LogSoftmaxOptionsT.InitFromBuf(table.Bytes, table.Pos) 9106 if unionType == BuiltinOptions().CastOptions: 9107 return CastOptionsT.InitFromBuf(table.Bytes, table.Pos) 9108 if unionType == BuiltinOptions().DequantizeOptions: 9109 return DequantizeOptionsT.InitFromBuf(table.Bytes, table.Pos) 9110 if unionType == BuiltinOptions().MaximumMinimumOptions: 9111 return MaximumMinimumOptionsT.InitFromBuf(table.Bytes, table.Pos) 9112 if unionType == BuiltinOptions().ArgMaxOptions: 9113 return ArgMaxOptionsT.InitFromBuf(table.Bytes, table.Pos) 9114 if unionType == BuiltinOptions().LessOptions: 9115 return LessOptionsT.InitFromBuf(table.Bytes, table.Pos) 9116 if unionType == BuiltinOptions().NegOptions: 9117 return NegOptionsT.InitFromBuf(table.Bytes, table.Pos) 9118 if unionType == BuiltinOptions().PadV2Options: 9119 return PadV2OptionsT.InitFromBuf(table.Bytes, table.Pos) 9120 if unionType == BuiltinOptions().GreaterOptions: 9121 return GreaterOptionsT.InitFromBuf(table.Bytes, table.Pos) 9122 if unionType == BuiltinOptions().GreaterEqualOptions: 9123 return GreaterEqualOptionsT.InitFromBuf(table.Bytes, table.Pos) 9124 if unionType == BuiltinOptions().LessEqualOptions: 9125 return LessEqualOptionsT.InitFromBuf(table.Bytes, table.Pos) 9126 if unionType == BuiltinOptions().SelectOptions: 9127 return SelectOptionsT.InitFromBuf(table.Bytes, table.Pos) 9128 if unionType == BuiltinOptions().SliceOptions: 9129 return SliceOptionsT.InitFromBuf(table.Bytes, table.Pos) 9130 if unionType == BuiltinOptions().TransposeConvOptions: 9131 return TransposeConvOptionsT.InitFromBuf(table.Bytes, table.Pos) 9132 if unionType == BuiltinOptions().SparseToDenseOptions: 9133 return SparseToDenseOptionsT.InitFromBuf(table.Bytes, table.Pos) 9134 if unionType == BuiltinOptions().TileOptions: 9135 return TileOptionsT.InitFromBuf(table.Bytes, table.Pos) 9136 if unionType == BuiltinOptions().ExpandDimsOptions: 9137 return ExpandDimsOptionsT.InitFromBuf(table.Bytes, table.Pos) 9138 if unionType == BuiltinOptions().EqualOptions: 9139 return EqualOptionsT.InitFromBuf(table.Bytes, table.Pos) 9140 if unionType == BuiltinOptions().NotEqualOptions: 9141 return NotEqualOptionsT.InitFromBuf(table.Bytes, table.Pos) 9142 if unionType == BuiltinOptions().ShapeOptions: 9143 return ShapeOptionsT.InitFromBuf(table.Bytes, table.Pos) 9144 if unionType == BuiltinOptions().PowOptions: 9145 return PowOptionsT.InitFromBuf(table.Bytes, table.Pos) 9146 if unionType == BuiltinOptions().ArgMinOptions: 9147 return ArgMinOptionsT.InitFromBuf(table.Bytes, table.Pos) 9148 if unionType == BuiltinOptions().FakeQuantOptions: 9149 return FakeQuantOptionsT.InitFromBuf(table.Bytes, table.Pos) 9150 if unionType == BuiltinOptions().PackOptions: 9151 return PackOptionsT.InitFromBuf(table.Bytes, table.Pos) 9152 if unionType == BuiltinOptions().LogicalOrOptions: 9153 return LogicalOrOptionsT.InitFromBuf(table.Bytes, table.Pos) 9154 if unionType == BuiltinOptions().OneHotOptions: 9155 return OneHotOptionsT.InitFromBuf(table.Bytes, table.Pos) 9156 if unionType == BuiltinOptions().LogicalAndOptions: 9157 return LogicalAndOptionsT.InitFromBuf(table.Bytes, table.Pos) 9158 if unionType == BuiltinOptions().LogicalNotOptions: 9159 return LogicalNotOptionsT.InitFromBuf(table.Bytes, table.Pos) 9160 if unionType == BuiltinOptions().UnpackOptions: 9161 return UnpackOptionsT.InitFromBuf(table.Bytes, table.Pos) 9162 if unionType == BuiltinOptions().FloorDivOptions: 9163 return FloorDivOptionsT.InitFromBuf(table.Bytes, table.Pos) 9164 if unionType == BuiltinOptions().SquareOptions: 9165 return SquareOptionsT.InitFromBuf(table.Bytes, table.Pos) 9166 if unionType == BuiltinOptions().ZerosLikeOptions: 9167 return ZerosLikeOptionsT.InitFromBuf(table.Bytes, table.Pos) 9168 if unionType == BuiltinOptions().FillOptions: 9169 return FillOptionsT.InitFromBuf(table.Bytes, table.Pos) 9170 if unionType == BuiltinOptions().BidirectionalSequenceLSTMOptions: 9171 return BidirectionalSequenceLSTMOptionsT.InitFromBuf(table.Bytes, table.Pos) 9172 if unionType == BuiltinOptions().BidirectionalSequenceRNNOptions: 9173 return BidirectionalSequenceRNNOptionsT.InitFromBuf(table.Bytes, table.Pos) 9174 if unionType == BuiltinOptions().UnidirectionalSequenceLSTMOptions: 9175 return UnidirectionalSequenceLSTMOptionsT.InitFromBuf(table.Bytes, table.Pos) 9176 if unionType == BuiltinOptions().FloorModOptions: 9177 return FloorModOptionsT.InitFromBuf(table.Bytes, table.Pos) 9178 if unionType == BuiltinOptions().RangeOptions: 9179 return RangeOptionsT.InitFromBuf(table.Bytes, table.Pos) 9180 if unionType == BuiltinOptions().ResizeNearestNeighborOptions: 9181 return ResizeNearestNeighborOptionsT.InitFromBuf(table.Bytes, table.Pos) 9182 if unionType == BuiltinOptions().LeakyReluOptions: 9183 return LeakyReluOptionsT.InitFromBuf(table.Bytes, table.Pos) 9184 if unionType == BuiltinOptions().SquaredDifferenceOptions: 9185 return SquaredDifferenceOptionsT.InitFromBuf(table.Bytes, table.Pos) 9186 if unionType == BuiltinOptions().MirrorPadOptions: 9187 return MirrorPadOptionsT.InitFromBuf(table.Bytes, table.Pos) 9188 if unionType == BuiltinOptions().AbsOptions: 9189 return AbsOptionsT.InitFromBuf(table.Bytes, table.Pos) 9190 if unionType == BuiltinOptions().SplitVOptions: 9191 return SplitVOptionsT.InitFromBuf(table.Bytes, table.Pos) 9192 if unionType == BuiltinOptions().UniqueOptions: 9193 return UniqueOptionsT.InitFromBuf(table.Bytes, table.Pos) 9194 if unionType == BuiltinOptions().ReverseV2Options: 9195 return ReverseV2OptionsT.InitFromBuf(table.Bytes, table.Pos) 9196 if unionType == BuiltinOptions().AddNOptions: 9197 return AddNOptionsT.InitFromBuf(table.Bytes, table.Pos) 9198 if unionType == BuiltinOptions().GatherNdOptions: 9199 return GatherNdOptionsT.InitFromBuf(table.Bytes, table.Pos) 9200 if unionType == BuiltinOptions().CosOptions: 9201 return CosOptionsT.InitFromBuf(table.Bytes, table.Pos) 9202 if unionType == BuiltinOptions().WhereOptions: 9203 return WhereOptionsT.InitFromBuf(table.Bytes, table.Pos) 9204 if unionType == BuiltinOptions().RankOptions: 9205 return RankOptionsT.InitFromBuf(table.Bytes, table.Pos) 9206 if unionType == BuiltinOptions().ReverseSequenceOptions: 9207 return ReverseSequenceOptionsT.InitFromBuf(table.Bytes, table.Pos) 9208 if unionType == BuiltinOptions().MatrixDiagOptions: 9209 return MatrixDiagOptionsT.InitFromBuf(table.Bytes, table.Pos) 9210 if unionType == BuiltinOptions().QuantizeOptions: 9211 return QuantizeOptionsT.InitFromBuf(table.Bytes, table.Pos) 9212 if unionType == BuiltinOptions().MatrixSetDiagOptions: 9213 return MatrixSetDiagOptionsT.InitFromBuf(table.Bytes, table.Pos) 9214 if unionType == BuiltinOptions().HardSwishOptions: 9215 return HardSwishOptionsT.InitFromBuf(table.Bytes, table.Pos) 9216 if unionType == BuiltinOptions().IfOptions: 9217 return IfOptionsT.InitFromBuf(table.Bytes, table.Pos) 9218 if unionType == BuiltinOptions().WhileOptions: 9219 return WhileOptionsT.InitFromBuf(table.Bytes, table.Pos) 9220 if unionType == BuiltinOptions().DepthToSpaceOptions: 9221 return DepthToSpaceOptionsT.InitFromBuf(table.Bytes, table.Pos) 9222 if unionType == BuiltinOptions().NonMaxSuppressionV4Options: 9223 return NonMaxSuppressionV4OptionsT.InitFromBuf(table.Bytes, table.Pos) 9224 if unionType == BuiltinOptions().NonMaxSuppressionV5Options: 9225 return NonMaxSuppressionV5OptionsT.InitFromBuf(table.Bytes, table.Pos) 9226 if unionType == BuiltinOptions().ScatterNdOptions: 9227 return ScatterNdOptionsT.InitFromBuf(table.Bytes, table.Pos) 9228 if unionType == BuiltinOptions().SelectV2Options: 9229 return SelectV2OptionsT.InitFromBuf(table.Bytes, table.Pos) 9230 if unionType == BuiltinOptions().DensifyOptions: 9231 return DensifyOptionsT.InitFromBuf(table.Bytes, table.Pos) 9232 if unionType == BuiltinOptions().SegmentSumOptions: 9233 return SegmentSumOptionsT.InitFromBuf(table.Bytes, table.Pos) 9234 return None 9235# automatically generated by the FlatBuffers compiler, do not modify 9236 9237# namespace: tflite 9238 9239class BuiltinOperator(object): 9240 ADD = 0 9241 AVERAGE_POOL_2D = 1 9242 CONCATENATION = 2 9243 CONV_2D = 3 9244 DEPTHWISE_CONV_2D = 4 9245 DEPTH_TO_SPACE = 5 9246 DEQUANTIZE = 6 9247 EMBEDDING_LOOKUP = 7 9248 FLOOR = 8 9249 FULLY_CONNECTED = 9 9250 HASHTABLE_LOOKUP = 10 9251 L2_NORMALIZATION = 11 9252 L2_POOL_2D = 12 9253 LOCAL_RESPONSE_NORMALIZATION = 13 9254 LOGISTIC = 14 9255 LSH_PROJECTION = 15 9256 LSTM = 16 9257 MAX_POOL_2D = 17 9258 MUL = 18 9259 RELU = 19 9260 RELU_N1_TO_1 = 20 9261 RELU6 = 21 9262 RESHAPE = 22 9263 RESIZE_BILINEAR = 23 9264 RNN = 24 9265 SOFTMAX = 25 9266 SPACE_TO_DEPTH = 26 9267 SVDF = 27 9268 TANH = 28 9269 CONCAT_EMBEDDINGS = 29 9270 SKIP_GRAM = 30 9271 CALL = 31 9272 CUSTOM = 32 9273 EMBEDDING_LOOKUP_SPARSE = 33 9274 PAD = 34 9275 UNIDIRECTIONAL_SEQUENCE_RNN = 35 9276 GATHER = 36 9277 BATCH_TO_SPACE_ND = 37 9278 SPACE_TO_BATCH_ND = 38 9279 TRANSPOSE = 39 9280 MEAN = 40 9281 SUB = 41 9282 DIV = 42 9283 SQUEEZE = 43 9284 UNIDIRECTIONAL_SEQUENCE_LSTM = 44 9285 STRIDED_SLICE = 45 9286 BIDIRECTIONAL_SEQUENCE_RNN = 46 9287 EXP = 47 9288 TOPK_V2 = 48 9289 SPLIT = 49 9290 LOG_SOFTMAX = 50 9291 DELEGATE = 51 9292 BIDIRECTIONAL_SEQUENCE_LSTM = 52 9293 CAST = 53 9294 PRELU = 54 9295 MAXIMUM = 55 9296 ARG_MAX = 56 9297 MINIMUM = 57 9298 LESS = 58 9299 NEG = 59 9300 PADV2 = 60 9301 GREATER = 61 9302 GREATER_EQUAL = 62 9303 LESS_EQUAL = 63 9304 SELECT = 64 9305 SLICE = 65 9306 SIN = 66 9307 TRANSPOSE_CONV = 67 9308 SPARSE_TO_DENSE = 68 9309 TILE = 69 9310 EXPAND_DIMS = 70 9311 EQUAL = 71 9312 NOT_EQUAL = 72 9313 LOG = 73 9314 SUM = 74 9315 SQRT = 75 9316 RSQRT = 76 9317 SHAPE = 77 9318 POW = 78 9319 ARG_MIN = 79 9320 FAKE_QUANT = 80 9321 REDUCE_PROD = 81 9322 REDUCE_MAX = 82 9323 PACK = 83 9324 LOGICAL_OR = 84 9325 ONE_HOT = 85 9326 LOGICAL_AND = 86 9327 LOGICAL_NOT = 87 9328 UNPACK = 88 9329 REDUCE_MIN = 89 9330 FLOOR_DIV = 90 9331 REDUCE_ANY = 91 9332 SQUARE = 92 9333 ZEROS_LIKE = 93 9334 FILL = 94 9335 FLOOR_MOD = 95 9336 RANGE = 96 9337 RESIZE_NEAREST_NEIGHBOR = 97 9338 LEAKY_RELU = 98 9339 SQUARED_DIFFERENCE = 99 9340 MIRROR_PAD = 100 9341 ABS = 101 9342 SPLIT_V = 102 9343 UNIQUE = 103 9344 CEIL = 104 9345 REVERSE_V2 = 105 9346 ADD_N = 106 9347 GATHER_ND = 107 9348 COS = 108 9349 WHERE = 109 9350 RANK = 110 9351 ELU = 111 9352 REVERSE_SEQUENCE = 112 9353 MATRIX_DIAG = 113 9354 QUANTIZE = 114 9355 MATRIX_SET_DIAG = 115 9356 ROUND = 116 9357 HARD_SWISH = 117 9358 IF = 118 9359 WHILE = 119 9360 NON_MAX_SUPPRESSION_V4 = 120 9361 NON_MAX_SUPPRESSION_V5 = 121 9362 SCATTER_ND = 122 9363 SELECT_V2 = 123 9364 DENSIFY = 124 9365 SEGMENT_SUM = 125 9366 9367# automatically generated by the FlatBuffers compiler, do not modify 9368 9369# namespace: tflite 9370 9371from tflite_support.flatbuffers.compat import import_numpy 9372np = import_numpy() 9373 9374class Buffer(object): 9375 __slots__ = ['_tab'] 9376 9377 @classmethod 9378 def GetRootAsBuffer(cls, buf, offset): 9379 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 9380 x = Buffer() 9381 x.Init(buf, n + offset) 9382 return x 9383 9384 @classmethod 9385 def BufferBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 9386 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 9387 9388 # Buffer 9389 def Init(self, buf, pos): 9390 self._tab = flatbuffers.table.Table(buf, pos) 9391 9392 # Buffer 9393 def Data(self, j): 9394 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 9395 if o != 0: 9396 a = self._tab.Vector(o) 9397 return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) 9398 return 0 9399 9400 # Buffer 9401 def DataAsNumpy(self): 9402 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 9403 if o != 0: 9404 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) 9405 return 0 9406 9407 # Buffer 9408 def DataLength(self): 9409 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 9410 if o != 0: 9411 return self._tab.VectorLen(o) 9412 return 0 9413 9414 # Buffer 9415 def DataIsNone(self): 9416 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 9417 return o == 0 9418 9419def BufferStart(builder): builder.StartObject(1) 9420def BufferAddData(builder, data): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(data), 0) 9421def BufferStartDataVector(builder, numElems): return builder.StartVector(1, numElems, 1) 9422def BufferEnd(builder): return builder.EndObject() 9423 9424try: 9425 from typing import List 9426except: 9427 pass 9428 9429class BufferT(object): 9430 9431 # BufferT 9432 def __init__(self): 9433 self.data = None # type: List[int] 9434 9435 @classmethod 9436 def InitFromBuf(cls, buf, pos): 9437 buffer = Buffer() 9438 buffer.Init(buf, pos) 9439 return cls.InitFromObj(buffer) 9440 9441 @classmethod 9442 def InitFromObj(cls, buffer): 9443 x = BufferT() 9444 x._UnPack(buffer) 9445 return x 9446 9447 # BufferT 9448 def _UnPack(self, buffer): 9449 if buffer is None: 9450 return 9451 if not buffer.DataIsNone(): 9452 if np is None: 9453 self.data = [] 9454 for i in range(buffer.DataLength()): 9455 self.data.append(buffer.Data(i)) 9456 else: 9457 self.data = buffer.DataAsNumpy() 9458 9459 # BufferT 9460 def Pack(self, builder): 9461 if self.data is not None: 9462 if np is not None and type(self.data) is np.ndarray: 9463 data = builder.CreateNumpyVector(self.data) 9464 else: 9465 BufferStartDataVector(builder, len(self.data)) 9466 for i in reversed(range(len(self.data))): 9467 builder.PrependUint8(self.data[i]) 9468 data = builder.EndVector(len(self.data)) 9469 BufferStart(builder) 9470 if self.data is not None: 9471 BufferAddData(builder, data) 9472 buffer = BufferEnd(builder) 9473 return buffer 9474# automatically generated by the FlatBuffers compiler, do not modify 9475 9476# namespace: tflite 9477 9478from tflite_support.flatbuffers.compat import import_numpy 9479np = import_numpy() 9480 9481class BidirectionalSequenceRNNOptions(object): 9482 __slots__ = ['_tab'] 9483 9484 @classmethod 9485 def GetRootAsBidirectionalSequenceRNNOptions(cls, buf, offset): 9486 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 9487 x = BidirectionalSequenceRNNOptions() 9488 x.Init(buf, n + offset) 9489 return x 9490 9491 @classmethod 9492 def BidirectionalSequenceRNNOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 9493 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 9494 9495 # BidirectionalSequenceRNNOptions 9496 def Init(self, buf, pos): 9497 self._tab = flatbuffers.table.Table(buf, pos) 9498 9499 # BidirectionalSequenceRNNOptions 9500 def TimeMajor(self): 9501 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 9502 if o != 0: 9503 return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) 9504 return False 9505 9506 # BidirectionalSequenceRNNOptions 9507 def FusedActivationFunction(self): 9508 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 9509 if o != 0: 9510 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 9511 return 0 9512 9513 # BidirectionalSequenceRNNOptions 9514 def MergeOutputs(self): 9515 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 9516 if o != 0: 9517 return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) 9518 return False 9519 9520def BidirectionalSequenceRNNOptionsStart(builder): builder.StartObject(3) 9521def BidirectionalSequenceRNNOptionsAddTimeMajor(builder, timeMajor): builder.PrependBoolSlot(0, timeMajor, 0) 9522def BidirectionalSequenceRNNOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(1, fusedActivationFunction, 0) 9523def BidirectionalSequenceRNNOptionsAddMergeOutputs(builder, mergeOutputs): builder.PrependBoolSlot(2, mergeOutputs, 0) 9524def BidirectionalSequenceRNNOptionsEnd(builder): return builder.EndObject() 9525 9526 9527class BidirectionalSequenceRNNOptionsT(object): 9528 9529 # BidirectionalSequenceRNNOptionsT 9530 def __init__(self): 9531 self.timeMajor = False # type: bool 9532 self.fusedActivationFunction = 0 # type: int 9533 self.mergeOutputs = False # type: bool 9534 9535 @classmethod 9536 def InitFromBuf(cls, buf, pos): 9537 bidirectionalSequenceRNNOptions = BidirectionalSequenceRNNOptions() 9538 bidirectionalSequenceRNNOptions.Init(buf, pos) 9539 return cls.InitFromObj(bidirectionalSequenceRNNOptions) 9540 9541 @classmethod 9542 def InitFromObj(cls, bidirectionalSequenceRNNOptions): 9543 x = BidirectionalSequenceRNNOptionsT() 9544 x._UnPack(bidirectionalSequenceRNNOptions) 9545 return x 9546 9547 # BidirectionalSequenceRNNOptionsT 9548 def _UnPack(self, bidirectionalSequenceRNNOptions): 9549 if bidirectionalSequenceRNNOptions is None: 9550 return 9551 self.timeMajor = bidirectionalSequenceRNNOptions.TimeMajor() 9552 self.fusedActivationFunction = bidirectionalSequenceRNNOptions.FusedActivationFunction() 9553 self.mergeOutputs = bidirectionalSequenceRNNOptions.MergeOutputs() 9554 9555 # BidirectionalSequenceRNNOptionsT 9556 def Pack(self, builder): 9557 BidirectionalSequenceRNNOptionsStart(builder) 9558 BidirectionalSequenceRNNOptionsAddTimeMajor(builder, self.timeMajor) 9559 BidirectionalSequenceRNNOptionsAddFusedActivationFunction(builder, self.fusedActivationFunction) 9560 BidirectionalSequenceRNNOptionsAddMergeOutputs(builder, self.mergeOutputs) 9561 bidirectionalSequenceRNNOptions = BidirectionalSequenceRNNOptionsEnd(builder) 9562 return bidirectionalSequenceRNNOptions 9563# automatically generated by the FlatBuffers compiler, do not modify 9564 9565# namespace: tflite 9566 9567from tflite_support.flatbuffers.compat import import_numpy 9568np = import_numpy() 9569 9570class BidirectionalSequenceLSTMOptions(object): 9571 __slots__ = ['_tab'] 9572 9573 @classmethod 9574 def GetRootAsBidirectionalSequenceLSTMOptions(cls, buf, offset): 9575 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 9576 x = BidirectionalSequenceLSTMOptions() 9577 x.Init(buf, n + offset) 9578 return x 9579 9580 @classmethod 9581 def BidirectionalSequenceLSTMOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 9582 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 9583 9584 # BidirectionalSequenceLSTMOptions 9585 def Init(self, buf, pos): 9586 self._tab = flatbuffers.table.Table(buf, pos) 9587 9588 # BidirectionalSequenceLSTMOptions 9589 def FusedActivationFunction(self): 9590 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 9591 if o != 0: 9592 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 9593 return 0 9594 9595 # BidirectionalSequenceLSTMOptions 9596 def CellClip(self): 9597 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 9598 if o != 0: 9599 return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) 9600 return 0.0 9601 9602 # BidirectionalSequenceLSTMOptions 9603 def ProjClip(self): 9604 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 9605 if o != 0: 9606 return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) 9607 return 0.0 9608 9609 # BidirectionalSequenceLSTMOptions 9610 def MergeOutputs(self): 9611 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) 9612 if o != 0: 9613 return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) 9614 return False 9615 9616 # BidirectionalSequenceLSTMOptions 9617 def TimeMajor(self): 9618 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) 9619 if o != 0: 9620 return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) 9621 return True 9622 9623def BidirectionalSequenceLSTMOptionsStart(builder): builder.StartObject(5) 9624def BidirectionalSequenceLSTMOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0) 9625def BidirectionalSequenceLSTMOptionsAddCellClip(builder, cellClip): builder.PrependFloat32Slot(1, cellClip, 0.0) 9626def BidirectionalSequenceLSTMOptionsAddProjClip(builder, projClip): builder.PrependFloat32Slot(2, projClip, 0.0) 9627def BidirectionalSequenceLSTMOptionsAddMergeOutputs(builder, mergeOutputs): builder.PrependBoolSlot(3, mergeOutputs, 0) 9628def BidirectionalSequenceLSTMOptionsAddTimeMajor(builder, timeMajor): builder.PrependBoolSlot(4, timeMajor, 1) 9629def BidirectionalSequenceLSTMOptionsEnd(builder): return builder.EndObject() 9630 9631 9632class BidirectionalSequenceLSTMOptionsT(object): 9633 9634 # BidirectionalSequenceLSTMOptionsT 9635 def __init__(self): 9636 self.fusedActivationFunction = 0 # type: int 9637 self.cellClip = 0.0 # type: float 9638 self.projClip = 0.0 # type: float 9639 self.mergeOutputs = False # type: bool 9640 self.timeMajor = True # type: bool 9641 9642 @classmethod 9643 def InitFromBuf(cls, buf, pos): 9644 bidirectionalSequenceLSTMOptions = BidirectionalSequenceLSTMOptions() 9645 bidirectionalSequenceLSTMOptions.Init(buf, pos) 9646 return cls.InitFromObj(bidirectionalSequenceLSTMOptions) 9647 9648 @classmethod 9649 def InitFromObj(cls, bidirectionalSequenceLSTMOptions): 9650 x = BidirectionalSequenceLSTMOptionsT() 9651 x._UnPack(bidirectionalSequenceLSTMOptions) 9652 return x 9653 9654 # BidirectionalSequenceLSTMOptionsT 9655 def _UnPack(self, bidirectionalSequenceLSTMOptions): 9656 if bidirectionalSequenceLSTMOptions is None: 9657 return 9658 self.fusedActivationFunction = bidirectionalSequenceLSTMOptions.FusedActivationFunction() 9659 self.cellClip = bidirectionalSequenceLSTMOptions.CellClip() 9660 self.projClip = bidirectionalSequenceLSTMOptions.ProjClip() 9661 self.mergeOutputs = bidirectionalSequenceLSTMOptions.MergeOutputs() 9662 self.timeMajor = bidirectionalSequenceLSTMOptions.TimeMajor() 9663 9664 # BidirectionalSequenceLSTMOptionsT 9665 def Pack(self, builder): 9666 BidirectionalSequenceLSTMOptionsStart(builder) 9667 BidirectionalSequenceLSTMOptionsAddFusedActivationFunction(builder, self.fusedActivationFunction) 9668 BidirectionalSequenceLSTMOptionsAddCellClip(builder, self.cellClip) 9669 BidirectionalSequenceLSTMOptionsAddProjClip(builder, self.projClip) 9670 BidirectionalSequenceLSTMOptionsAddMergeOutputs(builder, self.mergeOutputs) 9671 BidirectionalSequenceLSTMOptionsAddTimeMajor(builder, self.timeMajor) 9672 bidirectionalSequenceLSTMOptions = BidirectionalSequenceLSTMOptionsEnd(builder) 9673 return bidirectionalSequenceLSTMOptions 9674# automatically generated by the FlatBuffers compiler, do not modify 9675 9676# namespace: tflite 9677 9678from tflite_support.flatbuffers.compat import import_numpy 9679np = import_numpy() 9680 9681class BatchToSpaceNDOptions(object): 9682 __slots__ = ['_tab'] 9683 9684 @classmethod 9685 def GetRootAsBatchToSpaceNDOptions(cls, buf, offset): 9686 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 9687 x = BatchToSpaceNDOptions() 9688 x.Init(buf, n + offset) 9689 return x 9690 9691 @classmethod 9692 def BatchToSpaceNDOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 9693 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 9694 9695 # BatchToSpaceNDOptions 9696 def Init(self, buf, pos): 9697 self._tab = flatbuffers.table.Table(buf, pos) 9698 9699def BatchToSpaceNDOptionsStart(builder): builder.StartObject(0) 9700def BatchToSpaceNDOptionsEnd(builder): return builder.EndObject() 9701 9702 9703class BatchToSpaceNDOptionsT(object): 9704 9705 # BatchToSpaceNDOptionsT 9706 def __init__(self): 9707 pass 9708 9709 @classmethod 9710 def InitFromBuf(cls, buf, pos): 9711 batchToSpaceNDOptions = BatchToSpaceNDOptions() 9712 batchToSpaceNDOptions.Init(buf, pos) 9713 return cls.InitFromObj(batchToSpaceNDOptions) 9714 9715 @classmethod 9716 def InitFromObj(cls, batchToSpaceNDOptions): 9717 x = BatchToSpaceNDOptionsT() 9718 x._UnPack(batchToSpaceNDOptions) 9719 return x 9720 9721 # BatchToSpaceNDOptionsT 9722 def _UnPack(self, batchToSpaceNDOptions): 9723 if batchToSpaceNDOptions is None: 9724 return 9725 9726 # BatchToSpaceNDOptionsT 9727 def Pack(self, builder): 9728 BatchToSpaceNDOptionsStart(builder) 9729 batchToSpaceNDOptions = BatchToSpaceNDOptionsEnd(builder) 9730 return batchToSpaceNDOptions 9731# automatically generated by the FlatBuffers compiler, do not modify 9732 9733# namespace: tflite 9734 9735from tflite_support.flatbuffers.compat import import_numpy 9736np = import_numpy() 9737 9738class ArgMinOptions(object): 9739 __slots__ = ['_tab'] 9740 9741 @classmethod 9742 def GetRootAsArgMinOptions(cls, buf, offset): 9743 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 9744 x = ArgMinOptions() 9745 x.Init(buf, n + offset) 9746 return x 9747 9748 @classmethod 9749 def ArgMinOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 9750 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 9751 9752 # ArgMinOptions 9753 def Init(self, buf, pos): 9754 self._tab = flatbuffers.table.Table(buf, pos) 9755 9756 # ArgMinOptions 9757 def OutputType(self): 9758 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 9759 if o != 0: 9760 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 9761 return 0 9762 9763def ArgMinOptionsStart(builder): builder.StartObject(1) 9764def ArgMinOptionsAddOutputType(builder, outputType): builder.PrependInt8Slot(0, outputType, 0) 9765def ArgMinOptionsEnd(builder): return builder.EndObject() 9766 9767 9768class ArgMinOptionsT(object): 9769 9770 # ArgMinOptionsT 9771 def __init__(self): 9772 self.outputType = 0 # type: int 9773 9774 @classmethod 9775 def InitFromBuf(cls, buf, pos): 9776 argMinOptions = ArgMinOptions() 9777 argMinOptions.Init(buf, pos) 9778 return cls.InitFromObj(argMinOptions) 9779 9780 @classmethod 9781 def InitFromObj(cls, argMinOptions): 9782 x = ArgMinOptionsT() 9783 x._UnPack(argMinOptions) 9784 return x 9785 9786 # ArgMinOptionsT 9787 def _UnPack(self, argMinOptions): 9788 if argMinOptions is None: 9789 return 9790 self.outputType = argMinOptions.OutputType() 9791 9792 # ArgMinOptionsT 9793 def Pack(self, builder): 9794 ArgMinOptionsStart(builder) 9795 ArgMinOptionsAddOutputType(builder, self.outputType) 9796 argMinOptions = ArgMinOptionsEnd(builder) 9797 return argMinOptions 9798# automatically generated by the FlatBuffers compiler, do not modify 9799 9800# namespace: tflite 9801 9802from tflite_support.flatbuffers.compat import import_numpy 9803np = import_numpy() 9804 9805class ArgMaxOptions(object): 9806 __slots__ = ['_tab'] 9807 9808 @classmethod 9809 def GetRootAsArgMaxOptions(cls, buf, offset): 9810 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 9811 x = ArgMaxOptions() 9812 x.Init(buf, n + offset) 9813 return x 9814 9815 @classmethod 9816 def ArgMaxOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 9817 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 9818 9819 # ArgMaxOptions 9820 def Init(self, buf, pos): 9821 self._tab = flatbuffers.table.Table(buf, pos) 9822 9823 # ArgMaxOptions 9824 def OutputType(self): 9825 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 9826 if o != 0: 9827 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 9828 return 0 9829 9830def ArgMaxOptionsStart(builder): builder.StartObject(1) 9831def ArgMaxOptionsAddOutputType(builder, outputType): builder.PrependInt8Slot(0, outputType, 0) 9832def ArgMaxOptionsEnd(builder): return builder.EndObject() 9833 9834 9835class ArgMaxOptionsT(object): 9836 9837 # ArgMaxOptionsT 9838 def __init__(self): 9839 self.outputType = 0 # type: int 9840 9841 @classmethod 9842 def InitFromBuf(cls, buf, pos): 9843 argMaxOptions = ArgMaxOptions() 9844 argMaxOptions.Init(buf, pos) 9845 return cls.InitFromObj(argMaxOptions) 9846 9847 @classmethod 9848 def InitFromObj(cls, argMaxOptions): 9849 x = ArgMaxOptionsT() 9850 x._UnPack(argMaxOptions) 9851 return x 9852 9853 # ArgMaxOptionsT 9854 def _UnPack(self, argMaxOptions): 9855 if argMaxOptions is None: 9856 return 9857 self.outputType = argMaxOptions.OutputType() 9858 9859 # ArgMaxOptionsT 9860 def Pack(self, builder): 9861 ArgMaxOptionsStart(builder) 9862 ArgMaxOptionsAddOutputType(builder, self.outputType) 9863 argMaxOptions = ArgMaxOptionsEnd(builder) 9864 return argMaxOptions 9865# automatically generated by the FlatBuffers compiler, do not modify 9866 9867# namespace: tflite 9868 9869from tflite_support.flatbuffers.compat import import_numpy 9870np = import_numpy() 9871 9872class AddOptions(object): 9873 __slots__ = ['_tab'] 9874 9875 @classmethod 9876 def GetRootAsAddOptions(cls, buf, offset): 9877 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 9878 x = AddOptions() 9879 x.Init(buf, n + offset) 9880 return x 9881 9882 @classmethod 9883 def AddOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 9884 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 9885 9886 # AddOptions 9887 def Init(self, buf, pos): 9888 self._tab = flatbuffers.table.Table(buf, pos) 9889 9890 # AddOptions 9891 def FusedActivationFunction(self): 9892 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 9893 if o != 0: 9894 return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) 9895 return 0 9896 9897def AddOptionsStart(builder): builder.StartObject(1) 9898def AddOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0) 9899def AddOptionsEnd(builder): return builder.EndObject() 9900 9901 9902class AddOptionsT(object): 9903 9904 # AddOptionsT 9905 def __init__(self): 9906 self.fusedActivationFunction = 0 # type: int 9907 9908 @classmethod 9909 def InitFromBuf(cls, buf, pos): 9910 addOptions = AddOptions() 9911 addOptions.Init(buf, pos) 9912 return cls.InitFromObj(addOptions) 9913 9914 @classmethod 9915 def InitFromObj(cls, addOptions): 9916 x = AddOptionsT() 9917 x._UnPack(addOptions) 9918 return x 9919 9920 # AddOptionsT 9921 def _UnPack(self, addOptions): 9922 if addOptions is None: 9923 return 9924 self.fusedActivationFunction = addOptions.FusedActivationFunction() 9925 9926 # AddOptionsT 9927 def Pack(self, builder): 9928 AddOptionsStart(builder) 9929 AddOptionsAddFusedActivationFunction(builder, self.fusedActivationFunction) 9930 addOptions = AddOptionsEnd(builder) 9931 return addOptions 9932# automatically generated by the FlatBuffers compiler, do not modify 9933 9934# namespace: tflite 9935 9936from tflite_support.flatbuffers.compat import import_numpy 9937np = import_numpy() 9938 9939class AddNOptions(object): 9940 __slots__ = ['_tab'] 9941 9942 @classmethod 9943 def GetRootAsAddNOptions(cls, buf, offset): 9944 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 9945 x = AddNOptions() 9946 x.Init(buf, n + offset) 9947 return x 9948 9949 @classmethod 9950 def AddNOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 9951 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 9952 9953 # AddNOptions 9954 def Init(self, buf, pos): 9955 self._tab = flatbuffers.table.Table(buf, pos) 9956 9957def AddNOptionsStart(builder): builder.StartObject(0) 9958def AddNOptionsEnd(builder): return builder.EndObject() 9959 9960 9961class AddNOptionsT(object): 9962 9963 # AddNOptionsT 9964 def __init__(self): 9965 pass 9966 9967 @classmethod 9968 def InitFromBuf(cls, buf, pos): 9969 addNOptions = AddNOptions() 9970 addNOptions.Init(buf, pos) 9971 return cls.InitFromObj(addNOptions) 9972 9973 @classmethod 9974 def InitFromObj(cls, addNOptions): 9975 x = AddNOptionsT() 9976 x._UnPack(addNOptions) 9977 return x 9978 9979 # AddNOptionsT 9980 def _UnPack(self, addNOptions): 9981 if addNOptions is None: 9982 return 9983 9984 # AddNOptionsT 9985 def Pack(self, builder): 9986 AddNOptionsStart(builder) 9987 addNOptions = AddNOptionsEnd(builder) 9988 return addNOptions 9989# automatically generated by the FlatBuffers compiler, do not modify 9990 9991# namespace: tflite 9992 9993class ActivationFunctionType(object): 9994 NONE = 0 9995 RELU = 1 9996 RELU_N1_TO_1 = 2 9997 RELU6 = 3 9998 TANH = 4 9999 SIGN_BIT = 5 10000 10001# automatically generated by the FlatBuffers compiler, do not modify 10002 10003# namespace: tflite 10004 10005from tflite_support.flatbuffers.compat import import_numpy 10006np = import_numpy() 10007 10008class AbsOptions(object): 10009 __slots__ = ['_tab'] 10010 10011 @classmethod 10012 def GetRootAsAbsOptions(cls, buf, offset): 10013 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 10014 x = AbsOptions() 10015 x.Init(buf, n + offset) 10016 return x 10017 10018 @classmethod 10019 def AbsOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): 10020 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) 10021 10022 # AbsOptions 10023 def Init(self, buf, pos): 10024 self._tab = flatbuffers.table.Table(buf, pos) 10025 10026def AbsOptionsStart(builder): builder.StartObject(0) 10027def AbsOptionsEnd(builder): return builder.EndObject() 10028 10029 10030class AbsOptionsT(object): 10031 10032 # AbsOptionsT 10033 def __init__(self): 10034 pass 10035 10036 @classmethod 10037 def InitFromBuf(cls, buf, pos): 10038 absOptions = AbsOptions() 10039 absOptions.Init(buf, pos) 10040 return cls.InitFromObj(absOptions) 10041 10042 @classmethod 10043 def InitFromObj(cls, absOptions): 10044 x = AbsOptionsT() 10045 x._UnPack(absOptions) 10046 return x 10047 10048 # AbsOptionsT 10049 def _UnPack(self, absOptions): 10050 if absOptions is None: 10051 return 10052 10053 # AbsOptionsT 10054 def Pack(self, builder): 10055 AbsOptionsStart(builder) 10056 absOptions = AbsOptionsEnd(builder) 10057 return absOptions 10058