# automatically generated by the FlatBuffers compiler, do not modify

# namespace: MNN

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

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

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

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

    # Extra
    def Type(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Extra
    def Engine(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Extra
    def Info(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.Int8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
        return 0

    # Extra
    def InfoAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int8Flags, o)
        return 0

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

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

    # Extra
    def Attr(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            obj = Attribute()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

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

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

def ExtraStart(builder): builder.StartObject(4)
def Start(builder):
    return ExtraStart(builder)
def ExtraAddType(builder, type): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(type), 0)
def AddType(builder, type):
    return ExtraAddType(builder, type)
def ExtraAddEngine(builder, engine): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(engine), 0)
def AddEngine(builder, engine):
    return ExtraAddEngine(builder, engine)
def ExtraAddInfo(builder, info): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(info), 0)
def AddInfo(builder, info):
    return ExtraAddInfo(builder, info)
def ExtraStartInfoVector(builder, numElems): return builder.StartVector(1, numElems, 1)
def StartInfoVector(builder, numElems):
    return ExtraStartInfoVector(builder, numElems)
def ExtraAddAttr(builder, attr): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(attr), 0)
def AddAttr(builder, attr):
    return ExtraAddAttr(builder, attr)
def ExtraStartAttrVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartAttrVector(builder, numElems):
    return ExtraStartAttrVector(builder, numElems)
def ExtraEnd(builder): return builder.EndObject()
def End(builder):
    return ExtraEnd(builder)