# automatically generated by the FlatBuffers compiler, do not modify

# namespace: tflite

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

class StablehloDotGeneralOptions(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAs(cls, buf, offset=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = StablehloDotGeneralOptions()
        x.Init(buf, n + offset)
        return x

    @classmethod
    def GetRootAsStablehloDotGeneralOptions(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    @classmethod
    def StablehloDotGeneralOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
        return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed)

    # StablehloDotGeneralOptions
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # StablehloDotGeneralOptions
    def LhsBatchingDimensions(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

    # StablehloDotGeneralOptions
    def LhsBatchingDimensionsAsNumpy(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

    # StablehloDotGeneralOptions
    def LhsBatchingDimensionsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # StablehloDotGeneralOptions
    def LhsBatchingDimensionsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        return o == 0

    # StablehloDotGeneralOptions
    def RhsBatchingDimensions(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

    # StablehloDotGeneralOptions
    def RhsBatchingDimensionsAsNumpy(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

    # StablehloDotGeneralOptions
    def RhsBatchingDimensionsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # StablehloDotGeneralOptions
    def RhsBatchingDimensionsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        return o == 0

    # StablehloDotGeneralOptions
    def LhsContractingDimensions(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

    # StablehloDotGeneralOptions
    def LhsContractingDimensionsAsNumpy(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

    # StablehloDotGeneralOptions
    def LhsContractingDimensionsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # StablehloDotGeneralOptions
    def LhsContractingDimensionsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        return o == 0

    # StablehloDotGeneralOptions
    def RhsContractingDimensions(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        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

    # StablehloDotGeneralOptions
    def RhsContractingDimensionsAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o)
        return 0

    # StablehloDotGeneralOptions
    def RhsContractingDimensionsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # StablehloDotGeneralOptions
    def RhsContractingDimensionsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        return o == 0

    # StablehloDotGeneralOptions
    def PrecisionConfig(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.Uint32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return 0

    # StablehloDotGeneralOptions
    def PrecisionConfigAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint32Flags, o)
        return 0

    # StablehloDotGeneralOptions
    def PrecisionConfigLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # StablehloDotGeneralOptions
    def PrecisionConfigIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        return o == 0

def StablehloDotGeneralOptionsStart(builder):
    builder.StartObject(5)

def Start(builder):
    StablehloDotGeneralOptionsStart(builder)

def StablehloDotGeneralOptionsAddLhsBatchingDimensions(builder, lhsBatchingDimensions):
    builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(lhsBatchingDimensions), 0)

def AddLhsBatchingDimensions(builder, lhsBatchingDimensions):
    StablehloDotGeneralOptionsAddLhsBatchingDimensions(builder, lhsBatchingDimensions)

def StablehloDotGeneralOptionsStartLhsBatchingDimensionsVector(builder, numElems):
    return builder.StartVector(8, numElems, 8)

def StartLhsBatchingDimensionsVector(builder, numElems):
    return StablehloDotGeneralOptionsStartLhsBatchingDimensionsVector(builder, numElems)

def StablehloDotGeneralOptionsAddRhsBatchingDimensions(builder, rhsBatchingDimensions):
    builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(rhsBatchingDimensions), 0)

def AddRhsBatchingDimensions(builder, rhsBatchingDimensions):
    StablehloDotGeneralOptionsAddRhsBatchingDimensions(builder, rhsBatchingDimensions)

def StablehloDotGeneralOptionsStartRhsBatchingDimensionsVector(builder, numElems):
    return builder.StartVector(8, numElems, 8)

def StartRhsBatchingDimensionsVector(builder, numElems):
    return StablehloDotGeneralOptionsStartRhsBatchingDimensionsVector(builder, numElems)

def StablehloDotGeneralOptionsAddLhsContractingDimensions(builder, lhsContractingDimensions):
    builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(lhsContractingDimensions), 0)

def AddLhsContractingDimensions(builder, lhsContractingDimensions):
    StablehloDotGeneralOptionsAddLhsContractingDimensions(builder, lhsContractingDimensions)

def StablehloDotGeneralOptionsStartLhsContractingDimensionsVector(builder, numElems):
    return builder.StartVector(8, numElems, 8)

def StartLhsContractingDimensionsVector(builder, numElems):
    return StablehloDotGeneralOptionsStartLhsContractingDimensionsVector(builder, numElems)

def StablehloDotGeneralOptionsAddRhsContractingDimensions(builder, rhsContractingDimensions):
    builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(rhsContractingDimensions), 0)

def AddRhsContractingDimensions(builder, rhsContractingDimensions):
    StablehloDotGeneralOptionsAddRhsContractingDimensions(builder, rhsContractingDimensions)

def StablehloDotGeneralOptionsStartRhsContractingDimensionsVector(builder, numElems):
    return builder.StartVector(8, numElems, 8)

def StartRhsContractingDimensionsVector(builder, numElems):
    return StablehloDotGeneralOptionsStartRhsContractingDimensionsVector(builder, numElems)

def StablehloDotGeneralOptionsAddPrecisionConfig(builder, precisionConfig):
    builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(precisionConfig), 0)

def AddPrecisionConfig(builder, precisionConfig):
    StablehloDotGeneralOptionsAddPrecisionConfig(builder, precisionConfig)

def StablehloDotGeneralOptionsStartPrecisionConfigVector(builder, numElems):
    return builder.StartVector(4, numElems, 4)

def StartPrecisionConfigVector(builder, numElems):
    return StablehloDotGeneralOptionsStartPrecisionConfigVector(builder, numElems)

def StablehloDotGeneralOptionsEnd(builder):
    return builder.EndObject()

def End(builder):
    return StablehloDotGeneralOptionsEnd(builder)
