# automatically generated by the FlatBuffers compiler, do not modify

# namespace: MNN

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

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

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

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

    # RNNParam
    def NumUnits(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

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

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

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

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

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

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

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

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

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

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

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

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

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

def RNNParamStart(builder): builder.StartObject(14)
def Start(builder):
    return RNNParamStart(builder)
def RNNParamAddNumUnits(builder, numUnits): builder.PrependInt32Slot(0, numUnits, 0)
def AddNumUnits(builder, numUnits):
    return RNNParamAddNumUnits(builder, numUnits)
def RNNParamAddIsBidirectionalRnn(builder, isBidirectionalRnn): builder.PrependBoolSlot(1, isBidirectionalRnn, 0)
def AddIsBidirectionalRnn(builder, isBidirectionalRnn):
    return RNNParamAddIsBidirectionalRnn(builder, isBidirectionalRnn)
def RNNParamAddLinearBeforeReset(builder, linearBeforeReset): builder.PrependBoolSlot(2, linearBeforeReset, 0)
def AddLinearBeforeReset(builder, linearBeforeReset):
    return RNNParamAddLinearBeforeReset(builder, linearBeforeReset)
def RNNParamAddKeepAllOutputs(builder, keepAllOutputs): builder.PrependBoolSlot(3, keepAllOutputs, 0)
def AddKeepAllOutputs(builder, keepAllOutputs):
    return RNNParamAddKeepAllOutputs(builder, keepAllOutputs)
def RNNParamAddFwGateWeight(builder, fwGateWeight): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(fwGateWeight), 0)
def AddFwGateWeight(builder, fwGateWeight):
    return RNNParamAddFwGateWeight(builder, fwGateWeight)
def RNNParamAddFwGateBias(builder, fwGateBias): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(fwGateBias), 0)
def AddFwGateBias(builder, fwGateBias):
    return RNNParamAddFwGateBias(builder, fwGateBias)
def RNNParamAddFwCandidateWeight(builder, fwCandidateWeight): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(fwCandidateWeight), 0)
def AddFwCandidateWeight(builder, fwCandidateWeight):
    return RNNParamAddFwCandidateWeight(builder, fwCandidateWeight)
def RNNParamAddFwCandidateBias(builder, fwCandidateBias): builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(fwCandidateBias), 0)
def AddFwCandidateBias(builder, fwCandidateBias):
    return RNNParamAddFwCandidateBias(builder, fwCandidateBias)
def RNNParamAddFwRecurrentBias(builder, fwRecurrentBias): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(fwRecurrentBias), 0)
def AddFwRecurrentBias(builder, fwRecurrentBias):
    return RNNParamAddFwRecurrentBias(builder, fwRecurrentBias)
def RNNParamAddBwGateWeight(builder, bwGateWeight): builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(bwGateWeight), 0)
def AddBwGateWeight(builder, bwGateWeight):
    return RNNParamAddBwGateWeight(builder, bwGateWeight)
def RNNParamAddBwGateBias(builder, bwGateBias): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(bwGateBias), 0)
def AddBwGateBias(builder, bwGateBias):
    return RNNParamAddBwGateBias(builder, bwGateBias)
def RNNParamAddBwCandidateWeight(builder, bwCandidateWeight): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(bwCandidateWeight), 0)
def AddBwCandidateWeight(builder, bwCandidateWeight):
    return RNNParamAddBwCandidateWeight(builder, bwCandidateWeight)
def RNNParamAddBwCandidateBias(builder, bwCandidateBias): builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(bwCandidateBias), 0)
def AddBwCandidateBias(builder, bwCandidateBias):
    return RNNParamAddBwCandidateBias(builder, bwCandidateBias)
def RNNParamAddBwRecurrentBias(builder, bwRecurrentBias): builder.PrependUOffsetTRelativeSlot(13, flatbuffers.number_types.UOffsetTFlags.py_type(bwRecurrentBias), 0)
def AddBwRecurrentBias(builder, bwRecurrentBias):
    return RNNParamAddBwRecurrentBias(builder, bwRecurrentBias)
def RNNParamEnd(builder): return builder.EndObject()
def End(builder):
    return RNNParamEnd(builder)