# automatically generated by the FlatBuffers compiler, do not modify

# namespace: MNN

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

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

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

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

    # PRelu
    def SlopeCount(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

    # PRelu
    def Slope(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

    # PRelu
    def SlopeAsNumpy(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

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

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

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

def PReluStart(builder): builder.StartObject(3)
def Start(builder):
    return PReluStart(builder)
def PReluAddSlopeCount(builder, slopeCount): builder.PrependInt32Slot(0, slopeCount, 0)
def AddSlopeCount(builder, slopeCount):
    return PReluAddSlopeCount(builder, slopeCount)
def PReluAddSlope(builder, slope): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(slope), 0)
def AddSlope(builder, slope):
    return PReluAddSlope(builder, slope)
def PReluStartSlopeVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartSlopeVector(builder, numElems):
    return PReluStartSlopeVector(builder, numElems)
def PReluAddPreluSuperacme(builder, preluSuperacme): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(preluSuperacme), 0)
def AddPreluSuperacme(builder, preluSuperacme):
    return PReluAddPreluSuperacme(builder, preluSuperacme)
def PReluEnd(builder): return builder.EndObject()
def End(builder):
    return PReluEnd(builder)