# automatically generated by the FlatBuffers compiler, do not modify

# namespace: MNN

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

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

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

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

    # Normalize
    def AcrossSpatial(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

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

    # Normalize
    def Eps(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # Normalize
    def Scale(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

    # Normalize
    def ScaleAsNumpy(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

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

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

def NormalizeStart(builder): builder.StartObject(4)
def Start(builder):
    return NormalizeStart(builder)
def NormalizeAddAcrossSpatial(builder, acrossSpatial): builder.PrependInt32Slot(0, acrossSpatial, 0)
def AddAcrossSpatial(builder, acrossSpatial):
    return NormalizeAddAcrossSpatial(builder, acrossSpatial)
def NormalizeAddChannelShared(builder, channelShared): builder.PrependInt32Slot(1, channelShared, 0)
def AddChannelShared(builder, channelShared):
    return NormalizeAddChannelShared(builder, channelShared)
def NormalizeAddEps(builder, eps): builder.PrependFloat32Slot(2, eps, 0.0)
def AddEps(builder, eps):
    return NormalizeAddEps(builder, eps)
def NormalizeAddScale(builder, scale): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(scale), 0)
def AddScale(builder, scale):
    return NormalizeAddScale(builder, scale)
def NormalizeStartScaleVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartScaleVector(builder, numElems):
    return NormalizeStartScaleVector(builder, numElems)
def NormalizeEnd(builder): return builder.EndObject()
def End(builder):
    return NormalizeEnd(builder)