Module tflite.SparsityParameters
Expand source code
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: tflite
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class SparsityParameters(object):
__slots__ = ['_tab']
@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = SparsityParameters()
x.Init(buf, n + offset)
return x
@classmethod
def GetRootAsSparsityParameters(cls, buf, offset=0):
"""This method is deprecated. Please switch to GetRootAs."""
return cls.GetRootAs(buf, offset)
@classmethod
def SparsityParametersBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed)
# SparsityParameters
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
# SparsityParameters
def TraversalOrder(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.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# SparsityParameters
def TraversalOrderAsNumpy(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
return 0
# SparsityParameters
def TraversalOrderLength(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.VectorLen(o)
return 0
# SparsityParameters
def TraversalOrderIsNone(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
return o == 0
# SparsityParameters
def BlockMap(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.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0
# SparsityParameters
def BlockMapAsNumpy(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
return 0
# SparsityParameters
def BlockMapLength(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
return self._tab.VectorLen(o)
return 0
# SparsityParameters
def BlockMapIsNone(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
return o == 0
# SparsityParameters
def DimMetadata(self, j):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
from tflite.DimensionMetadata import DimensionMetadata
obj = DimensionMetadata()
obj.Init(self._tab.Bytes, x)
return obj
return None
# SparsityParameters
def DimMetadataLength(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
return self._tab.VectorLen(o)
return 0
# SparsityParameters
def DimMetadataIsNone(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
return o == 0
def SparsityParametersStart(builder): builder.StartObject(3)
def Start(builder):
return SparsityParametersStart(builder)
def SparsityParametersAddTraversalOrder(builder, traversalOrder): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(traversalOrder), 0)
def AddTraversalOrder(builder, traversalOrder):
return SparsityParametersAddTraversalOrder(builder, traversalOrder)
def SparsityParametersStartTraversalOrderVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartTraversalOrderVector(builder, numElems):
return SparsityParametersStartTraversalOrderVector(builder, numElems)
def SparsityParametersAddBlockMap(builder, blockMap): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(blockMap), 0)
def AddBlockMap(builder, blockMap):
return SparsityParametersAddBlockMap(builder, blockMap)
def SparsityParametersStartBlockMapVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartBlockMapVector(builder, numElems):
return SparsityParametersStartBlockMapVector(builder, numElems)
def SparsityParametersAddDimMetadata(builder, dimMetadata): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(dimMetadata), 0)
def AddDimMetadata(builder, dimMetadata):
return SparsityParametersAddDimMetadata(builder, dimMetadata)
def SparsityParametersStartDimMetadataVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartDimMetadataVector(builder, numElems):
return SparsityParametersStartDimMetadataVector(builder, numElems)
def SparsityParametersEnd(builder): return builder.EndObject()
def End(builder):
return SparsityParametersEnd(builder)
Functions
def AddBlockMap(builder, blockMap)
-
Expand source code
def AddBlockMap(builder, blockMap): return SparsityParametersAddBlockMap(builder, blockMap)
def AddDimMetadata(builder, dimMetadata)
-
Expand source code
def AddDimMetadata(builder, dimMetadata): return SparsityParametersAddDimMetadata(builder, dimMetadata)
def AddTraversalOrder(builder, traversalOrder)
-
Expand source code
def AddTraversalOrder(builder, traversalOrder): return SparsityParametersAddTraversalOrder(builder, traversalOrder)
def End(builder)
-
Expand source code
def End(builder): return SparsityParametersEnd(builder)
def SparsityParametersAddBlockMap(builder, blockMap)
-
Expand source code
def SparsityParametersAddBlockMap(builder, blockMap): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(blockMap), 0)
def SparsityParametersAddDimMetadata(builder, dimMetadata)
-
Expand source code
def SparsityParametersAddDimMetadata(builder, dimMetadata): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(dimMetadata), 0)
def SparsityParametersAddTraversalOrder(builder, traversalOrder)
-
Expand source code
def SparsityParametersAddTraversalOrder(builder, traversalOrder): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(traversalOrder), 0)
def SparsityParametersEnd(builder)
-
Expand source code
def SparsityParametersEnd(builder): return builder.EndObject()
def SparsityParametersStart(builder)
-
Expand source code
def SparsityParametersStart(builder): builder.StartObject(3)
def SparsityParametersStartBlockMapVector(builder, numElems)
-
Expand source code
def SparsityParametersStartBlockMapVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def SparsityParametersStartDimMetadataVector(builder, numElems)
-
Expand source code
def SparsityParametersStartDimMetadataVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def SparsityParametersStartTraversalOrderVector(builder, numElems)
-
Expand source code
def SparsityParametersStartTraversalOrderVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def Start(builder)
-
Expand source code
def Start(builder): return SparsityParametersStart(builder)
def StartBlockMapVector(builder, numElems)
-
Expand source code
def StartBlockMapVector(builder, numElems): return SparsityParametersStartBlockMapVector(builder, numElems)
def StartDimMetadataVector(builder, numElems)
-
Expand source code
def StartDimMetadataVector(builder, numElems): return SparsityParametersStartDimMetadataVector(builder, numElems)
def StartTraversalOrderVector(builder, numElems)
-
Expand source code
def StartTraversalOrderVector(builder, numElems): return SparsityParametersStartTraversalOrderVector(builder, numElems)
Classes
class SparsityParameters
-
Expand source code
class SparsityParameters(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) x = SparsityParameters() x.Init(buf, n + offset) return x @classmethod def GetRootAsSparsityParameters(cls, buf, offset=0): """This method is deprecated. Please switch to GetRootAs.""" return cls.GetRootAs(buf, offset) @classmethod def SparsityParametersBufferHasIdentifier(cls, buf, offset, size_prefixed=False): return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) # SparsityParameters def Init(self, buf, pos): self._tab = flatbuffers.table.Table(buf, pos) # SparsityParameters def TraversalOrder(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.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) return 0 # SparsityParameters def TraversalOrderAsNumpy(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) if o != 0: return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) return 0 # SparsityParameters def TraversalOrderLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) if o != 0: return self._tab.VectorLen(o) return 0 # SparsityParameters def TraversalOrderIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) return o == 0 # SparsityParameters def BlockMap(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.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) return 0 # SparsityParameters def BlockMapAsNumpy(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) if o != 0: return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) return 0 # SparsityParameters def BlockMapLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) if o != 0: return self._tab.VectorLen(o) return 0 # SparsityParameters def BlockMapIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) return o == 0 # SparsityParameters def DimMetadata(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) if o != 0: x = self._tab.Vector(o) x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 x = self._tab.Indirect(x) from tflite.DimensionMetadata import DimensionMetadata obj = DimensionMetadata() obj.Init(self._tab.Bytes, x) return obj return None # SparsityParameters def DimMetadataLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) if o != 0: return self._tab.VectorLen(o) return 0 # SparsityParameters def DimMetadataIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) return o == 0
Static methods
def GetRootAs(buf, offset=0)
-
Expand source code
@classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) x = SparsityParameters() x.Init(buf, n + offset) return x
def GetRootAsSparsityParameters(buf, offset=0)
-
This method is deprecated. Please switch to GetRootAs.
Expand source code
@classmethod def GetRootAsSparsityParameters(cls, buf, offset=0): """This method is deprecated. Please switch to GetRootAs.""" return cls.GetRootAs(buf, offset)
def SparsityParametersBufferHasIdentifier(buf, offset, size_prefixed=False)
-
Expand source code
@classmethod def SparsityParametersBufferHasIdentifier(cls, buf, offset, size_prefixed=False): return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed)
Methods
def BlockMap(self, j)
-
Expand source code
def BlockMap(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.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) return 0
def BlockMapAsNumpy(self)
-
Expand source code
def BlockMapAsNumpy(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) if o != 0: return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) return 0
def BlockMapIsNone(self)
-
Expand source code
def BlockMapIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) return o == 0
def BlockMapLength(self)
-
Expand source code
def BlockMapLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) if o != 0: return self._tab.VectorLen(o) return 0
def DimMetadata(self, j)
-
Expand source code
def DimMetadata(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) if o != 0: x = self._tab.Vector(o) x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 x = self._tab.Indirect(x) from tflite.DimensionMetadata import DimensionMetadata obj = DimensionMetadata() obj.Init(self._tab.Bytes, x) return obj return None
def DimMetadataIsNone(self)
-
Expand source code
def DimMetadataIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) return o == 0
def DimMetadataLength(self)
-
Expand source code
def DimMetadataLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) if o != 0: return self._tab.VectorLen(o) return 0
def Init(self, buf, pos)
-
Expand source code
def Init(self, buf, pos): self._tab = flatbuffers.table.Table(buf, pos)
def TraversalOrder(self, j)
-
Expand source code
def TraversalOrder(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.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) return 0
def TraversalOrderAsNumpy(self)
-
Expand source code
def TraversalOrderAsNumpy(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) if o != 0: return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o) return 0
def TraversalOrderIsNone(self)
-
Expand source code
def TraversalOrderIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) return o == 0
def TraversalOrderLength(self)
-
Expand source code
def TraversalOrderLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) if o != 0: return self._tab.VectorLen(o) return 0