Tim Hall | 42abec1 | 2021-02-04 21:31:57 +0000 | [diff] [blame] | 1 | # automatically generated by the FlatBuffers compiler, do not modify |
| 2 | |
| 3 | # namespace: tflite |
| 4 | |
| 5 | import flatbuffers |
Dwight Lidman | 8a12da1 | 2021-07-19 13:43:05 +0200 | [diff] [blame] | 6 | from flatbuffers.compat import import_numpy |
| 7 | np = import_numpy() |
Tim Hall | 42abec1 | 2021-02-04 21:31:57 +0000 | [diff] [blame] | 8 | |
| 9 | class TensorMap(object): |
| 10 | __slots__ = ['_tab'] |
| 11 | |
| 12 | @classmethod |
| 13 | def GetRootAsTensorMap(cls, buf, offset): |
| 14 | n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) |
| 15 | x = TensorMap() |
| 16 | x.Init(buf, n + offset) |
| 17 | return x |
| 18 | |
Dwight Lidman | 8a12da1 | 2021-07-19 13:43:05 +0200 | [diff] [blame] | 19 | @classmethod |
| 20 | def TensorMapBufferHasIdentifier(cls, buf, offset, size_prefixed=False): |
| 21 | return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) |
| 22 | |
Tim Hall | 42abec1 | 2021-02-04 21:31:57 +0000 | [diff] [blame] | 23 | # TensorMap |
| 24 | def Init(self, buf, pos): |
| 25 | self._tab = flatbuffers.table.Table(buf, pos) |
| 26 | |
| 27 | # TensorMap |
| 28 | def Name(self): |
| 29 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) |
| 30 | if o != 0: |
| 31 | return self._tab.String(o + self._tab.Pos) |
| 32 | return None |
| 33 | |
| 34 | # TensorMap |
| 35 | def TensorIndex(self): |
| 36 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) |
| 37 | if o != 0: |
| 38 | return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos) |
| 39 | return 0 |
| 40 | |
| 41 | def TensorMapStart(builder): builder.StartObject(2) |
| 42 | def TensorMapAddName(builder, name): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0) |
| 43 | def TensorMapAddTensorIndex(builder, tensorIndex): builder.PrependUint32Slot(1, tensorIndex, 0) |
| 44 | def TensorMapEnd(builder): return builder.EndObject() |