# automatically generated by the FlatBuffers compiler, do not modify

# namespace: MNN

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

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

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

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

    # RoiPooling
    def PooledWidth(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

    # RoiPooling
    def PooledHeight(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

    # RoiPooling
    def SpatialScale(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

def RoiPoolingStart(builder): builder.StartObject(3)
def Start(builder):
    return RoiPoolingStart(builder)
def RoiPoolingAddPooledWidth(builder, pooledWidth): builder.PrependInt32Slot(0, pooledWidth, 0)
def AddPooledWidth(builder, pooledWidth):
    return RoiPoolingAddPooledWidth(builder, pooledWidth)
def RoiPoolingAddPooledHeight(builder, pooledHeight): builder.PrependInt32Slot(1, pooledHeight, 0)
def AddPooledHeight(builder, pooledHeight):
    return RoiPoolingAddPooledHeight(builder, pooledHeight)
def RoiPoolingAddSpatialScale(builder, spatialScale): builder.PrependFloat32Slot(2, spatialScale, 0.0)
def AddSpatialScale(builder, spatialScale):
    return RoiPoolingAddSpatialScale(builder, spatialScale)
def RoiPoolingEnd(builder): return builder.EndObject()
def End(builder):
    return RoiPoolingEnd(builder)