a
    dH                     @   s   d dl Z d dlmZ g dZG dd dejZG dd dejZG dd dejZe je jd	d
dZ	e je jd	ddZ
e je jd	ddZdS )    N)VflipHflipRot180rot180hflipvflipc                   @   s,   e Zd ZdZejejdddZdd ZdS )r   a1  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   s   t |S N)r   selfr	    r   h/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/kornia/geometry/transform/flips.pyforward   s    zVflip.forwardc                 C   s   | j jS r   	__class____name__r   r   r   r   __repr__"   s    zVflip.__repr__Nr   
__module____qualname____doc__torchTensorr   r   r   r   r   r   r      s   r   c                   @   s,   e Zd ZdZejejdddZdd ZdS )r   a5  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   c                 C   s   t |S r   )r   r   r   r   r   r   >   s    zHflip.forwardc                 C   s   | j jS r   r   r   r   r   r   r   A   s    zHflip.__repr__Nr   r   r   r   r   r   &   s   r   c                   @   s,   e Zd ZdZejejdddZdd ZdS )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   c                 C   s   t |S r   )r   r   r   r   r   r   Z   s    zRot180.forwardc                 C   s   | j jS r   r   r   r   r   r   r   ]   s    zRot180.__repr__Nr   r   r   r   r   r   E   s   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.
    )r   Zflip)r	   r   r   r   r   a   s    r   c                 C   s*   | j d }| dtj|d dd| jdf 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   .   deviceshaper   Zaranger    )r	   wr   r   r   r   r   s    
r   c                 C   s0   | j d }| dtj|d dd| jdddf S )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   Nr!   )r	   hr   r   r   r      s    
r   )r   Ztorch.nnnn__all__Moduler   r   r   r   r   r   r   r   r   r   r   <module>   s   