87 lines
3.2 KiB
Python
87 lines
3.2 KiB
Python
# automatically generated by the FlatBuffers compiler, do not modify
|
|
|
|
# namespace: graph
|
|
|
|
import flatbuffers
|
|
|
|
class FlatArray(object):
|
|
__slots__ = ['_tab']
|
|
|
|
@classmethod
|
|
def GetRootAsFlatArray(cls, buf, offset):
|
|
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
|
x = FlatArray()
|
|
x.Init(buf, n + offset)
|
|
return x
|
|
|
|
# FlatArray
|
|
def Init(self, buf, pos):
|
|
self._tab = flatbuffers.table.Table(buf, pos)
|
|
|
|
# FlatArray
|
|
def Shape(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
|
|
|
|
# FlatArray
|
|
def ShapeAsNumpy(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
|
|
|
|
# FlatArray
|
|
def ShapeLength(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
|
if o != 0:
|
|
return self._tab.VectorLen(o)
|
|
return 0
|
|
|
|
# FlatArray
|
|
def Buffer(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.Int8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
|
|
return 0
|
|
|
|
# FlatArray
|
|
def BufferAsNumpy(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
|
if o != 0:
|
|
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int8Flags, o)
|
|
return 0
|
|
|
|
# FlatArray
|
|
def BufferLength(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
|
if o != 0:
|
|
return self._tab.VectorLen(o)
|
|
return 0
|
|
|
|
# FlatArray
|
|
def Dtype(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
|
if o != 0:
|
|
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
|
|
return 0
|
|
|
|
# FlatArray
|
|
def ByteOrder(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
|
if o != 0:
|
|
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
|
|
return 0
|
|
|
|
def FlatArrayStart(builder): builder.StartObject(4)
|
|
def FlatArrayAddShape(builder, shape): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(shape), 0)
|
|
def FlatArrayStartShapeVector(builder, numElems): return builder.StartVector(8, numElems, 8)
|
|
def FlatArrayAddBuffer(builder, buffer): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(buffer), 0)
|
|
def FlatArrayStartBufferVector(builder, numElems): return builder.StartVector(1, numElems, 1)
|
|
def FlatArrayAddDtype(builder, dtype): builder.PrependInt8Slot(2, dtype, 0)
|
|
def FlatArrayAddByteOrder(builder, byteOrder): builder.PrependInt8Slot(3, byteOrder, 0)
|
|
def FlatArrayEnd(builder): return builder.EndObject()
|