o
    oi                     @   s4   d dl mZmZ d dlmZmZ G dd deZdS )    )AnyCallable)ModuleTensorc                       sL   e Zd ZdZdedef ddf fddZded	ed
edefddZ  Z	S )Lambdaad  Applies user-defined lambda as a transform.

    Args:
        func: Callable function.

    Returns:
        The output of the user-defined lambda.

    Example:
        >>> import kornia
        >>> x = torch.rand(1, 3, 5, 5)
        >>> f = Lambda(lambda x: kornia.color.rgb_to_grayscale(x))
        >>> f(x).shape
        torch.Size([1, 1, 5, 5])

    func.returnNc                    s0   t    t|stdt|j|| _d S )Nz'Argument lambd should be callable, got )super__init__callable	TypeErrortype__name__r   )selfr   	__class__ P/home/ubuntu/.local/lib/python3.10/site-packages/kornia/contrib/lambda_module.pyr
   )   s   

zLambda.__init__imgargskwargsc                 O   s   | j |g|R i |S )N)r   )r   r   r   r   r   r   r   forward0   s   zLambda.forward)
r   
__module____qualname____doc__r   r   r
   r   r   __classcell__r   r   r   r   r      s    "r   N)typingr   r   kornia.corer   r   r   r   r   r   r   <module>   s   