def flip(tensor, horizontal=False, vertical=False):
    """Flip the image.

    Args:
        tensor (torch.Tensor): The image tensor to be flipped.
        horizontal: Flip horizontally.
        vertical: Flip vertically.

    Returns:
        Tensor: The flipped image tensor.
    """
    if horizontal == True:
        tensor = tensor.flip(-1)
    if vertical == True:
        tensor = tensor.flip(-2)
    return tensor