# automatically generated by the FlatBuffers compiler, do not modify

# namespace: tflite

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

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

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

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

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

    # Operator
    def OpcodeIndex(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
        return 0

    # Operator
    def Inputs(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

    # Operator
    def InputsAsNumpy(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

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

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

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

    # Operator
    def OutputsAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
        return 0

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

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

    # Operator
    def BuiltinOptionsType(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 0

    # Operator
    def BuiltinOptions(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            from flatbuffers.table import Table
            obj = Table(bytearray(), 0)
            self._tab.Union(obj, o)
            return obj
        return None

    # Operator
    def CustomOptions(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
        return 0

    # Operator
    def CustomOptionsAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
        return 0

    # Operator
    def CustomOptionsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Operator
    def CustomOptionsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        return o == 0

    # Operator
    def CustomOptionsFormat(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
        return 0

    # Operator
    def MutatingVariableInputs(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.BoolFlags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
        return 0

    # Operator
    def MutatingVariableInputsAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.BoolFlags, o)
        return 0

    # Operator
    def MutatingVariableInputsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Operator
    def MutatingVariableInputsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        return o == 0

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

    # Operator
    def IntermediatesAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
        return 0

    # Operator
    def IntermediatesLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Operator
    def IntermediatesIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        return o == 0

    # Operator
    def LargeCustomOptionsOffset(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # Operator
    def LargeCustomOptionsSize(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
        return 0

    # Operator
    def BuiltinOptions2Type(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 0

    # Operator
    def BuiltinOptions2(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
        if o != 0:
            from flatbuffers.table import Table
            obj = Table(bytearray(), 0)
            self._tab.Union(obj, o)
            return obj
        return None

    # Operator
    def DebugMetadataIndex(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return -1

def OperatorStart(builder):
    builder.StartObject(14)

def Start(builder):
    OperatorStart(builder)

def OperatorAddOpcodeIndex(builder, opcodeIndex):
    builder.PrependUint32Slot(0, opcodeIndex, 0)

def AddOpcodeIndex(builder, opcodeIndex):
    OperatorAddOpcodeIndex(builder, opcodeIndex)

def OperatorAddInputs(builder, inputs):
    builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(inputs), 0)

def AddInputs(builder, inputs):
    OperatorAddInputs(builder, inputs)

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

def StartInputsVector(builder, numElems):
    return OperatorStartInputsVector(builder, numElems)

def OperatorAddOutputs(builder, outputs):
    builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(outputs), 0)

def AddOutputs(builder, outputs):
    OperatorAddOutputs(builder, outputs)

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

def StartOutputsVector(builder, numElems):
    return OperatorStartOutputsVector(builder, numElems)

def OperatorAddBuiltinOptionsType(builder, builtinOptionsType):
    builder.PrependUint8Slot(3, builtinOptionsType, 0)

def AddBuiltinOptionsType(builder, builtinOptionsType):
    OperatorAddBuiltinOptionsType(builder, builtinOptionsType)

def OperatorAddBuiltinOptions(builder, builtinOptions):
    builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(builtinOptions), 0)

def AddBuiltinOptions(builder, builtinOptions):
    OperatorAddBuiltinOptions(builder, builtinOptions)

def OperatorAddCustomOptions(builder, customOptions):
    builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(customOptions), 0)

def AddCustomOptions(builder, customOptions):
    OperatorAddCustomOptions(builder, customOptions)

def OperatorStartCustomOptionsVector(builder, numElems):
    return builder.StartVector(1, numElems, 1)

def StartCustomOptionsVector(builder, numElems):
    return OperatorStartCustomOptionsVector(builder, numElems)

def OperatorAddCustomOptionsFormat(builder, customOptionsFormat):
    builder.PrependInt8Slot(6, customOptionsFormat, 0)

def AddCustomOptionsFormat(builder, customOptionsFormat):
    OperatorAddCustomOptionsFormat(builder, customOptionsFormat)

def OperatorAddMutatingVariableInputs(builder, mutatingVariableInputs):
    builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(mutatingVariableInputs), 0)

def AddMutatingVariableInputs(builder, mutatingVariableInputs):
    OperatorAddMutatingVariableInputs(builder, mutatingVariableInputs)

def OperatorStartMutatingVariableInputsVector(builder, numElems):
    return builder.StartVector(1, numElems, 1)

def StartMutatingVariableInputsVector(builder, numElems):
    return OperatorStartMutatingVariableInputsVector(builder, numElems)

def OperatorAddIntermediates(builder, intermediates):
    builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(intermediates), 0)

def AddIntermediates(builder, intermediates):
    OperatorAddIntermediates(builder, intermediates)

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

def StartIntermediatesVector(builder, numElems):
    return OperatorStartIntermediatesVector(builder, numElems)

def OperatorAddLargeCustomOptionsOffset(builder, largeCustomOptionsOffset):
    builder.PrependUint64Slot(9, largeCustomOptionsOffset, 0)

def AddLargeCustomOptionsOffset(builder, largeCustomOptionsOffset):
    OperatorAddLargeCustomOptionsOffset(builder, largeCustomOptionsOffset)

def OperatorAddLargeCustomOptionsSize(builder, largeCustomOptionsSize):
    builder.PrependUint64Slot(10, largeCustomOptionsSize, 0)

def AddLargeCustomOptionsSize(builder, largeCustomOptionsSize):
    OperatorAddLargeCustomOptionsSize(builder, largeCustomOptionsSize)

def OperatorAddBuiltinOptions2Type(builder, builtinOptions2Type):
    builder.PrependUint8Slot(11, builtinOptions2Type, 0)

def AddBuiltinOptions2Type(builder, builtinOptions2Type):
    OperatorAddBuiltinOptions2Type(builder, builtinOptions2Type)

def OperatorAddBuiltinOptions2(builder, builtinOptions2):
    builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(builtinOptions2), 0)

def AddBuiltinOptions2(builder, builtinOptions2):
    OperatorAddBuiltinOptions2(builder, builtinOptions2)

def OperatorAddDebugMetadataIndex(builder, debugMetadataIndex):
    builder.PrependInt32Slot(13, debugMetadataIndex, -1)

def AddDebugMetadataIndex(builder, debugMetadataIndex):
    OperatorAddDebugMetadataIndex(builder, debugMetadataIndex)

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

def End(builder):
    return OperatorEnd(builder)
