# automatically generated by the FlatBuffers compiler, do not modify

# namespace: MNN

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

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

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

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

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

    # Eltwise
    def Coeff(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

    # Eltwise
    def CoeffAsNumpy(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

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

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

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

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

    # Eltwise
    def OutputQuan(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

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

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

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

def EltwiseStart(builder): builder.StartObject(8)
def Start(builder):
    return EltwiseStart(builder)
def EltwiseAddType(builder, type): builder.PrependInt8Slot(0, type, 0)
def AddType(builder, type):
    return EltwiseAddType(builder, type)
def EltwiseAddCoeff(builder, coeff): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(coeff), 0)
def AddCoeff(builder, coeff):
    return EltwiseAddCoeff(builder, coeff)
def EltwiseStartCoeffVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartCoeffVector(builder, numElems):
    return EltwiseStartCoeffVector(builder, numElems)
def EltwiseAddInputQuan0(builder, inputQuan0): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(inputQuan0), 0)
def AddInputQuan0(builder, inputQuan0):
    return EltwiseAddInputQuan0(builder, inputQuan0)
def EltwiseAddInputQuan1(builder, inputQuan1): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(inputQuan1), 0)
def AddInputQuan1(builder, inputQuan1):
    return EltwiseAddInputQuan1(builder, inputQuan1)
def EltwiseAddOutputQuan(builder, outputQuan): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(outputQuan), 0)
def AddOutputQuan(builder, outputQuan):
    return EltwiseAddOutputQuan(builder, outputQuan)
def EltwiseAddEltwise(builder, eltwise): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(eltwise), 0)
def AddEltwise(builder, eltwise):
    return EltwiseAddEltwise(builder, eltwise)
def EltwiseAddRelu(builder, relu): builder.PrependBoolSlot(6, relu, 0)
def AddRelu(builder, relu):
    return EltwiseAddRelu(builder, relu)
def EltwiseAddRelu6(builder, relu6): builder.PrependBoolSlot(7, relu6, 0)
def AddRelu6(builder, relu6):
    return EltwiseAddRelu6(builder, relu6)
def EltwiseEnd(builder): return builder.EndObject()
def End(builder):
    return EltwiseEnd(builder)