def METHOD_NAME(np_data, out_size, pool_op, np_op):
    """The reference function for adaptive pool, channel last layout"""
    ishape = np_data.shape
    n, c = ishape[0], ishape[-1]
    oshape = (n,) + out_size + (c,)
    np_out = np.zeros(oshape).astype(np_data.dtype)
    for i in range(n):
        for j in range(c):
            if len(out_size) == 1:
                np_out[i, :, j] = pool_op(ishape[1:-1], out_size, np_data[i, :, j], np_op)
            elif len(out_size) == 2:
                np_out[i, :, :, j] = pool_op(ishape[1:-1], out_size, np_data[i, :, :, j], np_op)
            else:
                np_out[i, :, :, :, j] = pool_op(
                    ishape[1:-1], out_size, np_data[i, :, :, :, j], np_op
                )
    return np_out