Patrik Gustavsson | 8f1f9aa | 2021-06-28 07:41:58 +0200 | [diff] [blame] | 1 | # automatically generated by the FlatBuffers compiler, do not modify |
| 2 | |
| 3 | # namespace: tosa |
| 4 | |
| 5 | import flatbuffers |
| 6 | |
| 7 | class TosaOperator(object): |
| 8 | __slots__ = ['_tab'] |
| 9 | |
| 10 | @classmethod |
| 11 | def GetRootAsTosaOperator(cls, buf, offset): |
| 12 | n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) |
| 13 | x = TosaOperator() |
| 14 | x.Init(buf, n + offset) |
| 15 | return x |
| 16 | |
| 17 | # TosaOperator |
| 18 | def Init(self, buf, pos): |
| 19 | self._tab = flatbuffers.table.Table(buf, pos) |
| 20 | |
| 21 | # TosaOperator |
| 22 | def Op(self): |
| 23 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) |
| 24 | if o != 0: |
| 25 | return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos) |
| 26 | return 0 |
| 27 | |
| 28 | # TosaOperator |
| 29 | def AttributeType(self): |
| 30 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) |
| 31 | if o != 0: |
| 32 | return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) |
| 33 | return 0 |
| 34 | |
| 35 | # TosaOperator |
| 36 | def Attribute(self): |
| 37 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) |
| 38 | if o != 0: |
| 39 | from flatbuffers.table import Table |
| 40 | obj = Table(bytearray(), 0) |
| 41 | self._tab.Union(obj, o) |
| 42 | return obj |
| 43 | return None |
| 44 | |
| 45 | # TosaOperator |
| 46 | def Inputs(self, j): |
| 47 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) |
| 48 | if o != 0: |
| 49 | a = self._tab.Vector(o) |
| 50 | return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) |
| 51 | return "" |
| 52 | |
| 53 | # TosaOperator |
| 54 | def InputsLength(self): |
| 55 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) |
| 56 | if o != 0: |
| 57 | return self._tab.VectorLen(o) |
| 58 | return 0 |
| 59 | |
| 60 | # TosaOperator |
| 61 | def Outputs(self, j): |
| 62 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) |
| 63 | if o != 0: |
| 64 | a = self._tab.Vector(o) |
| 65 | return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) |
| 66 | return "" |
| 67 | |
| 68 | # TosaOperator |
| 69 | def OutputsLength(self): |
| 70 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) |
| 71 | if o != 0: |
| 72 | return self._tab.VectorLen(o) |
| 73 | return 0 |
| 74 | |
| 75 | # TosaOperator |
| 76 | def QuantInfoType(self): |
| 77 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) |
| 78 | if o != 0: |
| 79 | return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) |
| 80 | return 0 |
| 81 | |
| 82 | # TosaOperator |
| 83 | def QuantInfo(self): |
| 84 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) |
| 85 | if o != 0: |
| 86 | from flatbuffers.table import Table |
| 87 | obj = Table(bytearray(), 0) |
| 88 | self._tab.Union(obj, o) |
| 89 | return obj |
| 90 | return None |
| 91 | |
| 92 | def TosaOperatorStart(builder): builder.StartObject(7) |
| 93 | def TosaOperatorAddOp(builder, op): builder.PrependUint32Slot(0, op, 0) |
| 94 | def TosaOperatorAddAttributeType(builder, attributeType): builder.PrependUint8Slot(1, attributeType, 0) |
| 95 | def TosaOperatorAddAttribute(builder, attribute): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(attribute), 0) |
| 96 | def TosaOperatorAddInputs(builder, inputs): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(inputs), 0) |
| 97 | def TosaOperatorStartInputsVector(builder, numElems): return builder.StartVector(4, numElems, 4) |
| 98 | def TosaOperatorAddOutputs(builder, outputs): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(outputs), 0) |
| 99 | def TosaOperatorStartOutputsVector(builder, numElems): return builder.StartVector(4, numElems, 4) |
| 100 | def TosaOperatorAddQuantInfoType(builder, quantInfoType): builder.PrependUint8Slot(5, quantInfoType, 0) |
| 101 | def TosaOperatorAddQuantInfo(builder, quantInfo): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(quantInfo), 0) |
| 102 | def TosaOperatorEnd(builder): return builder.EndObject() |