def tile(input, kernel):
    """
    Reshape an image tensor for 2D pooling
    Args:
       input (:class:`Tensor`): batch x channel x height x width
       kernel ((int, int)): height x width of pooling
    Returns:
       (:class:`Tensor`, int, int) : Tensor of size batch x channel x new_height x new_width x kernel_height x kernel_width as well as the new_height and new_width value.
    """

    batch, channel, height, width = input.shape
    kh, kw = kernel
    assert height % kh == 0
    assert width % kw == 0
    new_width = width // kw
    new_height = height // kh

    x = input.view(batch, channel, new_height, kh, new_width, kw)
    x = x.permute(0, 1, 2, 4, 3, 5).contiguous()
    x = x.view(batch, channel, new_height, new_width, kh * kw)
    return x, new_height, new_width