# automatically generated by the FlatBuffers compiler, do not modify

# namespace: MNN

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

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

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

    @classmethod
    def GetRootAsOp(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    # Op
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # Op
    def InputIndexes(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

    # Op
    def InputIndexesAsNumpy(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

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

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

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

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

    # Op
    def Name(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

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

    # Op
    def OutputIndexesAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
        return 0

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

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

    # Op
    def Type(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

    # Op
    def DefaultDimentionFormat(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 1

def OpStart(builder): builder.StartObject(7)
def Start(builder):
    return OpStart(builder)
def OpAddInputIndexes(builder, inputIndexes): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(inputIndexes), 0)
def AddInputIndexes(builder, inputIndexes):
    return OpAddInputIndexes(builder, inputIndexes)
def OpStartInputIndexesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartInputIndexesVector(builder, numElems):
    return OpStartInputIndexesVector(builder, numElems)
def OpAddMainType(builder, mainType): builder.PrependUint8Slot(1, mainType, 0)
def AddMainType(builder, mainType):
    return OpAddMainType(builder, mainType)
def OpAddMain(builder, main): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(main), 0)
def AddMain(builder, main):
    return OpAddMain(builder, main)
def OpAddName(builder, name): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
def AddName(builder, name):
    return OpAddName(builder, name)
def OpAddOutputIndexes(builder, outputIndexes): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(outputIndexes), 0)
def AddOutputIndexes(builder, outputIndexes):
    return OpAddOutputIndexes(builder, outputIndexes)
def OpStartOutputIndexesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartOutputIndexesVector(builder, numElems):
    return OpStartOutputIndexesVector(builder, numElems)
def OpAddType(builder, type): builder.PrependInt32Slot(5, type, 0)
def AddType(builder, type):
    return OpAddType(builder, type)
def OpAddDefaultDimentionFormat(builder, defaultDimentionFormat): builder.PrependInt8Slot(6, defaultDimentionFormat, 1)
def AddDefaultDimentionFormat(builder, defaultDimentionFormat):
    return OpAddDefaultDimentionFormat(builder, defaultDimentionFormat)
def OpEnd(builder): return builder.EndObject()
def End(builder):
    return OpEnd(builder)