a
    dq                     @   s*   d dl Z ee je jdddZdd ZdS )    N)ninputreturnc                 C   sZ   | dkrt t| | t|jdk r.t |jtj| |j|jd}|d |jd ddS )a  Return a 2-D tensor with ones on the diagonal and zeros elsewhere with the same batch size as the input.

    Args:
        n: the number of rows :math:`(N)`.
        input: image tensor that will determine the batch size of the output matrix.
          The expected shape is :math:`(B, *)`.

    Returns:
       The identity matrix with the same batch size as the input :math:`(B, N, N)`.
    r      devicedtypeN)	AssertionErrortypelenshapetorchZeyer   r   repeat)r   r   identity r   Z/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/kornia/utils/misc.pyeye_like   s    
r   c                 C   s\   | dkrt t| | t|jdk r.t |jtj| d|j|jd}|d |jd ddS )at  Return a 2-D tensor with a vector containing zeros with the same batch size as the input.

    Args:
        n: the number of rows :math:`(N)`.
        tensor: image tensor that will determine the batch size of the output matrix.
          The expected shape is :math:`(B, *)`.

    Returns:
        The vector with the same batch size as the input :math:`(B, N, 1)`.
    r   r   r   N)	r	   r
   r   r   r   zerosr   r   r   )r   ZtensorZvecr   r   r   vec_like   s    
r   )r   intZTensorr   r   r   r   r   r   <module>   s   