# automatically generated by the FlatBuffers compiler, do not modify

# namespace: MNN

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

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

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

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

    # Convolution2D
    def Common(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = Convolution2DCommon()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

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

    # Convolution2D
    def WeightAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
        return 0

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

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

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

    # Convolution2D
    def BiasAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
        return 0

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

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

    # Convolution2D
    def QuanParameter(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = IDSTQuan()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Convolution2D
    def SymmetricQuan(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = QuantizedFloatParam()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Convolution2D
    def SparseParameter(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = SparseCommon()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Convolution2D
    def Convolution2dSuperacme(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = Conv2dSuperAcmeQuantizedParam()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Convolution2D
    def Weightname(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

def Convolution2DStart(builder): builder.StartObject(8)
def Start(builder):
    return Convolution2DStart(builder)
def Convolution2DAddCommon(builder, common): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(common), 0)
def AddCommon(builder, common):
    return Convolution2DAddCommon(builder, common)
def Convolution2DAddWeight(builder, weight): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(weight), 0)
def AddWeight(builder, weight):
    return Convolution2DAddWeight(builder, weight)
def Convolution2DStartWeightVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartWeightVector(builder, numElems):
    return Convolution2DStartWeightVector(builder, numElems)
def Convolution2DAddBias(builder, bias): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(bias), 0)
def AddBias(builder, bias):
    return Convolution2DAddBias(builder, bias)
def Convolution2DStartBiasVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartBiasVector(builder, numElems):
    return Convolution2DStartBiasVector(builder, numElems)
def Convolution2DAddQuanParameter(builder, quanParameter): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(quanParameter), 0)
def AddQuanParameter(builder, quanParameter):
    return Convolution2DAddQuanParameter(builder, quanParameter)
def Convolution2DAddSymmetricQuan(builder, symmetricQuan): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(symmetricQuan), 0)
def AddSymmetricQuan(builder, symmetricQuan):
    return Convolution2DAddSymmetricQuan(builder, symmetricQuan)
def Convolution2DAddSparseParameter(builder, sparseParameter): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(sparseParameter), 0)
def AddSparseParameter(builder, sparseParameter):
    return Convolution2DAddSparseParameter(builder, sparseParameter)
def Convolution2DAddConvolution2dSuperacme(builder, convolution2dSuperacme): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(convolution2dSuperacme), 0)
def AddConvolution2dSuperacme(builder, convolution2dSuperacme):
    return Convolution2DAddConvolution2dSuperacme(builder, convolution2dSuperacme)
def Convolution2DAddWeightname(builder, weightname): builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(weightname), 0)
def AddWeightname(builder, weightname):
    return Convolution2DAddWeightname(builder, weightname)
def Convolution2DEnd(builder): return builder.EndObject()
def End(builder):
    return Convolution2DEnd(builder)