# automatically generated by the FlatBuffers compiler, do not modify

# namespace: MNN

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

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

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

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

    # Scale
    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

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

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

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

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

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

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

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

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

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

    # Scale
    def Relu(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
        return False

    # Scale
    def Relu6(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
        return False

def ScaleStart(builder): builder.StartObject(6)
def Start(builder):
    return ScaleStart(builder)
def ScaleAddChannels(builder, channels): builder.PrependInt32Slot(0, channels, 0)
def AddChannels(builder, channels):
    return ScaleAddChannels(builder, channels)
def ScaleAddScaleData(builder, scaleData): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(scaleData), 0)
def AddScaleData(builder, scaleData):
    return ScaleAddScaleData(builder, scaleData)
def ScaleStartScaleDataVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartScaleDataVector(builder, numElems):
    return ScaleStartScaleDataVector(builder, numElems)
def ScaleAddBiasData(builder, biasData): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(biasData), 0)
def AddBiasData(builder, biasData):
    return ScaleAddBiasData(builder, biasData)
def ScaleStartBiasDataVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartBiasDataVector(builder, numElems):
    return ScaleStartBiasDataVector(builder, numElems)
def ScaleAddScale(builder, scale): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(scale), 0)
def AddScale(builder, scale):
    return ScaleAddScale(builder, scale)
def ScaleAddRelu(builder, relu): builder.PrependBoolSlot(4, relu, 0)
def AddRelu(builder, relu):
    return ScaleAddRelu(builder, relu)
def ScaleAddRelu6(builder, relu6): builder.PrependBoolSlot(5, relu6, 0)
def AddRelu6(builder, relu6):
    return ScaleAddRelu6(builder, relu6)
def ScaleEnd(builder): return builder.EndObject()
def End(builder):
    return ScaleEnd(builder)