Imported Upstream version 1.7.0
[platform/core/ml/nnfw.git] / tools / tflitefile_tool / tflite / ReshapeOptions.py
1 # automatically generated by the FlatBuffers compiler, do not modify
2
3 # namespace: onert_tflite
4
5 import flatbuffers
6
7
8 class ReshapeOptions(object):
9     __slots__ = ['_tab']
10
11     @classmethod
12     def GetRootAsReshapeOptions(cls, buf, offset):
13         n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
14         x = ReshapeOptions()
15         x.Init(buf, n + offset)
16         return x
17
18     # ReshapeOptions
19     def Init(self, buf, pos):
20         self._tab = flatbuffers.table.Table(buf, pos)
21
22     # ReshapeOptions
23     def NewShape(self, j):
24         o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
25         if o != 0:
26             a = self._tab.Vector(o)
27             return self._tab.Get(
28                 flatbuffers.number_types.Int32Flags,
29                 a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
30         return 0
31
32     # ReshapeOptions
33     def NewShapeAsNumpy(self):
34         o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
35         if o != 0:
36             return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
37         return 0
38
39     # ReshapeOptions
40     def NewShapeLength(self):
41         o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
42         if o != 0:
43             return self._tab.VectorLen(o)
44         return 0
45
46
47 def ReshapeOptionsStart(builder):
48     builder.StartObject(1)
49
50
51 def ReshapeOptionsAddNewShape(builder, newShape):
52     builder.PrependUOffsetTRelativeSlot(
53         0, flatbuffers.number_types.UOffsetTFlags.py_type(newShape), 0)
54
55
56 def ReshapeOptionsStartNewShapeVector(builder, numElems):
57     return builder.StartVector(4, numElems, 4)
58
59
60 def ReshapeOptionsEnd(builder):
61     return builder.EndObject()