a
    d,                     @   s6   d dl mZ d dlZd dlmZ G dd dejZdS )    )CallableNc                       s<   e Zd ZdZedd fddZejejdddZ  Z	S )	Lambdaac  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])
    N)funcreturnc                    s4   t    t|s*tdtt|j || _d S )Nz'Argument lambd should be callable, got )super__init__callable	TypeErrorreprtype__name__r   )selfr   	__class__ e/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/kornia/contrib/lambda_module.pyr      s    
zLambda.__init__)imgr   c                 O   s   | j |g|R i |S )N)r   )r   r   argskwargsr   r   r   forward   s    zLambda.forward)
r   
__module____qualname____doc__r   r   torchZTensorr   __classcell__r   r   r   r   r      s   r   )typingr   r   Ztorch.nnnnModuler   r   r   r   r   <module>   s   