# automatically generated by the FlatBuffers compiler, do not modify

# namespace: MNN

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

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

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

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

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

    # BatchNorm
    def SlopeData(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

    # BatchNorm
    def SlopeDataAsNumpy(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

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

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

    # BatchNorm
    def MeanData(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

    # BatchNorm
    def MeanDataAsNumpy(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

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

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

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

    # BatchNorm
    def VarDataAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
        return 0

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

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

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

    # BatchNorm
    def BiasDataAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
        return 0

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

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

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

    # BatchNorm
    def AdataAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
        return 0

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

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

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

    # BatchNorm
    def BdataAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
        return 0

    # BatchNorm
    def BdataLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # BatchNorm
    def BdataIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        return o == 0

    # BatchNorm
    def Epsilon(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.001

def BatchNormStart(builder): builder.StartObject(8)
def Start(builder):
    return BatchNormStart(builder)
def BatchNormAddChannels(builder, channels): builder.PrependInt32Slot(0, channels, 0)
def AddChannels(builder, channels):
    return BatchNormAddChannels(builder, channels)
def BatchNormAddSlopeData(builder, slopeData): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(slopeData), 0)
def AddSlopeData(builder, slopeData):
    return BatchNormAddSlopeData(builder, slopeData)
def BatchNormStartSlopeDataVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartSlopeDataVector(builder, numElems):
    return BatchNormStartSlopeDataVector(builder, numElems)
def BatchNormAddMeanData(builder, meanData): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(meanData), 0)
def AddMeanData(builder, meanData):
    return BatchNormAddMeanData(builder, meanData)
def BatchNormStartMeanDataVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartMeanDataVector(builder, numElems):
    return BatchNormStartMeanDataVector(builder, numElems)
def BatchNormAddVarData(builder, varData): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(varData), 0)
def AddVarData(builder, varData):
    return BatchNormAddVarData(builder, varData)
def BatchNormStartVarDataVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartVarDataVector(builder, numElems):
    return BatchNormStartVarDataVector(builder, numElems)
def BatchNormAddBiasData(builder, biasData): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(biasData), 0)
def AddBiasData(builder, biasData):
    return BatchNormAddBiasData(builder, biasData)
def BatchNormStartBiasDataVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartBiasDataVector(builder, numElems):
    return BatchNormStartBiasDataVector(builder, numElems)
def BatchNormAddAdata(builder, adata): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(adata), 0)
def AddAdata(builder, adata):
    return BatchNormAddAdata(builder, adata)
def BatchNormStartAdataVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartAdataVector(builder, numElems):
    return BatchNormStartAdataVector(builder, numElems)
def BatchNormAddBdata(builder, bdata): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(bdata), 0)
def AddBdata(builder, bdata):
    return BatchNormAddBdata(builder, bdata)
def BatchNormStartBdataVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartBdataVector(builder, numElems):
    return BatchNormStartBdataVector(builder, numElems)
def BatchNormAddEpsilon(builder, epsilon): builder.PrependFloat32Slot(7, epsilon, 0.001)
def AddEpsilon(builder, epsilon):
    return BatchNormAddEpsilon(builder, epsilon)
def BatchNormEnd(builder): return builder.EndObject()
def End(builder):
    return BatchNormEnd(builder)