o
    €o™i  ã                   @   s’   d dl Z d dlmZ d dlmZ g d¢ZG dd„ deƒZG dd„ deƒZG d	d
„ d
eƒZdedefdd„Z	dedefdd„Z
dedefdd„ZdS )é    N)ÚImageModule)ÚTensor)ÚHflipÚRot180ÚVflipÚhflipÚrot180Úvflipc                   @   ó0   e Zd ZdZdedefdd„Zdefdd„ZdS )	r   a2  Vertically flip a tensor image or a batch of tensor images.

    Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`.

    Args:
        input: input tensor.

    Returns:
        The vertically flipped image tensor.

    Examples:
        >>> vflip = Vflip()
        >>> input = torch.tensor([[[
        ...    [0., 0., 0.],
        ...    [0., 0., 0.],
        ...    [0., 1., 1.]
        ... ]]])
        >>> vflip(input)
        tensor([[[[0., 1., 1.],
                  [0., 0., 0.],
                  [0., 0., 0.]]]])

    ÚinputÚreturnc                 C   ó   t |ƒS ©N)r	   ©Úselfr   © r   úS/home/ubuntu/.local/lib/python3.10/site-packages/kornia/geometry/transform/flips.pyÚforward3   ó   zVflip.forwardc                 C   ó   | j jS r   ©Ú	__class__Ú__name__©r   r   r   r   Ú__repr__6   r   zVflip.__repr__N©r   Ú
__module__Ú__qualname__Ú__doc__r   r   Ústrr   r   r   r   r   r      ó    r   c                   @   r
   )	r   a6  Horizontally flip a tensor image or a batch of tensor images.

    Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`.

    Args:
        input: input tensor.

    Returns:
        The horizontally flipped image tensor.

    Examples:
        >>> hflip = Hflip()
        >>> input = torch.tensor([[[
        ...    [0., 0., 0.],
        ...    [0., 0., 0.],
        ...    [0., 1., 1.]
        ... ]]])
        >>> hflip(input)
        tensor([[[[0., 0., 0.],
                  [0., 0., 0.],
                  [1., 1., 0.]]]])

    r   r   c                 C   r   r   )r   r   r   r   r   r   S   r   zHflip.forwardc                 C   r   r   r   r   r   r   r   r   V   r   zHflip.__repr__Nr   r   r   r   r   r   :   r    r   c                   @   r
   )	r   aý  Rotate a tensor image or a batch of tensor images 180 degrees.

    Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`.

    Args:
        input: input tensor.

    Examples:
        >>> rot180 = Rot180()
        >>> input = torch.tensor([[[
        ...    [0., 0., 0.],
        ...    [0., 0., 0.],
        ...    [0., 1., 1.]
        ... ]]])
        >>> rot180(input)
        tensor([[[[1., 1., 0.],
                  [0., 0., 0.],
                  [0., 0., 0.]]]])

    r   r   c                 C   r   r   )r   r   r   r   r   r   p   r   zRot180.forwardc                 C   r   r   r   r   r   r   r   r   s   r   zRot180.__repr__Nr   r   r   r   r   r   Z   s    r   r   r   c                 C   s   t  | ddg¡S )a  Rotate a tensor image or a batch of tensor images 180 degrees.

    .. image:: _static/img/rot180.png

    Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`.

    Args:
        input: input tensor.

    Returns:
        The rotated image tensor.

    éþÿÿÿéÿÿÿÿ)ÚtorchÚflip©r   r   r   r   r   w   s   r   c                 C   ó   |   d¡ ¡ S )a)  Horizontally flip a tensor image or a batch of tensor images.

    .. image:: _static/img/hflip.png

    Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`.

    Args:
        input: input tensor.

    Returns:
        The horizontally flipped image tensor.

    r"   ©r$   Ú
contiguousr%   r   r   r   r   ˆ   ó   r   c                 C   r&   )a%  Vertically flip a tensor image or a batch of tensor images.

    .. image:: _static/img/vflip.png

    Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`.

    Args:
        input: input tensor.

    Returns:
        The vertically flipped image tensor.

    r!   r'   r%   r   r   r   r	   ™   r)   r	   )r#   Úkornia.corer   ÚModuler   Ú__all__r   r   r   r   r   r	   r   r   r   r   Ú<module>   s     