diff options
author | 오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com> | 2019-07-15 17:59:50 +0900 |
---|---|---|
committer | GitHub Enterprise <noreply-CODE@samsung.com> | 2019-07-15 17:59:50 +0900 |
commit | fca73d18036659b1055f05b839c6f45a8ba5248e (patch) | |
tree | 0d2b8f0c9e72be7655fce5721de44deb813e718b /tools/tflitefile_tool | |
parent | 6097ce0e7d59be4342db40e1bfc104d5ec88c5fa (diff) | |
download | nnfw-fca73d18036659b1055f05b839c6f45a8ba5248e.tar.gz nnfw-fca73d18036659b1055f05b839c6f45a8ba5248e.tar.bz2 nnfw-fca73d18036659b1055f05b839c6f45a8ba5248e.zip |
[model parser] Update to support model using tensorflow 1.13.1 (#5625)
Update generated API files from schma.fbs in tensorflow 1.13.1
Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
Diffstat (limited to 'tools/tflitefile_tool')
21 files changed, 566 insertions, 14 deletions
diff --git a/tools/tflitefile_tool/tflite/AbsOptions.py b/tools/tflitefile_tool/tflite/AbsOptions.py new file mode 100644 index 000000000..748509293 --- /dev/null +++ b/tools/tflitefile_tool/tflite/AbsOptions.py @@ -0,0 +1,28 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers + + +class AbsOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAsAbsOptions(cls, buf, offset): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = AbsOptions() + x.Init(buf, n + offset) + return x + + # AbsOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + +def AbsOptionsStart(builder): + builder.StartObject(0) + + +def AbsOptionsEnd(builder): + return builder.EndObject() diff --git a/tools/tflitefile_tool/tflite/BidirectionalSequenceLSTMOptions.py b/tools/tflitefile_tool/tflite/BidirectionalSequenceLSTMOptions.py new file mode 100644 index 000000000..eac2e27ab --- /dev/null +++ b/tools/tflitefile_tool/tflite/BidirectionalSequenceLSTMOptions.py @@ -0,0 +1,74 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers + + +class BidirectionalSequenceLSTMOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAsBidirectionalSequenceLSTMOptions(cls, buf, offset): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = BidirectionalSequenceLSTMOptions() + x.Init(buf, n + offset) + return x + + # BidirectionalSequenceLSTMOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # BidirectionalSequenceLSTMOptions + def FusedActivationFunction(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) + return 0 + + # BidirectionalSequenceLSTMOptions + def CellClip(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) + return 0.0 + + # BidirectionalSequenceLSTMOptions + def ProjClip(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) + return 0.0 + + # BidirectionalSequenceLSTMOptions + def MergeOutputs(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + return bool( + self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) + return False + + +def BidirectionalSequenceLSTMOptionsStart(builder): + builder.StartObject(4) + + +def BidirectionalSequenceLSTMOptionsAddFusedActivationFunction(builder, + fusedActivationFunction): + builder.PrependInt8Slot(0, fusedActivationFunction, 0) + + +def BidirectionalSequenceLSTMOptionsAddCellClip(builder, cellClip): + builder.PrependFloat32Slot(1, cellClip, 0.0) + + +def BidirectionalSequenceLSTMOptionsAddProjClip(builder, projClip): + builder.PrependFloat32Slot(2, projClip, 0.0) + + +def BidirectionalSequenceLSTMOptionsAddMergeOutputs(builder, mergeOutputs): + builder.PrependBoolSlot(3, mergeOutputs, 0) + + +def BidirectionalSequenceLSTMOptionsEnd(builder): + return builder.EndObject() diff --git a/tools/tflitefile_tool/tflite/BidirectionalSequenceRNNOptions.py b/tools/tflitefile_tool/tflite/BidirectionalSequenceRNNOptions.py index 474ee4ba2..e1d4f6553 100644 --- a/tools/tflitefile_tool/tflite/BidirectionalSequenceRNNOptions.py +++ b/tools/tflitefile_tool/tflite/BidirectionalSequenceRNNOptions.py @@ -34,9 +34,17 @@ class BidirectionalSequenceRNNOptions(object): return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) return 0 + # BidirectionalSequenceRNNOptions + def MergeOutputs(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return bool( + self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) + return False + def BidirectionalSequenceRNNOptionsStart(builder): - builder.StartObject(2) + builder.StartObject(3) def BidirectionalSequenceRNNOptionsAddTimeMajor(builder, timeMajor): @@ -48,5 +56,9 @@ def BidirectionalSequenceRNNOptionsAddFusedActivationFunction(builder, builder.PrependInt8Slot(1, fusedActivationFunction, 0) +def BidirectionalSequenceRNNOptionsAddMergeOutputs(builder, mergeOutputs): + builder.PrependBoolSlot(2, mergeOutputs, 0) + + def BidirectionalSequenceRNNOptionsEnd(builder): return builder.EndObject() diff --git a/tools/tflitefile_tool/tflite/BuiltinOperator.py b/tools/tflitefile_tool/tflite/BuiltinOperator.py index 8e2f9c680..481eeffe8 100644 --- a/tools/tflitefile_tool/tflite/BuiltinOperator.py +++ b/tools/tflitefile_tool/tflite/BuiltinOperator.py @@ -98,3 +98,11 @@ class BuiltinOperator(object): SQUARE = 92 ZEROS_LIKE = 93 FILL = 94 + FLOOR_MOD = 95 + RANGE = 96 + RESIZE_NEAREST_NEIGHBOR = 97 + LEAKY_RELU = 98 + SQUARED_DIFFERENCE = 99 + MIRROR_PAD = 100 + ABS = 101 + SPLIT_V = 102 diff --git a/tools/tflitefile_tool/tflite/BuiltinOptions.py b/tools/tflitefile_tool/tflite/BuiltinOptions.py index 7e1eb34ac..ad115814a 100644 --- a/tools/tflitefile_tool/tflite/BuiltinOptions.py +++ b/tools/tflitefile_tool/tflite/BuiltinOptions.py @@ -73,3 +73,14 @@ class BuiltinOptions(object): SquareOptions = 66 ZerosLikeOptions = 67 FillOptions = 68 + BidirectionalSequenceLSTMOptions = 69 + BidirectionalSequenceRNNOptions = 70 + UnidirectionalSequenceLSTMOptions = 71 + FloorModOptions = 72 + RangeOptions = 73 + ResizeNearestNeighborOptions = 74 + LeakyReluOptions = 75 + SquaredDifferenceOptions = 76 + MirrorPadOptions = 77 + AbsOptions = 78 + SplitVOptions = 79 diff --git a/tools/tflitefile_tool/tflite/CustomQuantization.py b/tools/tflitefile_tool/tflite/CustomQuantization.py new file mode 100644 index 000000000..8cc1db1e2 --- /dev/null +++ b/tools/tflitefile_tool/tflite/CustomQuantization.py @@ -0,0 +1,61 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers + + +class CustomQuantization(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAsCustomQuantization(cls, buf, offset): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = CustomQuantization() + x.Init(buf, n + offset) + return x + + # CustomQuantization + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # CustomQuantization + def Custom(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get( + flatbuffers.number_types.Uint8Flags, + a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) + return 0 + + # CustomQuantization + def CustomAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) + return 0 + + # CustomQuantization + def CustomLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + +def CustomQuantizationStart(builder): + builder.StartObject(1) + + +def CustomQuantizationAddCustom(builder, custom): + builder.PrependUOffsetTRelativeSlot( + 0, flatbuffers.number_types.UOffsetTFlags.py_type(custom), 0) + + +def CustomQuantizationStartCustomVector(builder, numElems): + return builder.StartVector(1, numElems, 1) + + +def CustomQuantizationEnd(builder): + return builder.EndObject() diff --git a/tools/tflitefile_tool/tflite/FakeQuantOptions.py b/tools/tflitefile_tool/tflite/FakeQuantOptions.py index c266bfc9d..6a208e765 100644 --- a/tools/tflitefile_tool/tflite/FakeQuantOptions.py +++ b/tools/tflitefile_tool/tflite/FakeQuantOptions.py @@ -53,12 +53,12 @@ def FakeQuantOptionsStart(builder): builder.StartObject(4) -def FakeQuantOptionsAddMin(builder, min): - builder.PrependFloat32Slot(0, min, 0.0) +def FakeQuantOptionsAddMin(builder, minSlot): + builder.PrependFloat32Slot(0, minSlot, 0.0) -def FakeQuantOptionsAddMax(builder, max): - builder.PrependFloat32Slot(1, max, 0.0) +def FakeQuantOptionsAddMax(builder, maxSlot): + builder.PrependFloat32Slot(1, maxSlot, 0.0) def FakeQuantOptionsAddNumBits(builder, numBits): diff --git a/tools/tflitefile_tool/tflite/FloorModOptions.py b/tools/tflitefile_tool/tflite/FloorModOptions.py new file mode 100644 index 000000000..d2f7b3b48 --- /dev/null +++ b/tools/tflitefile_tool/tflite/FloorModOptions.py @@ -0,0 +1,28 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers + + +class FloorModOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAsFloorModOptions(cls, buf, offset): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = FloorModOptions() + x.Init(buf, n + offset) + return x + + # FloorModOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + +def FloorModOptionsStart(builder): + builder.StartObject(0) + + +def FloorModOptionsEnd(builder): + return builder.EndObject() diff --git a/tools/tflitefile_tool/tflite/LSHProjectionOptions.py b/tools/tflitefile_tool/tflite/LSHProjectionOptions.py index 055eb75ff..ea1e20bbe 100644 --- a/tools/tflitefile_tool/tflite/LSHProjectionOptions.py +++ b/tools/tflitefile_tool/tflite/LSHProjectionOptions.py @@ -31,8 +31,8 @@ def LSHProjectionOptionsStart(builder): builder.StartObject(1) -def LSHProjectionOptionsAddType(builder, type): - builder.PrependInt8Slot(0, type, 0) +def LSHProjectionOptionsAddType(builder, typeSlot): + builder.PrependInt8Slot(0, typeSlot, 0) def LSHProjectionOptionsEnd(builder): diff --git a/tools/tflitefile_tool/tflite/LeakyReluOptions.py b/tools/tflitefile_tool/tflite/LeakyReluOptions.py new file mode 100644 index 000000000..a4ffa3759 --- /dev/null +++ b/tools/tflitefile_tool/tflite/LeakyReluOptions.py @@ -0,0 +1,39 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers + + +class LeakyReluOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAsLeakyReluOptions(cls, buf, offset): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = LeakyReluOptions() + x.Init(buf, n + offset) + return x + + # LeakyReluOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # LeakyReluOptions + def Alpha(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) + return 0.0 + + +def LeakyReluOptionsStart(builder): + builder.StartObject(1) + + +def LeakyReluOptionsAddAlpha(builder, alpha): + builder.PrependFloat32Slot(0, alpha, 0.0) + + +def LeakyReluOptionsEnd(builder): + return builder.EndObject() diff --git a/tools/tflitefile_tool/tflite/MirrorPadMode.py b/tools/tflitefile_tool/tflite/MirrorPadMode.py new file mode 100644 index 000000000..85718ebf2 --- /dev/null +++ b/tools/tflitefile_tool/tflite/MirrorPadMode.py @@ -0,0 +1,8 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + + +class MirrorPadMode(object): + REFLECT = 0 + SYMMETRIC = 1 diff --git a/tools/tflitefile_tool/tflite/MirrorPadOptions.py b/tools/tflitefile_tool/tflite/MirrorPadOptions.py new file mode 100644 index 000000000..4d908e15b --- /dev/null +++ b/tools/tflitefile_tool/tflite/MirrorPadOptions.py @@ -0,0 +1,39 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers + + +class MirrorPadOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAsMirrorPadOptions(cls, buf, offset): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = MirrorPadOptions() + x.Init(buf, n + offset) + return x + + # MirrorPadOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # MirrorPadOptions + def Mode(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) + return 0 + + +def MirrorPadOptionsStart(builder): + builder.StartObject(1) + + +def MirrorPadOptionsAddMode(builder, mode): + builder.PrependInt8Slot(0, mode, 0) + + +def MirrorPadOptionsEnd(builder): + return builder.EndObject() diff --git a/tools/tflitefile_tool/tflite/QuantizationDetails.py b/tools/tflitefile_tool/tflite/QuantizationDetails.py new file mode 100644 index 000000000..93e322e18 --- /dev/null +++ b/tools/tflitefile_tool/tflite/QuantizationDetails.py @@ -0,0 +1,8 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + + +class QuantizationDetails(object): + NONE = 0 + CustomQuantization = 1 diff --git a/tools/tflitefile_tool/tflite/QuantizationParameters.py b/tools/tflitefile_tool/tflite/QuantizationParameters.py index 7d5e53072..9a752d7e5 100644 --- a/tools/tflitefile_tool/tflite/QuantizationParameters.py +++ b/tools/tflitefile_tool/tflite/QuantizationParameters.py @@ -115,23 +115,40 @@ class QuantizationParameters(object): return self._tab.VectorLen(o) return 0 + # QuantizationParameters + def DetailsType(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) + return 0 + + # QuantizationParameters + def Details(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) + if o != 0: + from flatbuffers.table import Table + obj = Table(bytearray(), 0) + self._tab.Union(obj, o) + return obj + return None + def QuantizationParametersStart(builder): - builder.StartObject(4) + builder.StartObject(6) -def QuantizationParametersAddMin(builder, min): +def QuantizationParametersAddMin(builder, minSlot): builder.PrependUOffsetTRelativeSlot( - 0, flatbuffers.number_types.UOffsetTFlags.py_type(min), 0) + 0, flatbuffers.number_types.UOffsetTFlags.py_type(minSlot), 0) def QuantizationParametersStartMinVector(builder, numElems): return builder.StartVector(4, numElems, 4) -def QuantizationParametersAddMax(builder, max): +def QuantizationParametersAddMax(builder, maxSlot): builder.PrependUOffsetTRelativeSlot( - 1, flatbuffers.number_types.UOffsetTFlags.py_type(max), 0) + 1, flatbuffers.number_types.UOffsetTFlags.py_type(maxSlot), 0) def QuantizationParametersStartMaxVector(builder, numElems): @@ -156,5 +173,14 @@ def QuantizationParametersStartZeroPointVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def QuantizationParametersAddDetailsType(builder, detailsType): + builder.PrependUint8Slot(4, detailsType, 0) + + +def QuantizationParametersAddDetails(builder, details): + builder.PrependUOffsetTRelativeSlot( + 5, flatbuffers.number_types.UOffsetTFlags.py_type(details), 0) + + def QuantizationParametersEnd(builder): return builder.EndObject() diff --git a/tools/tflitefile_tool/tflite/RangeOptions.py b/tools/tflitefile_tool/tflite/RangeOptions.py new file mode 100644 index 000000000..917795f6a --- /dev/null +++ b/tools/tflitefile_tool/tflite/RangeOptions.py @@ -0,0 +1,28 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers + + +class RangeOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAsRangeOptions(cls, buf, offset): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = RangeOptions() + x.Init(buf, n + offset) + return x + + # RangeOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + +def RangeOptionsStart(builder): + builder.StartObject(0) + + +def RangeOptionsEnd(builder): + return builder.EndObject() diff --git a/tools/tflitefile_tool/tflite/ResizeNearestNeighborOptions.py b/tools/tflitefile_tool/tflite/ResizeNearestNeighborOptions.py new file mode 100644 index 000000000..5ce4f75ba --- /dev/null +++ b/tools/tflitefile_tool/tflite/ResizeNearestNeighborOptions.py @@ -0,0 +1,40 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers + + +class ResizeNearestNeighborOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAsResizeNearestNeighborOptions(cls, buf, offset): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = ResizeNearestNeighborOptions() + x.Init(buf, n + offset) + return x + + # ResizeNearestNeighborOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # ResizeNearestNeighborOptions + def AlignCorners(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return bool( + self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) + return False + + +def ResizeNearestNeighborOptionsStart(builder): + builder.StartObject(1) + + +def ResizeNearestNeighborOptionsAddAlignCorners(builder, alignCorners): + builder.PrependBoolSlot(0, alignCorners, 0) + + +def ResizeNearestNeighborOptionsEnd(builder): + return builder.EndObject() diff --git a/tools/tflitefile_tool/tflite/SplitVOptions.py b/tools/tflitefile_tool/tflite/SplitVOptions.py new file mode 100644 index 000000000..37816ce5b --- /dev/null +++ b/tools/tflitefile_tool/tflite/SplitVOptions.py @@ -0,0 +1,39 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers + + +class SplitVOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAsSplitVOptions(cls, buf, offset): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = SplitVOptions() + x.Init(buf, n + offset) + return x + + # SplitVOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # SplitVOptions + def NumSplits(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) + return 0 + + +def SplitVOptionsStart(builder): + builder.StartObject(1) + + +def SplitVOptionsAddNumSplits(builder, numSplits): + builder.PrependInt32Slot(0, numSplits, 0) + + +def SplitVOptionsEnd(builder): + return builder.EndObject() diff --git a/tools/tflitefile_tool/tflite/SquaredDifferenceOptions.py b/tools/tflitefile_tool/tflite/SquaredDifferenceOptions.py new file mode 100644 index 000000000..17e022f34 --- /dev/null +++ b/tools/tflitefile_tool/tflite/SquaredDifferenceOptions.py @@ -0,0 +1,28 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers + + +class SquaredDifferenceOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAsSquaredDifferenceOptions(cls, buf, offset): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = SquaredDifferenceOptions() + x.Init(buf, n + offset) + return x + + # SquaredDifferenceOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + +def SquaredDifferenceOptionsStart(builder): + builder.StartObject(0) + + +def SquaredDifferenceOptionsEnd(builder): + return builder.EndObject() diff --git a/tools/tflitefile_tool/tflite/Tensor.py b/tools/tflitefile_tool/tflite/Tensor.py index e5f13301c..120cce50b 100644 --- a/tools/tflitefile_tool/tflite/Tensor.py +++ b/tools/tflitefile_tool/tflite/Tensor.py @@ -97,8 +97,8 @@ def TensorStartShapeVector(builder, numElems): return builder.StartVector(4, numElems, 4) -def TensorAddType(builder, type): - builder.PrependInt8Slot(1, type, 0) +def TensorAddType(builder, typeSlot): + builder.PrependInt8Slot(1, typeSlot, 0) def TensorAddBuffer(builder, buffer): diff --git a/tools/tflitefile_tool/tflite/TensorType.py b/tools/tflitefile_tool/tflite/TensorType.py index e375c65ee..ac7fe2014 100644 --- a/tools/tflitefile_tool/tflite/TensorType.py +++ b/tools/tflitefile_tool/tflite/TensorType.py @@ -13,3 +13,4 @@ class TensorType(object): BOOL = 6 INT16 = 7 COMPLEX64 = 8 + INT8 = 9 diff --git a/tools/tflitefile_tool/tflite/UnidirectionalSequenceLSTMOptions.py b/tools/tflitefile_tool/tflite/UnidirectionalSequenceLSTMOptions.py new file mode 100644 index 000000000..ffbb6378f --- /dev/null +++ b/tools/tflitefile_tool/tflite/UnidirectionalSequenceLSTMOptions.py @@ -0,0 +1,74 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers + + +class UnidirectionalSequenceLSTMOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAsUnidirectionalSequenceLSTMOptions(cls, buf, offset): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = UnidirectionalSequenceLSTMOptions() + x.Init(buf, n + offset) + return x + + # UnidirectionalSequenceLSTMOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # UnidirectionalSequenceLSTMOptions + def FusedActivationFunction(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) + return 0 + + # UnidirectionalSequenceLSTMOptions + def CellClip(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) + return 0.0 + + # UnidirectionalSequenceLSTMOptions + def ProjClip(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) + return 0.0 + + # UnidirectionalSequenceLSTMOptions + def TimeMajor(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + return bool( + self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) + return False + + +def UnidirectionalSequenceLSTMOptionsStart(builder): + builder.StartObject(4) + + +def UnidirectionalSequenceLSTMOptionsAddFusedActivationFunction( + builder, fusedActivationFunction): + builder.PrependInt8Slot(0, fusedActivationFunction, 0) + + +def UnidirectionalSequenceLSTMOptionsAddCellClip(builder, cellClip): + builder.PrependFloat32Slot(1, cellClip, 0.0) + + +def UnidirectionalSequenceLSTMOptionsAddProjClip(builder, projClip): + builder.PrependFloat32Slot(2, projClip, 0.0) + + +def UnidirectionalSequenceLSTMOptionsAddTimeMajor(builder, timeMajor): + builder.PrependBoolSlot(3, timeMajor, 0) + + +def UnidirectionalSequenceLSTMOptionsEnd(builder): + return builder.EndObject() |