| # automatically generated by the FlatBuffers compiler, do not modify |
| |
| # namespace: tflite |
| |
| import flatbuffers |
| from flatbuffers.compat import import_numpy |
| np = import_numpy() |
| |
| class StablehloGatherOptions(object): |
| __slots__ = ['_tab'] |
| |
| @classmethod |
| def GetRootAs(cls, buf, offset=0): |
| n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) |
| x = StablehloGatherOptions() |
| x.Init(buf, n + offset) |
| return x |
| |
| @classmethod |
| def GetRootAsStablehloGatherOptions(cls, buf, offset=0): |
| """This method is deprecated. Please switch to GetRootAs.""" |
| return cls.GetRootAs(buf, offset) |
| @classmethod |
| def StablehloGatherOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False): |
| return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed) |
| |
| # StablehloGatherOptions |
| def Init(self, buf, pos): |
| self._tab = flatbuffers.table.Table(buf, pos) |
| |
| # StablehloGatherOptions |
| def OffsetDims(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 |
| |
| # StablehloGatherOptions |
| def OffsetDimsAsNumpy(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 |
| |
| # StablehloGatherOptions |
| def OffsetDimsLength(self): |
| o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) |
| if o != 0: |
| return self._tab.VectorLen(o) |
| return 0 |
| |
| # StablehloGatherOptions |
| def OffsetDimsIsNone(self): |
| o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) |
| return o == 0 |
| |
| # StablehloGatherOptions |
| def CollapsedSliceDims(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.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) |
| return 0 |
| |
| # StablehloGatherOptions |
| def CollapsedSliceDimsAsNumpy(self): |
| o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) |
| if o != 0: |
| return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) |
| return 0 |
| |
| # StablehloGatherOptions |
| def CollapsedSliceDimsLength(self): |
| o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) |
| if o != 0: |
| return self._tab.VectorLen(o) |
| return 0 |
| |
| # StablehloGatherOptions |
| def CollapsedSliceDimsIsNone(self): |
| o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) |
| return o == 0 |
| |
| # StablehloGatherOptions |
| def StartIndexMap(self, j): |
| o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) |
| 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 |
| |
| # StablehloGatherOptions |
| def StartIndexMapAsNumpy(self): |
| o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) |
| if o != 0: |
| return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) |
| return 0 |
| |
| # StablehloGatherOptions |
| def StartIndexMapLength(self): |
| o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) |
| if o != 0: |
| return self._tab.VectorLen(o) |
| return 0 |
| |
| # StablehloGatherOptions |
| def StartIndexMapIsNone(self): |
| o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) |
| return o == 0 |
| |
| # StablehloGatherOptions |
| def IndexVectorDim(self): |
| o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) |
| if o != 0: |
| return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) |
| return 0 |
| |
| # StablehloGatherOptions |
| def SliceSizes(self, j): |
| o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) |
| 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 |
| |
| # StablehloGatherOptions |
| def SliceSizesAsNumpy(self): |
| o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) |
| if o != 0: |
| return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) |
| return 0 |
| |
| # StablehloGatherOptions |
| def SliceSizesLength(self): |
| o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) |
| if o != 0: |
| return self._tab.VectorLen(o) |
| return 0 |
| |
| # StablehloGatherOptions |
| def SliceSizesIsNone(self): |
| o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) |
| return o == 0 |
| |
| # StablehloGatherOptions |
| def IndicesAreSorted(self): |
| o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) |
| if o != 0: |
| return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) |
| return False |
| |
| def StablehloGatherOptionsStart(builder): builder.StartObject(6) |
| def Start(builder): |
| return StablehloGatherOptionsStart(builder) |
| def StablehloGatherOptionsAddOffsetDims(builder, offsetDims): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(offsetDims), 0) |
| def AddOffsetDims(builder, offsetDims): |
| return StablehloGatherOptionsAddOffsetDims(builder, offsetDims) |
| def StablehloGatherOptionsStartOffsetDimsVector(builder, numElems): return builder.StartVector(8, numElems, 8) |
| def StartOffsetDimsVector(builder, numElems): |
| return StablehloGatherOptionsStartOffsetDimsVector(builder, numElems) |
| def StablehloGatherOptionsAddCollapsedSliceDims(builder, collapsedSliceDims): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(collapsedSliceDims), 0) |
| def AddCollapsedSliceDims(builder, collapsedSliceDims): |
| return StablehloGatherOptionsAddCollapsedSliceDims(builder, collapsedSliceDims) |
| def StablehloGatherOptionsStartCollapsedSliceDimsVector(builder, numElems): return builder.StartVector(8, numElems, 8) |
| def StartCollapsedSliceDimsVector(builder, numElems): |
| return StablehloGatherOptionsStartCollapsedSliceDimsVector(builder, numElems) |
| def StablehloGatherOptionsAddStartIndexMap(builder, startIndexMap): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(startIndexMap), 0) |
| def AddStartIndexMap(builder, startIndexMap): |
| return StablehloGatherOptionsAddStartIndexMap(builder, startIndexMap) |
| def StablehloGatherOptionsStartStartIndexMapVector(builder, numElems): return builder.StartVector(8, numElems, 8) |
| def StartStartIndexMapVector(builder, numElems): |
| return StablehloGatherOptionsStartStartIndexMapVector(builder, numElems) |
| def StablehloGatherOptionsAddIndexVectorDim(builder, indexVectorDim): builder.PrependInt64Slot(3, indexVectorDim, 0) |
| def AddIndexVectorDim(builder, indexVectorDim): |
| return StablehloGatherOptionsAddIndexVectorDim(builder, indexVectorDim) |
| def StablehloGatherOptionsAddSliceSizes(builder, sliceSizes): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(sliceSizes), 0) |
| def AddSliceSizes(builder, sliceSizes): |
| return StablehloGatherOptionsAddSliceSizes(builder, sliceSizes) |
| def StablehloGatherOptionsStartSliceSizesVector(builder, numElems): return builder.StartVector(8, numElems, 8) |
| def StartSliceSizesVector(builder, numElems): |
| return StablehloGatherOptionsStartSliceSizesVector(builder, numElems) |
| def StablehloGatherOptionsAddIndicesAreSorted(builder, indicesAreSorted): builder.PrependBoolSlot(5, indicesAreSorted, 0) |
| def AddIndicesAreSorted(builder, indicesAreSorted): |
| return StablehloGatherOptionsAddIndicesAreSorted(builder, indicesAreSorted) |
| def StablehloGatherOptionsEnd(builder): return builder.EndObject() |
| def End(builder): |
| return StablehloGatherOptionsEnd(builder) |