# automatically generated by the FlatBuffers compiler, do not modify

# namespace: MNN

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

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

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

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

    # Net
    def BizCode(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

    # Net
    def ExtraTensorDescribe(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            obj = TensorDescribe()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

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

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

    # Net
    def Gpulibrary(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = GpuLibrary()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Net
    def Oplists(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 = Op()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

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

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

    # Net
    def OutputName(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return ""

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

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

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

    # Net
    def SourceType(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

    # Net
    def TensorName(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return ""

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

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

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

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

    # Net
    def Subgraphs(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            obj = SubGraphProto()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Net
    def SubgraphsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Net
    def SubgraphsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        return o == 0

    # Net
    def MnnUuid(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

def NetStart(builder): builder.StartObject(12)
def Start(builder):
    return NetStart(builder)
def NetAddBizCode(builder, bizCode): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(bizCode), 0)
def AddBizCode(builder, bizCode):
    return NetAddBizCode(builder, bizCode)
def NetAddExtraTensorDescribe(builder, extraTensorDescribe): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(extraTensorDescribe), 0)
def AddExtraTensorDescribe(builder, extraTensorDescribe):
    return NetAddExtraTensorDescribe(builder, extraTensorDescribe)
def NetStartExtraTensorDescribeVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartExtraTensorDescribeVector(builder, numElems):
    return NetStartExtraTensorDescribeVector(builder, numElems)
def NetAddGpulibrary(builder, gpulibrary): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(gpulibrary), 0)
def AddGpulibrary(builder, gpulibrary):
    return NetAddGpulibrary(builder, gpulibrary)
def NetAddOplists(builder, oplists): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(oplists), 0)
def AddOplists(builder, oplists):
    return NetAddOplists(builder, oplists)
def NetStartOplistsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartOplistsVector(builder, numElems):
    return NetStartOplistsVector(builder, numElems)
def NetAddOutputName(builder, outputName): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(outputName), 0)
def AddOutputName(builder, outputName):
    return NetAddOutputName(builder, outputName)
def NetStartOutputNameVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartOutputNameVector(builder, numElems):
    return NetStartOutputNameVector(builder, numElems)
def NetAddPreferForwardType(builder, preferForwardType): builder.PrependInt8Slot(5, preferForwardType, 0)
def AddPreferForwardType(builder, preferForwardType):
    return NetAddPreferForwardType(builder, preferForwardType)
def NetAddSourceType(builder, sourceType): builder.PrependInt8Slot(6, sourceType, 0)
def AddSourceType(builder, sourceType):
    return NetAddSourceType(builder, sourceType)
def NetAddTensorName(builder, tensorName): builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(tensorName), 0)
def AddTensorName(builder, tensorName):
    return NetAddTensorName(builder, tensorName)
def NetStartTensorNameVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartTensorNameVector(builder, numElems):
    return NetStartTensorNameVector(builder, numElems)
def NetAddTensorNumber(builder, tensorNumber): builder.PrependInt32Slot(8, tensorNumber, 0)
def AddTensorNumber(builder, tensorNumber):
    return NetAddTensorNumber(builder, tensorNumber)
def NetAddUsage(builder, usage): builder.PrependInt8Slot(9, usage, 0)
def AddUsage(builder, usage):
    return NetAddUsage(builder, usage)
def NetAddSubgraphs(builder, subgraphs): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(subgraphs), 0)
def AddSubgraphs(builder, subgraphs):
    return NetAddSubgraphs(builder, subgraphs)
def NetStartSubgraphsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartSubgraphsVector(builder, numElems):
    return NetStartSubgraphsVector(builder, numElems)
def NetAddMnnUuid(builder, mnnUuid): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(mnnUuid), 0)
def AddMnnUuid(builder, mnnUuid):
    return NetAddMnnUuid(builder, mnnUuid)
def NetEnd(builder): return builder.EndObject()
def End(builder):
    return NetEnd(builder)