From f4a511ffe7cd6c77e2effcbdf0843b2ef89d8df4 Mon Sep 17 00:00:00 2001 From: William Isaksson Date: Wed, 22 Nov 2023 22:27:58 +0100 Subject: MLBEDSW-8157: Update to TensorFlow 2.15 Updates to TensorFlow 2.15. No StableHLO operators were added to Vela since these are subject to change and have almost no runtime support. - FlatBuffers version was unchanged. Change-Id: I9a506a2dcc2e0bc2498742e857bbb6d69b19ac1b Signed-off-by: William Isaksson Signed-off-by: Rickard Bolin --- README.md | 4 +- SUPPORTED_OPS.md | 2 +- ethosu/vela/operation.py | 2 + ethosu/vela/tflite/BuiltinOperator.py | 44 +++ ethosu/vela/tflite/BuiltinOptions2.py | 26 ++ ethosu/vela/tflite/Conv2DOptions.py | 12 +- ethosu/vela/tflite/DilateOptions.py | 36 ++ ethosu/vela/tflite/FullyConnectedOptions.py | 12 +- ethosu/vela/tflite/Operator.py | 25 +- ethosu/vela/tflite/ReduceWindowFunction.py | 12 + ethosu/vela/tflite/ReduceWindowOptions.py | 46 +++ ethosu/vela/tflite/RngAlgorithm.py | 8 + .../vela/tflite/StablehloBroadcastInDimOptions.py | 69 ++++ ethosu/vela/tflite/StablehloCompareOptions.py | 56 +++ ethosu/vela/tflite/StablehloComparisonDirection.py | 11 + ethosu/vela/tflite/StablehloComparisonType.py | 10 + ethosu/vela/tflite/StablehloConcatenateOptions.py | 46 +++ ethosu/vela/tflite/StablehloConvolutionOptions.py | 413 +++++++++++++++++++++ ethosu/vela/tflite/StablehloCustomCallOptions.py | 142 +++++++ ethosu/vela/tflite/StablehloDotGeneralOptions.py | 201 ++++++++++ ethosu/vela/tflite/StablehloDynamicSliceOptions.py | 69 ++++ ethosu/vela/tflite/StablehloGatherOptions.py | 188 ++++++++++ ethosu/vela/tflite/StablehloIotaOptions.py | 46 +++ ethosu/vela/tflite/StablehloPadOptions.py | 135 +++++++ ethosu/vela/tflite/StablehloPrecisionConfig.py | 8 + ethosu/vela/tflite/StablehloReduceOptions.py | 79 ++++ ethosu/vela/tflite/StablehloReduceWindowOptions.py | 211 +++++++++++ .../vela/tflite/StablehloRngBitGeneratorOptions.py | 46 +++ ethosu/vela/tflite/StablehloScatterOptions.py | 175 +++++++++ ethosu/vela/tflite/StablehloSliceOptions.py | 135 +++++++ ethosu/vela/tflite/StablehloSortOptions.py | 66 ++++ ethosu/vela/tflite/StablehloTransposeOptions.py | 69 ++++ ethosu/vela/tflite/StablehloWhileOptions.py | 56 +++ ethosu/vela/tflite/TransposeConvOptions.py | 12 +- ethosu/vela/tflite_mapping.py | 28 +- ethosu/vela/tflite_supported_operators.py | 10 +- ethosu/vela/tflite_writer.py | 8 +- 37 files changed, 2505 insertions(+), 13 deletions(-) create mode 100644 ethosu/vela/tflite/BuiltinOptions2.py create mode 100644 ethosu/vela/tflite/DilateOptions.py create mode 100644 ethosu/vela/tflite/ReduceWindowFunction.py create mode 100644 ethosu/vela/tflite/ReduceWindowOptions.py create mode 100644 ethosu/vela/tflite/RngAlgorithm.py create mode 100644 ethosu/vela/tflite/StablehloBroadcastInDimOptions.py create mode 100644 ethosu/vela/tflite/StablehloCompareOptions.py create mode 100644 ethosu/vela/tflite/StablehloComparisonDirection.py create mode 100644 ethosu/vela/tflite/StablehloComparisonType.py create mode 100644 ethosu/vela/tflite/StablehloConcatenateOptions.py create mode 100644 ethosu/vela/tflite/StablehloConvolutionOptions.py create mode 100644 ethosu/vela/tflite/StablehloCustomCallOptions.py create mode 100644 ethosu/vela/tflite/StablehloDotGeneralOptions.py create mode 100644 ethosu/vela/tflite/StablehloDynamicSliceOptions.py create mode 100644 ethosu/vela/tflite/StablehloGatherOptions.py create mode 100644 ethosu/vela/tflite/StablehloIotaOptions.py create mode 100644 ethosu/vela/tflite/StablehloPadOptions.py create mode 100644 ethosu/vela/tflite/StablehloPrecisionConfig.py create mode 100644 ethosu/vela/tflite/StablehloReduceOptions.py create mode 100644 ethosu/vela/tflite/StablehloReduceWindowOptions.py create mode 100644 ethosu/vela/tflite/StablehloRngBitGeneratorOptions.py create mode 100644 ethosu/vela/tflite/StablehloScatterOptions.py create mode 100644 ethosu/vela/tflite/StablehloSliceOptions.py create mode 100644 ethosu/vela/tflite/StablehloSortOptions.py create mode 100644 ethosu/vela/tflite/StablehloTransposeOptions.py create mode 100644 ethosu/vela/tflite/StablehloWhileOptions.py diff --git a/README.md b/README.md index 35c8d3a..95e7ddf 100644 --- a/README.md +++ b/README.md @@ -50,8 +50,8 @@ optimised operators against that of the corresponding TensorFlow Lite reference kernels (or TensorFlow Lite for Microcontrollers reference kernels in the case of the UNIDIRECTIONAL_SEQUENCE_LSTM operator). The following list indicates which version is used for comparison: - -* Vela 3.10.0 to current supports TensorFlow 2.14 +* Vela 3.11.0 to current supports TensorFlow 2.15 +* Vela 3.10.0 supports TensorFlow 2.14 * Vela 3.9.0 supports TensorFlow 2.12 * Vela 3.8.0 supports TensorFlow 2.11 * Vela 3.6.0 to 3.7.0 supports TensorFlow 2.10 diff --git a/SUPPORTED_OPS.md b/SUPPORTED_OPS.md index c0e2b0b..b2bd096 100644 --- a/SUPPORTED_OPS.md +++ b/SUPPORTED_OPS.md @@ -19,7 +19,7 @@ limitations under the License. # Supported Ops This file was automatically generated by Vela using the `--supported-ops-report` parameter. -Vela version: `3.10.0` +Vela version: `3.11.0.` This file complies with [**Gitiles Markdown syntax**](https://gerrit.googlesource.com/gitiles/+/HEAD/Documentation/markdown.md) diff --git a/ethosu/vela/operation.py b/ethosu/vela/operation.py index c9a30b2..9b4149f 100644 --- a/ethosu/vela/operation.py +++ b/ethosu/vela/operation.py @@ -337,6 +337,8 @@ class Op(Enum): Bitcast = OperatorInfo() BitwiseXor = OperatorInfo() RightShift = OperatorInfo() + Dilate = OperatorInfo() + ReduceWindow = OperatorInfo() @property def info(self): diff --git a/ethosu/vela/tflite/BuiltinOperator.py b/ethosu/vela/tflite/BuiltinOperator.py index ec2c147..6853f3a 100644 --- a/ethosu/vela/tflite/BuiltinOperator.py +++ b/ethosu/vela/tflite/BuiltinOperator.py @@ -165,3 +165,47 @@ class BuiltinOperator(object): BITCAST = 159 BITWISE_XOR = 160 RIGHT_SHIFT = 161 + STABLEHLO_LOGISTIC = 162 + STABLEHLO_ADD = 163 + STABLEHLO_DIVIDE = 164 + STABLEHLO_MULTIPLY = 165 + STABLEHLO_MAXIMUM = 166 + STABLEHLO_RESHAPE = 167 + STABLEHLO_CLAMP = 168 + STABLEHLO_CONCATENATE = 169 + STABLEHLO_BROADCAST_IN_DIM = 170 + STABLEHLO_CONVOLUTION = 171 + STABLEHLO_SLICE = 172 + STABLEHLO_CUSTOM_CALL = 173 + STABLEHLO_REDUCE = 174 + STABLEHLO_ABS = 175 + STABLEHLO_AND = 176 + STABLEHLO_COSINE = 177 + STABLEHLO_EXPONENTIAL = 178 + STABLEHLO_FLOOR = 179 + STABLEHLO_LOG = 180 + STABLEHLO_MINIMUM = 181 + STABLEHLO_NEGATE = 182 + STABLEHLO_OR = 183 + STABLEHLO_POWER = 184 + STABLEHLO_REMAINDER = 185 + STABLEHLO_RSQRT = 186 + STABLEHLO_SELECT = 187 + STABLEHLO_SUBTRACT = 188 + STABLEHLO_TANH = 189 + STABLEHLO_SCATTER = 190 + STABLEHLO_COMPARE = 191 + STABLEHLO_CONVERT = 192 + STABLEHLO_DYNAMIC_SLICE = 193 + STABLEHLO_DYNAMIC_UPDATE_SLICE = 194 + STABLEHLO_PAD = 195 + STABLEHLO_IOTA = 196 + STABLEHLO_DOT_GENERAL = 197 + STABLEHLO_REDUCE_WINDOW = 198 + STABLEHLO_SORT = 199 + STABLEHLO_WHILE = 200 + STABLEHLO_GATHER = 201 + STABLEHLO_TRANSPOSE = 202 + DILATE = 203 + STABLEHLO_RNG_BIT_GENERATOR = 204 + REDUCE_WINDOW = 205 diff --git a/ethosu/vela/tflite/BuiltinOptions2.py b/ethosu/vela/tflite/BuiltinOptions2.py new file mode 100644 index 0000000..a557e16 --- /dev/null +++ b/ethosu/vela/tflite/BuiltinOptions2.py @@ -0,0 +1,26 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +class BuiltinOptions2(object): + NONE = 0 + StablehloConcatenateOptions = 1 + StablehloBroadcastInDimOptions = 2 + StablehloSliceOptions = 3 + StablehloConvolutionOptions = 4 + StablehloCustomCallOptions = 5 + StablehloReduceOptions = 6 + StablehloScatterOptions = 7 + StablehloCompareOptions = 8 + StablehloDynamicSliceOptions = 9 + StablehloPadOptions = 10 + StablehloIotaOptions = 11 + StablehloDotGeneralOptions = 12 + StablehloReduceWindowOptions = 13 + StablehloSortOptions = 14 + StablehloWhileOptions = 15 + StablehloGatherOptions = 16 + StablehloTransposeOptions = 17 + DilateOptions = 18 + StablehloRngBitGeneratorOptions = 19 + ReduceWindowOptions = 20 diff --git a/ethosu/vela/tflite/Conv2DOptions.py b/ethosu/vela/tflite/Conv2DOptions.py index 5928009..de2be19 100644 --- a/ethosu/vela/tflite/Conv2DOptions.py +++ b/ethosu/vela/tflite/Conv2DOptions.py @@ -70,7 +70,14 @@ class Conv2DOptions(object): return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) return 1 -def Conv2DOptionsStart(builder): builder.StartObject(6) + # Conv2DOptions + def QuantizedBiasType(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) + return 0 + +def Conv2DOptionsStart(builder): builder.StartObject(7) def Start(builder): return Conv2DOptionsStart(builder) def Conv2DOptionsAddPadding(builder, padding): builder.PrependInt8Slot(0, padding, 0) @@ -91,6 +98,9 @@ def AddDilationWFactor(builder, dilationWFactor): def Conv2DOptionsAddDilationHFactor(builder, dilationHFactor): builder.PrependInt32Slot(5, dilationHFactor, 1) def AddDilationHFactor(builder, dilationHFactor): return Conv2DOptionsAddDilationHFactor(builder, dilationHFactor) +def Conv2DOptionsAddQuantizedBiasType(builder, quantizedBiasType): builder.PrependInt8Slot(6, quantizedBiasType, 0) +def AddQuantizedBiasType(builder, quantizedBiasType): + return Conv2DOptionsAddQuantizedBiasType(builder, quantizedBiasType) def Conv2DOptionsEnd(builder): return builder.EndObject() def End(builder): return Conv2DOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/DilateOptions.py b/ethosu/vela/tflite/DilateOptions.py new file mode 100644 index 0000000..5fa3bfa --- /dev/null +++ b/ethosu/vela/tflite/DilateOptions.py @@ -0,0 +1,36 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class DilateOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = DilateOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsDilateOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def DilateOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # DilateOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + +def DilateOptionsStart(builder): builder.StartObject(0) +def Start(builder): + return DilateOptionsStart(builder) +def DilateOptionsEnd(builder): return builder.EndObject() +def End(builder): + return DilateOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/FullyConnectedOptions.py b/ethosu/vela/tflite/FullyConnectedOptions.py index 67ca53c..1ac220c 100644 --- a/ethosu/vela/tflite/FullyConnectedOptions.py +++ b/ethosu/vela/tflite/FullyConnectedOptions.py @@ -56,7 +56,14 @@ class FullyConnectedOptions(object): return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) return False -def FullyConnectedOptionsStart(builder): builder.StartObject(4) + # FullyConnectedOptions + def QuantizedBiasType(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) + return 0 + +def FullyConnectedOptionsStart(builder): builder.StartObject(5) def Start(builder): return FullyConnectedOptionsStart(builder) def FullyConnectedOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(0, fusedActivationFunction, 0) @@ -71,6 +78,9 @@ def AddKeepNumDims(builder, keepNumDims): def FullyConnectedOptionsAddAsymmetricQuantizeInputs(builder, asymmetricQuantizeInputs): builder.PrependBoolSlot(3, asymmetricQuantizeInputs, 0) def AddAsymmetricQuantizeInputs(builder, asymmetricQuantizeInputs): return FullyConnectedOptionsAddAsymmetricQuantizeInputs(builder, asymmetricQuantizeInputs) +def FullyConnectedOptionsAddQuantizedBiasType(builder, quantizedBiasType): builder.PrependInt8Slot(4, quantizedBiasType, 0) +def AddQuantizedBiasType(builder, quantizedBiasType): + return FullyConnectedOptionsAddQuantizedBiasType(builder, quantizedBiasType) def FullyConnectedOptionsEnd(builder): return builder.EndObject() def End(builder): return FullyConnectedOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/Operator.py b/ethosu/vela/tflite/Operator.py index 23d787b..a0b5a54 100644 --- a/ethosu/vela/tflite/Operator.py +++ b/ethosu/vela/tflite/Operator.py @@ -208,7 +208,24 @@ class Operator(object): return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos) return 0 -def OperatorStart(builder): builder.StartObject(11) + # Operator + def BuiltinOptions2Type(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) + return 0 + + # Operator + def BuiltinOptions2(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28)) + if o != 0: + from flatbuffers.table import Table + obj = Table(bytearray(), 0) + self._tab.Union(obj, o) + return obj + return None + +def OperatorStart(builder): builder.StartObject(13) def Start(builder): return OperatorStart(builder) def OperatorAddOpcodeIndex(builder, opcodeIndex): builder.PrependUint32Slot(0, opcodeIndex, 0) @@ -259,6 +276,12 @@ def AddLargeCustomOptionsOffset(builder, largeCustomOptionsOffset): def OperatorAddLargeCustomOptionsSize(builder, largeCustomOptionsSize): builder.PrependUint64Slot(10, largeCustomOptionsSize, 0) def AddLargeCustomOptionsSize(builder, largeCustomOptionsSize): return OperatorAddLargeCustomOptionsSize(builder, largeCustomOptionsSize) +def OperatorAddBuiltinOptions2Type(builder, builtinOptions2Type): builder.PrependUint8Slot(11, builtinOptions2Type, 0) +def AddBuiltinOptions2Type(builder, builtinOptions2Type): + return OperatorAddBuiltinOptions2Type(builder, builtinOptions2Type) +def OperatorAddBuiltinOptions2(builder, builtinOptions2): builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(builtinOptions2), 0) +def AddBuiltinOptions2(builder, builtinOptions2): + return OperatorAddBuiltinOptions2(builder, builtinOptions2) def OperatorEnd(builder): return builder.EndObject() def End(builder): return OperatorEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/ReduceWindowFunction.py b/ethosu/vela/tflite/ReduceWindowFunction.py new file mode 100644 index 0000000..65dea2e --- /dev/null +++ b/ethosu/vela/tflite/ReduceWindowFunction.py @@ -0,0 +1,12 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +class ReduceWindowFunction(object): + UNSUPPORTED = 0 + ADD = 1 + MUL = 2 + MINIMUM = 3 + MAXIMUM = 4 + ALL = 5 + ANY = 6 diff --git a/ethosu/vela/tflite/ReduceWindowOptions.py b/ethosu/vela/tflite/ReduceWindowOptions.py new file mode 100644 index 0000000..a952bee --- /dev/null +++ b/ethosu/vela/tflite/ReduceWindowOptions.py @@ -0,0 +1,46 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class ReduceWindowOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = ReduceWindowOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsReduceWindowOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def ReduceWindowOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # ReduceWindowOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # ReduceWindowOptions + def ReduceFunction(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 ReduceWindowOptionsStart(builder): builder.StartObject(1) +def Start(builder): + return ReduceWindowOptionsStart(builder) +def ReduceWindowOptionsAddReduceFunction(builder, reduceFunction): builder.PrependInt32Slot(0, reduceFunction, 0) +def AddReduceFunction(builder, reduceFunction): + return ReduceWindowOptionsAddReduceFunction(builder, reduceFunction) +def ReduceWindowOptionsEnd(builder): return builder.EndObject() +def End(builder): + return ReduceWindowOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/RngAlgorithm.py b/ethosu/vela/tflite/RngAlgorithm.py new file mode 100644 index 0000000..704c05e --- /dev/null +++ b/ethosu/vela/tflite/RngAlgorithm.py @@ -0,0 +1,8 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +class RngAlgorithm(object): + DEFAULT = 0 + PHILOX = 1 + THREEFRY = 2 diff --git a/ethosu/vela/tflite/StablehloBroadcastInDimOptions.py b/ethosu/vela/tflite/StablehloBroadcastInDimOptions.py new file mode 100644 index 0000000..28c8060 --- /dev/null +++ b/ethosu/vela/tflite/StablehloBroadcastInDimOptions.py @@ -0,0 +1,69 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloBroadcastInDimOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloBroadcastInDimOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloBroadcastInDimOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloBroadcastInDimOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloBroadcastInDimOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloBroadcastInDimOptions + def BroadcastDimensions(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.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloBroadcastInDimOptions + def BroadcastDimensionsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloBroadcastInDimOptions + def BroadcastDimensionsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloBroadcastInDimOptions + def BroadcastDimensionsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + return o == 0 + +def StablehloBroadcastInDimOptionsStart(builder): builder.StartObject(1) +def Start(builder): + return StablehloBroadcastInDimOptionsStart(builder) +def StablehloBroadcastInDimOptionsAddBroadcastDimensions(builder, broadcastDimensions): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(broadcastDimensions), 0) +def AddBroadcastDimensions(builder, broadcastDimensions): + return StablehloBroadcastInDimOptionsAddBroadcastDimensions(builder, broadcastDimensions) +def StablehloBroadcastInDimOptionsStartBroadcastDimensionsVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartBroadcastDimensionsVector(builder, numElems): + return StablehloBroadcastInDimOptionsStartBroadcastDimensionsVector(builder, numElems) +def StablehloBroadcastInDimOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloBroadcastInDimOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/StablehloCompareOptions.py b/ethosu/vela/tflite/StablehloCompareOptions.py new file mode 100644 index 0000000..6d3363b --- /dev/null +++ b/ethosu/vela/tflite/StablehloCompareOptions.py @@ -0,0 +1,56 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloCompareOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloCompareOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloCompareOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloCompareOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloCompareOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloCompareOptions + def ComparisonDirection(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos) + return 0 + + # StablehloCompareOptions + def CompareType(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos) + return 0 + +def StablehloCompareOptionsStart(builder): builder.StartObject(2) +def Start(builder): + return StablehloCompareOptionsStart(builder) +def StablehloCompareOptionsAddComparisonDirection(builder, comparisonDirection): builder.PrependUint32Slot(0, comparisonDirection, 0) +def AddComparisonDirection(builder, comparisonDirection): + return StablehloCompareOptionsAddComparisonDirection(builder, comparisonDirection) +def StablehloCompareOptionsAddCompareType(builder, compareType): builder.PrependUint32Slot(1, compareType, 0) +def AddCompareType(builder, compareType): + return StablehloCompareOptionsAddCompareType(builder, compareType) +def StablehloCompareOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloCompareOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/StablehloComparisonDirection.py b/ethosu/vela/tflite/StablehloComparisonDirection.py new file mode 100644 index 0000000..5757a15 --- /dev/null +++ b/ethosu/vela/tflite/StablehloComparisonDirection.py @@ -0,0 +1,11 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +class StablehloComparisonDirection(object): + STABLEHLO_COMPARISON_DIRECTION_EQ = 0 + STABLEHLO_COMPARISON_DIRECTION_NE = 1 + STABLEHLO_COMPARISON_DIRECTION_GE = 2 + STABLEHLO_COMPARISON_DIRECTION_GT = 3 + STABLEHLO_COMPARISON_DIRECTION_LE = 4 + STABLEHLO_COMPARISON_DIRECTION_LT = 5 diff --git a/ethosu/vela/tflite/StablehloComparisonType.py b/ethosu/vela/tflite/StablehloComparisonType.py new file mode 100644 index 0000000..a3e2701 --- /dev/null +++ b/ethosu/vela/tflite/StablehloComparisonType.py @@ -0,0 +1,10 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +class StablehloComparisonType(object): + STABLEHLO_COMPARISON_TYPE_NOTYPE = 0 + STABLEHLO_COMPARISON_TYPE_FLOAT = 1 + STABLEHLO_COMPARISON_TYPE_FLOAT_TOTAL_ORDER = 2 + STABLEHLO_COMPARISON_TYPE_SIGNED = 3 + STABLEHLO_COMPARISON_TYPE_UNSIGNED = 4 diff --git a/ethosu/vela/tflite/StablehloConcatenateOptions.py b/ethosu/vela/tflite/StablehloConcatenateOptions.py new file mode 100644 index 0000000..4a9f0c7 --- /dev/null +++ b/ethosu/vela/tflite/StablehloConcatenateOptions.py @@ -0,0 +1,46 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloConcatenateOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloConcatenateOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloConcatenateOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloConcatenateOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloConcatenateOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloConcatenateOptions + def Dimension(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) + return 0 + +def StablehloConcatenateOptionsStart(builder): builder.StartObject(1) +def Start(builder): + return StablehloConcatenateOptionsStart(builder) +def StablehloConcatenateOptionsAddDimension(builder, dimension): builder.PrependInt64Slot(0, dimension, 0) +def AddDimension(builder, dimension): + return StablehloConcatenateOptionsAddDimension(builder, dimension) +def StablehloConcatenateOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloConcatenateOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/StablehloConvolutionOptions.py b/ethosu/vela/tflite/StablehloConvolutionOptions.py new file mode 100644 index 0000000..2ab3fab --- /dev/null +++ b/ethosu/vela/tflite/StablehloConvolutionOptions.py @@ -0,0 +1,413 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloConvolutionOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloConvolutionOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloConvolutionOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloConvolutionOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloConvolutionOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloConvolutionOptions + def WindowStrides(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.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloConvolutionOptions + def WindowStridesAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloConvolutionOptions + def WindowStridesLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloConvolutionOptions + def WindowStridesIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + return o == 0 + + # StablehloConvolutionOptions + def Padding(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloConvolutionOptions + def PaddingAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloConvolutionOptions + def PaddingLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloConvolutionOptions + def PaddingIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + return o == 0 + + # StablehloConvolutionOptions + def LhsDilation(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloConvolutionOptions + def LhsDilationAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloConvolutionOptions + def LhsDilationLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloConvolutionOptions + def LhsDilationIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + return o == 0 + + # StablehloConvolutionOptions + def RhsDilation(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloConvolutionOptions + def RhsDilationAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloConvolutionOptions + def RhsDilationLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloConvolutionOptions + def RhsDilationIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + return o == 0 + + # StablehloConvolutionOptions + def WindowReversal(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.BoolFlags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) + return 0 + + # StablehloConvolutionOptions + def WindowReversalAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.BoolFlags, o) + return 0 + + # StablehloConvolutionOptions + def WindowReversalLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloConvolutionOptions + def WindowReversalIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + return o == 0 + + # StablehloConvolutionOptions + def InputBatchDimension(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) + return 0 + + # StablehloConvolutionOptions + def InputFeatureDimension(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) + return 0 + + # StablehloConvolutionOptions + def InputSpatialDimensions(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloConvolutionOptions + def InputSpatialDimensionsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloConvolutionOptions + def InputSpatialDimensionsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloConvolutionOptions + def InputSpatialDimensionsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) + return o == 0 + + # StablehloConvolutionOptions + def KernelInputFeatureDimension(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) + return 0 + + # StablehloConvolutionOptions + def KernelOutputFeatureDimension(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) + return 0 + + # StablehloConvolutionOptions + def KernelSpatialDimensions(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloConvolutionOptions + def KernelSpatialDimensionsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloConvolutionOptions + def KernelSpatialDimensionsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloConvolutionOptions + def KernelSpatialDimensionsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) + return o == 0 + + # StablehloConvolutionOptions + def OutputBatchDimension(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) + return 0 + + # StablehloConvolutionOptions + def OutputFeatureDimension(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) + return 0 + + # StablehloConvolutionOptions + def OutputSpatialDimensions(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloConvolutionOptions + def OutputSpatialDimensionsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloConvolutionOptions + def OutputSpatialDimensionsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloConvolutionOptions + def OutputSpatialDimensionsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30)) + return o == 0 + + # StablehloConvolutionOptions + def FeatureGroupCount(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) + return 0 + + # StablehloConvolutionOptions + def BatchGroupCount(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) + return 0 + + # StablehloConvolutionOptions + def PrecisionConfig(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Uint32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) + return 0 + + # StablehloConvolutionOptions + def PrecisionConfigAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint32Flags, o) + return 0 + + # StablehloConvolutionOptions + def PrecisionConfigLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloConvolutionOptions + def PrecisionConfigIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36)) + return o == 0 + +def StablehloConvolutionOptionsStart(builder): builder.StartObject(17) +def Start(builder): + return StablehloConvolutionOptionsStart(builder) +def StablehloConvolutionOptionsAddWindowStrides(builder, windowStrides): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(windowStrides), 0) +def AddWindowStrides(builder, windowStrides): + return StablehloConvolutionOptionsAddWindowStrides(builder, windowStrides) +def StablehloConvolutionOptionsStartWindowStridesVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartWindowStridesVector(builder, numElems): + return StablehloConvolutionOptionsStartWindowStridesVector(builder, numElems) +def StablehloConvolutionOptionsAddPadding(builder, padding): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(padding), 0) +def AddPadding(builder, padding): + return StablehloConvolutionOptionsAddPadding(builder, padding) +def StablehloConvolutionOptionsStartPaddingVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartPaddingVector(builder, numElems): + return StablehloConvolutionOptionsStartPaddingVector(builder, numElems) +def StablehloConvolutionOptionsAddLhsDilation(builder, lhsDilation): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(lhsDilation), 0) +def AddLhsDilation(builder, lhsDilation): + return StablehloConvolutionOptionsAddLhsDilation(builder, lhsDilation) +def StablehloConvolutionOptionsStartLhsDilationVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartLhsDilationVector(builder, numElems): + return StablehloConvolutionOptionsStartLhsDilationVector(builder, numElems) +def StablehloConvolutionOptionsAddRhsDilation(builder, rhsDilation): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(rhsDilation), 0) +def AddRhsDilation(builder, rhsDilation): + return StablehloConvolutionOptionsAddRhsDilation(builder, rhsDilation) +def StablehloConvolutionOptionsStartRhsDilationVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartRhsDilationVector(builder, numElems): + return StablehloConvolutionOptionsStartRhsDilationVector(builder, numElems) +def StablehloConvolutionOptionsAddWindowReversal(builder, windowReversal): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(windowReversal), 0) +def AddWindowReversal(builder, windowReversal): + return StablehloConvolutionOptionsAddWindowReversal(builder, windowReversal) +def StablehloConvolutionOptionsStartWindowReversalVector(builder, numElems): return builder.StartVector(1, numElems, 1) +def StartWindowReversalVector(builder, numElems): + return StablehloConvolutionOptionsStartWindowReversalVector(builder, numElems) +def StablehloConvolutionOptionsAddInputBatchDimension(builder, inputBatchDimension): builder.PrependInt64Slot(5, inputBatchDimension, 0) +def AddInputBatchDimension(builder, inputBatchDimension): + return StablehloConvolutionOptionsAddInputBatchDimension(builder, inputBatchDimension) +def StablehloConvolutionOptionsAddInputFeatureDimension(builder, inputFeatureDimension): builder.PrependInt64Slot(6, inputFeatureDimension, 0) +def AddInputFeatureDimension(builder, inputFeatureDimension): + return StablehloConvolutionOptionsAddInputFeatureDimension(builder, inputFeatureDimension) +def StablehloConvolutionOptionsAddInputSpatialDimensions(builder, inputSpatialDimensions): builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(inputSpatialDimensions), 0) +def AddInputSpatialDimensions(builder, inputSpatialDimensions): + return StablehloConvolutionOptionsAddInputSpatialDimensions(builder, inputSpatialDimensions) +def StablehloConvolutionOptionsStartInputSpatialDimensionsVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartInputSpatialDimensionsVector(builder, numElems): + return StablehloConvolutionOptionsStartInputSpatialDimensionsVector(builder, numElems) +def StablehloConvolutionOptionsAddKernelInputFeatureDimension(builder, kernelInputFeatureDimension): builder.PrependInt64Slot(8, kernelInputFeatureDimension, 0) +def AddKernelInputFeatureDimension(builder, kernelInputFeatureDimension): + return StablehloConvolutionOptionsAddKernelInputFeatureDimension(builder, kernelInputFeatureDimension) +def StablehloConvolutionOptionsAddKernelOutputFeatureDimension(builder, kernelOutputFeatureDimension): builder.PrependInt64Slot(9, kernelOutputFeatureDimension, 0) +def AddKernelOutputFeatureDimension(builder, kernelOutputFeatureDimension): + return StablehloConvolutionOptionsAddKernelOutputFeatureDimension(builder, kernelOutputFeatureDimension) +def StablehloConvolutionOptionsAddKernelSpatialDimensions(builder, kernelSpatialDimensions): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(kernelSpatialDimensions), 0) +def AddKernelSpatialDimensions(builder, kernelSpatialDimensions): + return StablehloConvolutionOptionsAddKernelSpatialDimensions(builder, kernelSpatialDimensions) +def StablehloConvolutionOptionsStartKernelSpatialDimensionsVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartKernelSpatialDimensionsVector(builder, numElems): + return StablehloConvolutionOptionsStartKernelSpatialDimensionsVector(builder, numElems) +def StablehloConvolutionOptionsAddOutputBatchDimension(builder, outputBatchDimension): builder.PrependInt64Slot(11, outputBatchDimension, 0) +def AddOutputBatchDimension(builder, outputBatchDimension): + return StablehloConvolutionOptionsAddOutputBatchDimension(builder, outputBatchDimension) +def StablehloConvolutionOptionsAddOutputFeatureDimension(builder, outputFeatureDimension): builder.PrependInt64Slot(12, outputFeatureDimension, 0) +def AddOutputFeatureDimension(builder, outputFeatureDimension): + return StablehloConvolutionOptionsAddOutputFeatureDimension(builder, outputFeatureDimension) +def StablehloConvolutionOptionsAddOutputSpatialDimensions(builder, outputSpatialDimensions): builder.PrependUOffsetTRelativeSlot(13, flatbuffers.number_types.UOffsetTFlags.py_type(outputSpatialDimensions), 0) +def AddOutputSpatialDimensions(builder, outputSpatialDimensions): + return StablehloConvolutionOptionsAddOutputSpatialDimensions(builder, outputSpatialDimensions) +def StablehloConvolutionOptionsStartOutputSpatialDimensionsVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartOutputSpatialDimensionsVector(builder, numElems): + return StablehloConvolutionOptionsStartOutputSpatialDimensionsVector(builder, numElems) +def StablehloConvolutionOptionsAddFeatureGroupCount(builder, featureGroupCount): builder.PrependInt64Slot(14, featureGroupCount, 0) +def AddFeatureGroupCount(builder, featureGroupCount): + return StablehloConvolutionOptionsAddFeatureGroupCount(builder, featureGroupCount) +def StablehloConvolutionOptionsAddBatchGroupCount(builder, batchGroupCount): builder.PrependInt64Slot(15, batchGroupCount, 0) +def AddBatchGroupCount(builder, batchGroupCount): + return StablehloConvolutionOptionsAddBatchGroupCount(builder, batchGroupCount) +def StablehloConvolutionOptionsAddPrecisionConfig(builder, precisionConfig): builder.PrependUOffsetTRelativeSlot(16, flatbuffers.number_types.UOffsetTFlags.py_type(precisionConfig), 0) +def AddPrecisionConfig(builder, precisionConfig): + return StablehloConvolutionOptionsAddPrecisionConfig(builder, precisionConfig) +def StablehloConvolutionOptionsStartPrecisionConfigVector(builder, numElems): return builder.StartVector(4, numElems, 4) +def StartPrecisionConfigVector(builder, numElems): + return StablehloConvolutionOptionsStartPrecisionConfigVector(builder, numElems) +def StablehloConvolutionOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloConvolutionOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/StablehloCustomCallOptions.py b/ethosu/vela/tflite/StablehloCustomCallOptions.py new file mode 100644 index 0000000..f903b1c --- /dev/null +++ b/ethosu/vela/tflite/StablehloCustomCallOptions.py @@ -0,0 +1,142 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloCustomCallOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloCustomCallOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloCustomCallOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloCustomCallOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloCustomCallOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloCustomCallOptions + def CallTargetName(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.String(o + self._tab.Pos) + return None + + # StablehloCustomCallOptions + def HasSideEffect(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) + return False + + # StablehloCustomCallOptions + def BackendConfig(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.String(o + self._tab.Pos) + return None + + # StablehloCustomCallOptions + def ApiVersion(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) + return 0 + + # StablehloCustomCallOptions + def CalledComputations(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) + return 0 + + # StablehloCustomCallOptions + def CalledComputationsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) + return 0 + + # StablehloCustomCallOptions + def CalledComputationsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloCustomCallOptions + def CalledComputationsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + return o == 0 + + # StablehloCustomCallOptions + def CustomAttributes(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) + 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 + + # StablehloCustomCallOptions + def CustomAttributesAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) + return 0 + + # StablehloCustomCallOptions + def CustomAttributesLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloCustomCallOptions + def CustomAttributesIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) + return o == 0 + +def StablehloCustomCallOptionsStart(builder): builder.StartObject(6) +def Start(builder): + return StablehloCustomCallOptionsStart(builder) +def StablehloCustomCallOptionsAddCallTargetName(builder, callTargetName): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(callTargetName), 0) +def AddCallTargetName(builder, callTargetName): + return StablehloCustomCallOptionsAddCallTargetName(builder, callTargetName) +def StablehloCustomCallOptionsAddHasSideEffect(builder, hasSideEffect): builder.PrependBoolSlot(1, hasSideEffect, 0) +def AddHasSideEffect(builder, hasSideEffect): + return StablehloCustomCallOptionsAddHasSideEffect(builder, hasSideEffect) +def StablehloCustomCallOptionsAddBackendConfig(builder, backendConfig): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(backendConfig), 0) +def AddBackendConfig(builder, backendConfig): + return StablehloCustomCallOptionsAddBackendConfig(builder, backendConfig) +def StablehloCustomCallOptionsAddApiVersion(builder, apiVersion): builder.PrependInt32Slot(3, apiVersion, 0) +def AddApiVersion(builder, apiVersion): + return StablehloCustomCallOptionsAddApiVersion(builder, apiVersion) +def StablehloCustomCallOptionsAddCalledComputations(builder, calledComputations): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(calledComputations), 0) +def AddCalledComputations(builder, calledComputations): + return StablehloCustomCallOptionsAddCalledComputations(builder, calledComputations) +def StablehloCustomCallOptionsStartCalledComputationsVector(builder, numElems): return builder.StartVector(4, numElems, 4) +def StartCalledComputationsVector(builder, numElems): + return StablehloCustomCallOptionsStartCalledComputationsVector(builder, numElems) +def StablehloCustomCallOptionsAddCustomAttributes(builder, customAttributes): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(customAttributes), 0) +def AddCustomAttributes(builder, customAttributes): + return StablehloCustomCallOptionsAddCustomAttributes(builder, customAttributes) +def StablehloCustomCallOptionsStartCustomAttributesVector(builder, numElems): return builder.StartVector(1, numElems, 1) +def StartCustomAttributesVector(builder, numElems): + return StablehloCustomCallOptionsStartCustomAttributesVector(builder, numElems) +def StablehloCustomCallOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloCustomCallOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/StablehloDotGeneralOptions.py b/ethosu/vela/tflite/StablehloDotGeneralOptions.py new file mode 100644 index 0000000..f369c0d --- /dev/null +++ b/ethosu/vela/tflite/StablehloDotGeneralOptions.py @@ -0,0 +1,201 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloDotGeneralOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloDotGeneralOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloDotGeneralOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloDotGeneralOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloDotGeneralOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloDotGeneralOptions + def LhsBatchingDimensions(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.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloDotGeneralOptions + def LhsBatchingDimensionsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloDotGeneralOptions + def LhsBatchingDimensionsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloDotGeneralOptions + def LhsBatchingDimensionsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + return o == 0 + + # StablehloDotGeneralOptions + def RhsBatchingDimensions(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloDotGeneralOptions + def RhsBatchingDimensionsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloDotGeneralOptions + def RhsBatchingDimensionsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloDotGeneralOptions + def RhsBatchingDimensionsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + return o == 0 + + # StablehloDotGeneralOptions + def LhsContractingDimensions(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloDotGeneralOptions + def LhsContractingDimensionsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloDotGeneralOptions + def LhsContractingDimensionsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloDotGeneralOptions + def LhsContractingDimensionsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + return o == 0 + + # StablehloDotGeneralOptions + def RhsContractingDimensions(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloDotGeneralOptions + def RhsContractingDimensionsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloDotGeneralOptions + def RhsContractingDimensionsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloDotGeneralOptions + def RhsContractingDimensionsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + return o == 0 + + # StablehloDotGeneralOptions + def PrecisionConfig(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Uint32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) + return 0 + + # StablehloDotGeneralOptions + def PrecisionConfigAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint32Flags, o) + return 0 + + # StablehloDotGeneralOptions + def PrecisionConfigLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloDotGeneralOptions + def PrecisionConfigIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + return o == 0 + +def StablehloDotGeneralOptionsStart(builder): builder.StartObject(5) +def Start(builder): + return StablehloDotGeneralOptionsStart(builder) +def StablehloDotGeneralOptionsAddLhsBatchingDimensions(builder, lhsBatchingDimensions): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(lhsBatchingDimensions), 0) +def AddLhsBatchingDimensions(builder, lhsBatchingDimensions): + return StablehloDotGeneralOptionsAddLhsBatchingDimensions(builder, lhsBatchingDimensions) +def StablehloDotGeneralOptionsStartLhsBatchingDimensionsVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartLhsBatchingDimensionsVector(builder, numElems): + return StablehloDotGeneralOptionsStartLhsBatchingDimensionsVector(builder, numElems) +def StablehloDotGeneralOptionsAddRhsBatchingDimensions(builder, rhsBatchingDimensions): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(rhsBatchingDimensions), 0) +def AddRhsBatchingDimensions(builder, rhsBatchingDimensions): + return StablehloDotGeneralOptionsAddRhsBatchingDimensions(builder, rhsBatchingDimensions) +def StablehloDotGeneralOptionsStartRhsBatchingDimensionsVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartRhsBatchingDimensionsVector(builder, numElems): + return StablehloDotGeneralOptionsStartRhsBatchingDimensionsVector(builder, numElems) +def StablehloDotGeneralOptionsAddLhsContractingDimensions(builder, lhsContractingDimensions): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(lhsContractingDimensions), 0) +def AddLhsContractingDimensions(builder, lhsContractingDimensions): + return StablehloDotGeneralOptionsAddLhsContractingDimensions(builder, lhsContractingDimensions) +def StablehloDotGeneralOptionsStartLhsContractingDimensionsVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartLhsContractingDimensionsVector(builder, numElems): + return StablehloDotGeneralOptionsStartLhsContractingDimensionsVector(builder, numElems) +def StablehloDotGeneralOptionsAddRhsContractingDimensions(builder, rhsContractingDimensions): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(rhsContractingDimensions), 0) +def AddRhsContractingDimensions(builder, rhsContractingDimensions): + return StablehloDotGeneralOptionsAddRhsContractingDimensions(builder, rhsContractingDimensions) +def StablehloDotGeneralOptionsStartRhsContractingDimensionsVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartRhsContractingDimensionsVector(builder, numElems): + return StablehloDotGeneralOptionsStartRhsContractingDimensionsVector(builder, numElems) +def StablehloDotGeneralOptionsAddPrecisionConfig(builder, precisionConfig): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(precisionConfig), 0) +def AddPrecisionConfig(builder, precisionConfig): + return StablehloDotGeneralOptionsAddPrecisionConfig(builder, precisionConfig) +def StablehloDotGeneralOptionsStartPrecisionConfigVector(builder, numElems): return builder.StartVector(4, numElems, 4) +def StartPrecisionConfigVector(builder, numElems): + return StablehloDotGeneralOptionsStartPrecisionConfigVector(builder, numElems) +def StablehloDotGeneralOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloDotGeneralOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/StablehloDynamicSliceOptions.py b/ethosu/vela/tflite/StablehloDynamicSliceOptions.py new file mode 100644 index 0000000..fabd125 --- /dev/null +++ b/ethosu/vela/tflite/StablehloDynamicSliceOptions.py @@ -0,0 +1,69 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloDynamicSliceOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloDynamicSliceOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloDynamicSliceOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloDynamicSliceOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloDynamicSliceOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloDynamicSliceOptions + def SliceSizes(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.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloDynamicSliceOptions + def SliceSizesAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloDynamicSliceOptions + def SliceSizesLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloDynamicSliceOptions + def SliceSizesIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + return o == 0 + +def StablehloDynamicSliceOptionsStart(builder): builder.StartObject(1) +def Start(builder): + return StablehloDynamicSliceOptionsStart(builder) +def StablehloDynamicSliceOptionsAddSliceSizes(builder, sliceSizes): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(sliceSizes), 0) +def AddSliceSizes(builder, sliceSizes): + return StablehloDynamicSliceOptionsAddSliceSizes(builder, sliceSizes) +def StablehloDynamicSliceOptionsStartSliceSizesVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartSliceSizesVector(builder, numElems): + return StablehloDynamicSliceOptionsStartSliceSizesVector(builder, numElems) +def StablehloDynamicSliceOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloDynamicSliceOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/StablehloGatherOptions.py b/ethosu/vela/tflite/StablehloGatherOptions.py new file mode 100644 index 0000000..e2668c1 --- /dev/null +++ b/ethosu/vela/tflite/StablehloGatherOptions.py @@ -0,0 +1,188 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloGatherOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloGatherOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloGatherOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloGatherOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloGatherOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloGatherOptions + def OffsetDims(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.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloGatherOptions + def OffsetDimsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloGatherOptions + def OffsetDimsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloGatherOptions + def OffsetDimsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + return o == 0 + + # StablehloGatherOptions + def CollapsedSliceDims(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloGatherOptions + def CollapsedSliceDimsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloGatherOptions + def CollapsedSliceDimsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloGatherOptions + def CollapsedSliceDimsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + return o == 0 + + # StablehloGatherOptions + def StartIndexMap(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloGatherOptions + def StartIndexMapAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloGatherOptions + def StartIndexMapLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloGatherOptions + def StartIndexMapIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + return o == 0 + + # StablehloGatherOptions + def IndexVectorDim(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) + return 0 + + # StablehloGatherOptions + def SliceSizes(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloGatherOptions + def SliceSizesAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloGatherOptions + def SliceSizesLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloGatherOptions + def SliceSizesIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + return o == 0 + + # StablehloGatherOptions + def IndicesAreSorted(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) + if o != 0: + return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) + return False + +def StablehloGatherOptionsStart(builder): builder.StartObject(6) +def Start(builder): + return StablehloGatherOptionsStart(builder) +def StablehloGatherOptionsAddOffsetDims(builder, offsetDims): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(offsetDims), 0) +def AddOffsetDims(builder, offsetDims): + return StablehloGatherOptionsAddOffsetDims(builder, offsetDims) +def StablehloGatherOptionsStartOffsetDimsVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartOffsetDimsVector(builder, numElems): + return StablehloGatherOptionsStartOffsetDimsVector(builder, numElems) +def StablehloGatherOptionsAddCollapsedSliceDims(builder, collapsedSliceDims): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(collapsedSliceDims), 0) +def AddCollapsedSliceDims(builder, collapsedSliceDims): + return StablehloGatherOptionsAddCollapsedSliceDims(builder, collapsedSliceDims) +def StablehloGatherOptionsStartCollapsedSliceDimsVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartCollapsedSliceDimsVector(builder, numElems): + return StablehloGatherOptionsStartCollapsedSliceDimsVector(builder, numElems) +def StablehloGatherOptionsAddStartIndexMap(builder, startIndexMap): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(startIndexMap), 0) +def AddStartIndexMap(builder, startIndexMap): + return StablehloGatherOptionsAddStartIndexMap(builder, startIndexMap) +def StablehloGatherOptionsStartStartIndexMapVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartStartIndexMapVector(builder, numElems): + return StablehloGatherOptionsStartStartIndexMapVector(builder, numElems) +def StablehloGatherOptionsAddIndexVectorDim(builder, indexVectorDim): builder.PrependInt64Slot(3, indexVectorDim, 0) +def AddIndexVectorDim(builder, indexVectorDim): + return StablehloGatherOptionsAddIndexVectorDim(builder, indexVectorDim) +def StablehloGatherOptionsAddSliceSizes(builder, sliceSizes): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(sliceSizes), 0) +def AddSliceSizes(builder, sliceSizes): + return StablehloGatherOptionsAddSliceSizes(builder, sliceSizes) +def StablehloGatherOptionsStartSliceSizesVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartSliceSizesVector(builder, numElems): + return StablehloGatherOptionsStartSliceSizesVector(builder, numElems) +def StablehloGatherOptionsAddIndicesAreSorted(builder, indicesAreSorted): builder.PrependBoolSlot(5, indicesAreSorted, 0) +def AddIndicesAreSorted(builder, indicesAreSorted): + return StablehloGatherOptionsAddIndicesAreSorted(builder, indicesAreSorted) +def StablehloGatherOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloGatherOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/StablehloIotaOptions.py b/ethosu/vela/tflite/StablehloIotaOptions.py new file mode 100644 index 0000000..147cac0 --- /dev/null +++ b/ethosu/vela/tflite/StablehloIotaOptions.py @@ -0,0 +1,46 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloIotaOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloIotaOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloIotaOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloIotaOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloIotaOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloIotaOptions + def IotaDimension(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) + return 0 + +def StablehloIotaOptionsStart(builder): builder.StartObject(1) +def Start(builder): + return StablehloIotaOptionsStart(builder) +def StablehloIotaOptionsAddIotaDimension(builder, iotaDimension): builder.PrependInt64Slot(0, iotaDimension, 0) +def AddIotaDimension(builder, iotaDimension): + return StablehloIotaOptionsAddIotaDimension(builder, iotaDimension) +def StablehloIotaOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloIotaOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/StablehloPadOptions.py b/ethosu/vela/tflite/StablehloPadOptions.py new file mode 100644 index 0000000..acf69ec --- /dev/null +++ b/ethosu/vela/tflite/StablehloPadOptions.py @@ -0,0 +1,135 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloPadOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloPadOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloPadOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloPadOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloPadOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloPadOptions + def EdgePaddingLow(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.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloPadOptions + def EdgePaddingLowAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloPadOptions + def EdgePaddingLowLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloPadOptions + def EdgePaddingLowIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + return o == 0 + + # StablehloPadOptions + def EdgePaddingHigh(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloPadOptions + def EdgePaddingHighAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloPadOptions + def EdgePaddingHighLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloPadOptions + def EdgePaddingHighIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + return o == 0 + + # StablehloPadOptions + def InteriorPadding(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloPadOptions + def InteriorPaddingAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloPadOptions + def InteriorPaddingLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloPadOptions + def InteriorPaddingIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + return o == 0 + +def StablehloPadOptionsStart(builder): builder.StartObject(3) +def Start(builder): + return StablehloPadOptionsStart(builder) +def StablehloPadOptionsAddEdgePaddingLow(builder, edgePaddingLow): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(edgePaddingLow), 0) +def AddEdgePaddingLow(builder, edgePaddingLow): + return StablehloPadOptionsAddEdgePaddingLow(builder, edgePaddingLow) +def StablehloPadOptionsStartEdgePaddingLowVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartEdgePaddingLowVector(builder, numElems): + return StablehloPadOptionsStartEdgePaddingLowVector(builder, numElems) +def StablehloPadOptionsAddEdgePaddingHigh(builder, edgePaddingHigh): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(edgePaddingHigh), 0) +def AddEdgePaddingHigh(builder, edgePaddingHigh): + return StablehloPadOptionsAddEdgePaddingHigh(builder, edgePaddingHigh) +def StablehloPadOptionsStartEdgePaddingHighVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartEdgePaddingHighVector(builder, numElems): + return StablehloPadOptionsStartEdgePaddingHighVector(builder, numElems) +def StablehloPadOptionsAddInteriorPadding(builder, interiorPadding): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(interiorPadding), 0) +def AddInteriorPadding(builder, interiorPadding): + return StablehloPadOptionsAddInteriorPadding(builder, interiorPadding) +def StablehloPadOptionsStartInteriorPaddingVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartInteriorPaddingVector(builder, numElems): + return StablehloPadOptionsStartInteriorPaddingVector(builder, numElems) +def StablehloPadOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloPadOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/StablehloPrecisionConfig.py b/ethosu/vela/tflite/StablehloPrecisionConfig.py new file mode 100644 index 0000000..b8133a8 --- /dev/null +++ b/ethosu/vela/tflite/StablehloPrecisionConfig.py @@ -0,0 +1,8 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +class StablehloPrecisionConfig(object): + DEFAULT = 0 + HIGH = 1 + HIGHEST = 2 diff --git a/ethosu/vela/tflite/StablehloReduceOptions.py b/ethosu/vela/tflite/StablehloReduceOptions.py new file mode 100644 index 0000000..35ab454 --- /dev/null +++ b/ethosu/vela/tflite/StablehloReduceOptions.py @@ -0,0 +1,79 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloReduceOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloReduceOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloReduceOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloReduceOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloReduceOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloReduceOptions + def Dimensions(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.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloReduceOptions + def DimensionsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloReduceOptions + def DimensionsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloReduceOptions + def DimensionsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + return o == 0 + + # StablehloReduceOptions + def BodySubgraphIndex(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) + return 0 + +def StablehloReduceOptionsStart(builder): builder.StartObject(2) +def Start(builder): + return StablehloReduceOptionsStart(builder) +def StablehloReduceOptionsAddDimensions(builder, dimensions): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(dimensions), 0) +def AddDimensions(builder, dimensions): + return StablehloReduceOptionsAddDimensions(builder, dimensions) +def StablehloReduceOptionsStartDimensionsVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartDimensionsVector(builder, numElems): + return StablehloReduceOptionsStartDimensionsVector(builder, numElems) +def StablehloReduceOptionsAddBodySubgraphIndex(builder, bodySubgraphIndex): builder.PrependInt32Slot(1, bodySubgraphIndex, 0) +def AddBodySubgraphIndex(builder, bodySubgraphIndex): + return StablehloReduceOptionsAddBodySubgraphIndex(builder, bodySubgraphIndex) +def StablehloReduceOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloReduceOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/StablehloReduceWindowOptions.py b/ethosu/vela/tflite/StablehloReduceWindowOptions.py new file mode 100644 index 0000000..e9b86a7 --- /dev/null +++ b/ethosu/vela/tflite/StablehloReduceWindowOptions.py @@ -0,0 +1,211 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloReduceWindowOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloReduceWindowOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloReduceWindowOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloReduceWindowOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloReduceWindowOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloReduceWindowOptions + def WindowDimensions(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.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloReduceWindowOptions + def WindowDimensionsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloReduceWindowOptions + def WindowDimensionsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloReduceWindowOptions + def WindowDimensionsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + return o == 0 + + # StablehloReduceWindowOptions + def WindowStrides(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloReduceWindowOptions + def WindowStridesAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloReduceWindowOptions + def WindowStridesLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloReduceWindowOptions + def WindowStridesIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + return o == 0 + + # StablehloReduceWindowOptions + def BaseDilations(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloReduceWindowOptions + def BaseDilationsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloReduceWindowOptions + def BaseDilationsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloReduceWindowOptions + def BaseDilationsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + return o == 0 + + # StablehloReduceWindowOptions + def WindowDilations(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloReduceWindowOptions + def WindowDilationsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloReduceWindowOptions + def WindowDilationsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloReduceWindowOptions + def WindowDilationsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + return o == 0 + + # StablehloReduceWindowOptions + def Padding(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloReduceWindowOptions + def PaddingAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloReduceWindowOptions + def PaddingLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloReduceWindowOptions + def PaddingIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + return o == 0 + + # StablehloReduceWindowOptions + def BodySubgraphIndex(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) + return 0 + +def StablehloReduceWindowOptionsStart(builder): builder.StartObject(6) +def Start(builder): + return StablehloReduceWindowOptionsStart(builder) +def StablehloReduceWindowOptionsAddWindowDimensions(builder, windowDimensions): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(windowDimensions), 0) +def AddWindowDimensions(builder, windowDimensions): + return StablehloReduceWindowOptionsAddWindowDimensions(builder, windowDimensions) +def StablehloReduceWindowOptionsStartWindowDimensionsVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartWindowDimensionsVector(builder, numElems): + return StablehloReduceWindowOptionsStartWindowDimensionsVector(builder, numElems) +def StablehloReduceWindowOptionsAddWindowStrides(builder, windowStrides): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(windowStrides), 0) +def AddWindowStrides(builder, windowStrides): + return StablehloReduceWindowOptionsAddWindowStrides(builder, windowStrides) +def StablehloReduceWindowOptionsStartWindowStridesVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartWindowStridesVector(builder, numElems): + return StablehloReduceWindowOptionsStartWindowStridesVector(builder, numElems) +def StablehloReduceWindowOptionsAddBaseDilations(builder, baseDilations): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(baseDilations), 0) +def AddBaseDilations(builder, baseDilations): + return StablehloReduceWindowOptionsAddBaseDilations(builder, baseDilations) +def StablehloReduceWindowOptionsStartBaseDilationsVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartBaseDilationsVector(builder, numElems): + return StablehloReduceWindowOptionsStartBaseDilationsVector(builder, numElems) +def StablehloReduceWindowOptionsAddWindowDilations(builder, windowDilations): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(windowDilations), 0) +def AddWindowDilations(builder, windowDilations): + return StablehloReduceWindowOptionsAddWindowDilations(builder, windowDilations) +def StablehloReduceWindowOptionsStartWindowDilationsVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartWindowDilationsVector(builder, numElems): + return StablehloReduceWindowOptionsStartWindowDilationsVector(builder, numElems) +def StablehloReduceWindowOptionsAddPadding(builder, padding): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(padding), 0) +def AddPadding(builder, padding): + return StablehloReduceWindowOptionsAddPadding(builder, padding) +def StablehloReduceWindowOptionsStartPaddingVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartPaddingVector(builder, numElems): + return StablehloReduceWindowOptionsStartPaddingVector(builder, numElems) +def StablehloReduceWindowOptionsAddBodySubgraphIndex(builder, bodySubgraphIndex): builder.PrependInt32Slot(5, bodySubgraphIndex, 0) +def AddBodySubgraphIndex(builder, bodySubgraphIndex): + return StablehloReduceWindowOptionsAddBodySubgraphIndex(builder, bodySubgraphIndex) +def StablehloReduceWindowOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloReduceWindowOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/StablehloRngBitGeneratorOptions.py b/ethosu/vela/tflite/StablehloRngBitGeneratorOptions.py new file mode 100644 index 0000000..29a4cce --- /dev/null +++ b/ethosu/vela/tflite/StablehloRngBitGeneratorOptions.py @@ -0,0 +1,46 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloRngBitGeneratorOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloRngBitGeneratorOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloRngBitGeneratorOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloRngBitGeneratorOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloRngBitGeneratorOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloRngBitGeneratorOptions + def Algorithm(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 StablehloRngBitGeneratorOptionsStart(builder): builder.StartObject(1) +def Start(builder): + return StablehloRngBitGeneratorOptionsStart(builder) +def StablehloRngBitGeneratorOptionsAddAlgorithm(builder, algorithm): builder.PrependInt8Slot(0, algorithm, 0) +def AddAlgorithm(builder, algorithm): + return StablehloRngBitGeneratorOptionsAddAlgorithm(builder, algorithm) +def StablehloRngBitGeneratorOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloRngBitGeneratorOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/StablehloScatterOptions.py b/ethosu/vela/tflite/StablehloScatterOptions.py new file mode 100644 index 0000000..e9554c2 --- /dev/null +++ b/ethosu/vela/tflite/StablehloScatterOptions.py @@ -0,0 +1,175 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloScatterOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloScatterOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloScatterOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloScatterOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloScatterOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloScatterOptions + def IndicesAreSorted(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 + + # StablehloScatterOptions + def UpdateWindowDims(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloScatterOptions + def UpdateWindowDimsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloScatterOptions + def UpdateWindowDimsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloScatterOptions + def UpdateWindowDimsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + return o == 0 + + # StablehloScatterOptions + def InsertedWindowDims(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloScatterOptions + def InsertedWindowDimsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloScatterOptions + def InsertedWindowDimsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloScatterOptions + def InsertedWindowDimsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + return o == 0 + + # StablehloScatterOptions + def ScatterDimsToOperandDims(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloScatterOptions + def ScatterDimsToOperandDimsAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloScatterOptions + def ScatterDimsToOperandDimsLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloScatterOptions + def ScatterDimsToOperandDimsIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) + return o == 0 + + # StablehloScatterOptions + def IndexVectorDim(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) + return 0 + + # StablehloScatterOptions + def UniqueIndices(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) + if o != 0: + return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) + return False + + # StablehloScatterOptions + def UpdateComputationSubgraphIndex(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) + return 0 + +def StablehloScatterOptionsStart(builder): builder.StartObject(7) +def Start(builder): + return StablehloScatterOptionsStart(builder) +def StablehloScatterOptionsAddIndicesAreSorted(builder, indicesAreSorted): builder.PrependBoolSlot(0, indicesAreSorted, 0) +def AddIndicesAreSorted(builder, indicesAreSorted): + return StablehloScatterOptionsAddIndicesAreSorted(builder, indicesAreSorted) +def StablehloScatterOptionsAddUpdateWindowDims(builder, updateWindowDims): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(updateWindowDims), 0) +def AddUpdateWindowDims(builder, updateWindowDims): + return StablehloScatterOptionsAddUpdateWindowDims(builder, updateWindowDims) +def StablehloScatterOptionsStartUpdateWindowDimsVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartUpdateWindowDimsVector(builder, numElems): + return StablehloScatterOptionsStartUpdateWindowDimsVector(builder, numElems) +def StablehloScatterOptionsAddInsertedWindowDims(builder, insertedWindowDims): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(insertedWindowDims), 0) +def AddInsertedWindowDims(builder, insertedWindowDims): + return StablehloScatterOptionsAddInsertedWindowDims(builder, insertedWindowDims) +def StablehloScatterOptionsStartInsertedWindowDimsVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartInsertedWindowDimsVector(builder, numElems): + return StablehloScatterOptionsStartInsertedWindowDimsVector(builder, numElems) +def StablehloScatterOptionsAddScatterDimsToOperandDims(builder, scatterDimsToOperandDims): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(scatterDimsToOperandDims), 0) +def AddScatterDimsToOperandDims(builder, scatterDimsToOperandDims): + return StablehloScatterOptionsAddScatterDimsToOperandDims(builder, scatterDimsToOperandDims) +def StablehloScatterOptionsStartScatterDimsToOperandDimsVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartScatterDimsToOperandDimsVector(builder, numElems): + return StablehloScatterOptionsStartScatterDimsToOperandDimsVector(builder, numElems) +def StablehloScatterOptionsAddIndexVectorDim(builder, indexVectorDim): builder.PrependInt64Slot(4, indexVectorDim, 0) +def AddIndexVectorDim(builder, indexVectorDim): + return StablehloScatterOptionsAddIndexVectorDim(builder, indexVectorDim) +def StablehloScatterOptionsAddUniqueIndices(builder, uniqueIndices): builder.PrependBoolSlot(5, uniqueIndices, 0) +def AddUniqueIndices(builder, uniqueIndices): + return StablehloScatterOptionsAddUniqueIndices(builder, uniqueIndices) +def StablehloScatterOptionsAddUpdateComputationSubgraphIndex(builder, updateComputationSubgraphIndex): builder.PrependInt32Slot(6, updateComputationSubgraphIndex, 0) +def AddUpdateComputationSubgraphIndex(builder, updateComputationSubgraphIndex): + return StablehloScatterOptionsAddUpdateComputationSubgraphIndex(builder, updateComputationSubgraphIndex) +def StablehloScatterOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloScatterOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/StablehloSliceOptions.py b/ethosu/vela/tflite/StablehloSliceOptions.py new file mode 100644 index 0000000..5b7da50 --- /dev/null +++ b/ethosu/vela/tflite/StablehloSliceOptions.py @@ -0,0 +1,135 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloSliceOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloSliceOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloSliceOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloSliceOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloSliceOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloSliceOptions + def StartIndices(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.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloSliceOptions + def StartIndicesAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloSliceOptions + def StartIndicesLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloSliceOptions + def StartIndicesIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + return o == 0 + + # StablehloSliceOptions + def LimitIndices(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloSliceOptions + def LimitIndicesAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloSliceOptions + def LimitIndicesLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloSliceOptions + def LimitIndicesIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + return o == 0 + + # StablehloSliceOptions + def Strides(self, j): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + a = self._tab.Vector(o) + return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloSliceOptions + def StridesAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloSliceOptions + def StridesLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloSliceOptions + def StridesIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + return o == 0 + +def StablehloSliceOptionsStart(builder): builder.StartObject(3) +def Start(builder): + return StablehloSliceOptionsStart(builder) +def StablehloSliceOptionsAddStartIndices(builder, startIndices): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(startIndices), 0) +def AddStartIndices(builder, startIndices): + return StablehloSliceOptionsAddStartIndices(builder, startIndices) +def StablehloSliceOptionsStartStartIndicesVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartStartIndicesVector(builder, numElems): + return StablehloSliceOptionsStartStartIndicesVector(builder, numElems) +def StablehloSliceOptionsAddLimitIndices(builder, limitIndices): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(limitIndices), 0) +def AddLimitIndices(builder, limitIndices): + return StablehloSliceOptionsAddLimitIndices(builder, limitIndices) +def StablehloSliceOptionsStartLimitIndicesVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartLimitIndicesVector(builder, numElems): + return StablehloSliceOptionsStartLimitIndicesVector(builder, numElems) +def StablehloSliceOptionsAddStrides(builder, strides): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(strides), 0) +def AddStrides(builder, strides): + return StablehloSliceOptionsAddStrides(builder, strides) +def StablehloSliceOptionsStartStridesVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartStridesVector(builder, numElems): + return StablehloSliceOptionsStartStridesVector(builder, numElems) +def StablehloSliceOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloSliceOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/StablehloSortOptions.py b/ethosu/vela/tflite/StablehloSortOptions.py new file mode 100644 index 0000000..0a9c84a --- /dev/null +++ b/ethosu/vela/tflite/StablehloSortOptions.py @@ -0,0 +1,66 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloSortOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloSortOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloSortOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloSortOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloSortOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloSortOptions + def Dimension(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) + return 0 + + # StablehloSortOptions + def IsStable(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) + return False + + # StablehloSortOptions + def ComparatorSubgraphIndex(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) + return 0 + +def StablehloSortOptionsStart(builder): builder.StartObject(3) +def Start(builder): + return StablehloSortOptionsStart(builder) +def StablehloSortOptionsAddDimension(builder, dimension): builder.PrependInt64Slot(0, dimension, 0) +def AddDimension(builder, dimension): + return StablehloSortOptionsAddDimension(builder, dimension) +def StablehloSortOptionsAddIsStable(builder, isStable): builder.PrependBoolSlot(1, isStable, 0) +def AddIsStable(builder, isStable): + return StablehloSortOptionsAddIsStable(builder, isStable) +def StablehloSortOptionsAddComparatorSubgraphIndex(builder, comparatorSubgraphIndex): builder.PrependInt32Slot(2, comparatorSubgraphIndex, 0) +def AddComparatorSubgraphIndex(builder, comparatorSubgraphIndex): + return StablehloSortOptionsAddComparatorSubgraphIndex(builder, comparatorSubgraphIndex) +def StablehloSortOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloSortOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/StablehloTransposeOptions.py b/ethosu/vela/tflite/StablehloTransposeOptions.py new file mode 100644 index 0000000..3843b3d --- /dev/null +++ b/ethosu/vela/tflite/StablehloTransposeOptions.py @@ -0,0 +1,69 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloTransposeOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloTransposeOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloTransposeOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloTransposeOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloTransposeOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloTransposeOptions + def Permutation(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.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) + return 0 + + # StablehloTransposeOptions + def PermutationAsNumpy(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) + return 0 + + # StablehloTransposeOptions + def PermutationLength(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.VectorLen(o) + return 0 + + # StablehloTransposeOptions + def PermutationIsNone(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + return o == 0 + +def StablehloTransposeOptionsStart(builder): builder.StartObject(1) +def Start(builder): + return StablehloTransposeOptionsStart(builder) +def StablehloTransposeOptionsAddPermutation(builder, permutation): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(permutation), 0) +def AddPermutation(builder, permutation): + return StablehloTransposeOptionsAddPermutation(builder, permutation) +def StablehloTransposeOptionsStartPermutationVector(builder, numElems): return builder.StartVector(8, numElems, 8) +def StartPermutationVector(builder, numElems): + return StablehloTransposeOptionsStartPermutationVector(builder, numElems) +def StablehloTransposeOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloTransposeOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/StablehloWhileOptions.py b/ethosu/vela/tflite/StablehloWhileOptions.py new file mode 100644 index 0000000..302a373 --- /dev/null +++ b/ethosu/vela/tflite/StablehloWhileOptions.py @@ -0,0 +1,56 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: tflite + +import flatbuffers +from flatbuffers.compat import import_numpy +np = import_numpy() + +class StablehloWhileOptions(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAs(cls, buf, offset=0): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = StablehloWhileOptions() + x.Init(buf, n + offset) + return x + + @classmethod + def GetRootAsStablehloWhileOptions(cls, buf, offset=0): + """This method is deprecated. Please switch to GetRootAs.""" + return cls.GetRootAs(buf, offset) + @classmethod + def StablehloWhileOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): + return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) + + # StablehloWhileOptions + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # StablehloWhileOptions + def CondSubgraphIndex(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 + + # StablehloWhileOptions + def BodySubgraphIndex(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) + return 0 + +def StablehloWhileOptionsStart(builder): builder.StartObject(2) +def Start(builder): + return StablehloWhileOptionsStart(builder) +def StablehloWhileOptionsAddCondSubgraphIndex(builder, condSubgraphIndex): builder.PrependInt32Slot(0, condSubgraphIndex, 0) +def AddCondSubgraphIndex(builder, condSubgraphIndex): + return StablehloWhileOptionsAddCondSubgraphIndex(builder, condSubgraphIndex) +def StablehloWhileOptionsAddBodySubgraphIndex(builder, bodySubgraphIndex): builder.PrependInt32Slot(1, bodySubgraphIndex, 0) +def AddBodySubgraphIndex(builder, bodySubgraphIndex): + return StablehloWhileOptionsAddBodySubgraphIndex(builder, bodySubgraphIndex) +def StablehloWhileOptionsEnd(builder): return builder.EndObject() +def End(builder): + return StablehloWhileOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite/TransposeConvOptions.py b/ethosu/vela/tflite/TransposeConvOptions.py index af9159c..bbe2ed3 100644 --- a/ethosu/vela/tflite/TransposeConvOptions.py +++ b/ethosu/vela/tflite/TransposeConvOptions.py @@ -56,7 +56,14 @@ class TransposeConvOptions(object): return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) return 0 -def TransposeConvOptionsStart(builder): builder.StartObject(4) + # TransposeConvOptions + def QuantizedBiasType(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) + return 0 + +def TransposeConvOptionsStart(builder): builder.StartObject(5) def Start(builder): return TransposeConvOptionsStart(builder) def TransposeConvOptionsAddPadding(builder, padding): builder.PrependInt8Slot(0, padding, 0) @@ -71,6 +78,9 @@ def AddStrideH(builder, strideH): def TransposeConvOptionsAddFusedActivationFunction(builder, fusedActivationFunction): builder.PrependInt8Slot(3, fusedActivationFunction, 0) def AddFusedActivationFunction(builder, fusedActivationFunction): return TransposeConvOptionsAddFusedActivationFunction(builder, fusedActivationFunction) +def TransposeConvOptionsAddQuantizedBiasType(builder, quantizedBiasType): builder.PrependInt8Slot(4, quantizedBiasType, 0) +def AddQuantizedBiasType(builder, quantizedBiasType): + return TransposeConvOptionsAddQuantizedBiasType(builder, quantizedBiasType) def TransposeConvOptionsEnd(builder): return builder.EndObject() def End(builder): return TransposeConvOptionsEnd(builder) \ No newline at end of file diff --git a/ethosu/vela/tflite_mapping.py b/ethosu/vela/tflite_mapping.py index fd94dd8..0faa079 100644 --- a/ethosu/vela/tflite_mapping.py +++ b/ethosu/vela/tflite_mapping.py @@ -55,6 +55,7 @@ from .tflite import DensifyOptions from .tflite import DepthToSpaceOptions from .tflite import DepthwiseConv2DOptions from .tflite import DequantizeOptions +from .tflite import DilateOptions from .tflite import DivOptions from .tflite import DynamicUpdateSliceOptions from .tflite import EmbeddingLookupSparseOptions @@ -109,6 +110,7 @@ from .tflite import RangeOptions from .tflite import RankOptions from .tflite import ReadVariableOptions from .tflite import ReducerOptions +from .tflite import ReduceWindowOptions from .tflite import ReshapeOptions from .tflite import ResizeBilinearOptions from .tflite import ResizeNearestNeighborOptions @@ -156,6 +158,7 @@ from .tflite import ZerosLikeOptions from .tflite.ActivationFunctionType import ActivationFunctionType from .tflite.BuiltinOperator import BuiltinOperator from .tflite.BuiltinOptions import BuiltinOptions +from .tflite.BuiltinOptions2 import BuiltinOptions2 from .tflite.Padding import Padding from .tflite.TensorType import TensorType @@ -342,6 +345,9 @@ builtin_options_map = { BuiltinOptions.BitcastOptions: BitcastOptions.BitcastOptions, BuiltinOptions.BitwiseXorOptions: BitwiseXorOptions.BitwiseXorOptions, BuiltinOptions.RightShiftOptions: RightShiftOptions.RightShiftOptions, + # BuiltinOptions 2 + 127 + BuiltinOptions2.DilateOptions: DilateOptions.DilateOptions, + 127 + BuiltinOptions2.ReduceWindowOptions: ReduceWindowOptions.ReduceWindowOptions, } @@ -559,7 +565,16 @@ builtin_operator_map = { BuiltinOperator.CONV_2D: ( Op.Conv2DBias, OptionsSerializer( - "Conv2DOptions", ("dilation_h_factor", "dilation_w_factor", fused_act, padding, "stride_h", "stride_w") + "Conv2DOptions", + ( + "dilation_h_factor", + "dilation_w_factor", + fused_act, + padding, + "stride_h", + "stride_w", + "quantized_bias_type", + ), ), TFLITE_IFM_WEIGHTS_BIAS_INDICES, ), @@ -582,7 +597,8 @@ builtin_operator_map = { BuiltinOperator.FULLY_CONNECTED: ( Op.FullyConnected, OptionsSerializer( - "FullyConnectedOptions", ("asymmetric_quantize_inputs", fused_act, "keep_num_dims", "weights_format") + "FullyConnectedOptions", + ("asymmetric_quantize_inputs", fused_act, "keep_num_dims", "weights_format", "quantized_bias_type"), ), TFLITE_IFM_WEIGHTS_BIAS_INDICES, ), @@ -791,7 +807,7 @@ builtin_operator_map = { BuiltinOperator.SIN: (Op.Sin, None, TFLITE_NO_INDICES), BuiltinOperator.TRANSPOSE_CONV: ( Op.Conv2DBackpropInput, - OptionsSerializer("TransposeConvOptions", (padding, "stride_h", "stride_w")), + OptionsSerializer("TransposeConvOptions", (padding, "stride_h", "stride_w", fused_act, "quantized_bias_type")), TFLITE_CONV2D_BACKPROP_INDICES, ), BuiltinOperator.SIGN: (Op.Sign, OptionsSerializer("SignOptions"), TFLITE_IFM_INDICES), @@ -1054,6 +1070,12 @@ builtin_operator_map = { OptionsSerializer("RightShiftOptions"), TFLITE_NO_INDICES, ), + BuiltinOperator.DILATE: (Op.Dilate, OptionsSerializer("DilateOptions"), TFLITE_NO_INDICES), + BuiltinOperator.REDUCE_WINDOW: ( + Op.ReduceWindow, + OptionsSerializer("ReduceWindowOptions", ("reduce_function",)), + TFLITE_NO_INDICES, + ), BuiltinOperator.CUSTOM: (Op.Custom, CustomOptionsSerializer(), TFLITE_NO_INDICES), } diff --git a/ethosu/vela/tflite_supported_operators.py b/ethosu/vela/tflite_supported_operators.py index e5686f4..ada2136 100644 --- a/ethosu/vela/tflite_supported_operators.py +++ b/ethosu/vela/tflite_supported_operators.py @@ -58,6 +58,7 @@ class TFLiteSupportedOperators: depthwise_convolution_ops = set((Op.DepthwiseConv2DBias,)) transpose_convolution_ops = set((Op.Conv2DBackpropInput,)) convolution_like_ops = convolution_ops | depthwise_convolution_ops | transpose_convolution_ops + conv_depth_fc_op = convolution_ops | depthwise_convolution_ops | set((Op.FullyConnected,)) max_pooling_ops = Op.op_set(Op.is_maxpool_op) avg_pooling_ops = Op.op_set(Op.is_avgpool_op) pooling_ops = set((Op.ReduceSum,)) | max_pooling_ops | avg_pooling_ops @@ -238,7 +239,8 @@ class TFLiteSupportedOperators: self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_bias_shape) self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_bias_type) self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_bias_40bit) - + for op_type in TFLiteSupportedOperators.conv_depth_fc_op: + self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_no_quantized_bias_type) # Transpose Conv specific checks: for op_type in TFLiteSupportedOperators.transpose_convolution_ops: self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_tconv_stride) @@ -532,6 +534,12 @@ class TFLiteSupportedOperators: return valid, f"Tensor '{bias.name}' has values larger than 40-bits" return True, "Op has no bias tensor, or it fits in 40-bit" + def constraint_no_quantized_bias_type(op): + "Attribute quantized_bias_type must not be set" + quantized_bias_type = op.attrs.get("quantized_bias_type", False) + valid = quantized_bias_type == 0 + return valid, f"Op has quantized_bias_type={quantized_bias_type}" + @staticmethod def constraint_batch_size(op): "IFM Tensor batch size must be 1" diff --git a/ethosu/vela/tflite_writer.py b/ethosu/vela/tflite_writer.py index 6d85567..44ce711 100644 --- a/ethosu/vela/tflite_writer.py +++ b/ethosu/vela/tflite_writer.py @@ -343,8 +343,12 @@ class TFLiteSerialiser: Operator.OperatorAddIntermediates(builder, intermediates_offset) if builtin_opt_offset is not None: - Operator.OperatorAddBuiltinOptionsType(builder, opt_serializer.builtin_opt_type) - Operator.OperatorAddBuiltinOptions(builder, builtin_opt_offset) + if opt_serializer.builtin_opt_type < 127: + Operator.OperatorAddBuiltinOptionsType(builder, opt_serializer.builtin_opt_type) + Operator.OperatorAddBuiltinOptions(builder, builtin_opt_offset) + else: + Operator.OperatorAddBuiltinOptions2Type(builder, opt_serializer.builtin_opt_type % 127) + Operator.OperatorAddBuiltinOptions2(builder, builtin_opt_offset) if custom_opt_offset is not None: Operator.OperatorAddCustomOptions(builder, custom_opt_offset) Operator.OperatorAddCustomOptionsFormat(builder, opt_serializer.custom_opt_format) -- cgit v1.2.1