blob: ab4a1605079d797d126d934dbdbf86f171b844a4 [file] [log] [blame]
Eric Kunzee5e26762020-10-13 16:11:07 -07001# automatically generated by the FlatBuffers compiler, do not modify
2
3# Copyright (c) 2020, ARM Limited.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17
18# namespace: tosa
19
20import flatbuffers
21
22class TosaOperator(object):
23 __slots__ = ['_tab']
24
25 @classmethod
26 def GetRootAsTosaOperator(cls, buf, offset):
27 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
28 x = TosaOperator()
29 x.Init(buf, n + offset)
30 return x
31
32 # TosaOperator
33 def Init(self, buf, pos):
34 self._tab = flatbuffers.table.Table(buf, pos)
35
36 # TosaOperator
37 def Op(self):
38 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
39 if o != 0:
40 return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
41 return 0
42
43 # TosaOperator
44 def AttributeType(self):
45 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
46 if o != 0:
47 return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
48 return 0
49
50 # TosaOperator
51 def Attribute(self):
52 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
53 if o != 0:
54 from flatbuffers.table import Table
55 obj = Table(bytearray(), 0)
56 self._tab.Union(obj, o)
57 return obj
58 return None
59
60 # TosaOperator
61 def Inputs(self, j):
62 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
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 InputsLength(self):
70 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
71 if o != 0:
72 return self._tab.VectorLen(o)
73 return 0
74
75 # TosaOperator
76 def Outputs(self, j):
77 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
78 if o != 0:
79 a = self._tab.Vector(o)
80 return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
81 return ""
82
83 # TosaOperator
84 def OutputsLength(self):
85 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
86 if o != 0:
87 return self._tab.VectorLen(o)
88 return 0
89
90 # TosaOperator
91 def QuantInfoType(self):
92 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
93 if o != 0:
94 return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
95 return 0
96
97 # TosaOperator
98 def QuantInfo(self):
99 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
100 if o != 0:
101 from flatbuffers.table import Table
102 obj = Table(bytearray(), 0)
103 self._tab.Union(obj, o)
104 return obj
105 return None
106
107def TosaOperatorStart(builder): builder.StartObject(7)
108def TosaOperatorAddOp(builder, op): builder.PrependUint32Slot(0, op, 0)
109def TosaOperatorAddAttributeType(builder, attributeType): builder.PrependUint8Slot(1, attributeType, 0)
110def TosaOperatorAddAttribute(builder, attribute): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(attribute), 0)
111def TosaOperatorAddInputs(builder, inputs): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(inputs), 0)
112def TosaOperatorStartInputsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
113def TosaOperatorAddOutputs(builder, outputs): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(outputs), 0)
114def TosaOperatorStartOutputsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
115def TosaOperatorAddQuantInfoType(builder, quantInfoType): builder.PrependUint8Slot(5, quantInfoType, 0)
116def TosaOperatorAddQuantInfo(builder, quantInfo): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(quantInfo), 0)
117def TosaOperatorEnd(builder): return builder.EndObject()