
    3j                     R    S SK JrJr  S SKrS SKJr   " S S\R
                  5      rg)    )AnyCallableN)nnc                      ^  \ rS rSrSrS\S\R                  4   SS4U 4S jjrS\R                  S	\	S
\	S\R                  4S jr
SrU =r$ )Lambda   a8  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                    > [         TU ]  5         [        U5      (       d"  [        S[	        U5      R
                  < 35      eXl        g )Nz'Argument lambd should be callable, got )super__init__callable	TypeErrortype__name__r	   )selfr	   	__class__s     V/home/wildlama/miniconda3/lib/python3.13/site-packages/kornia/contrib/lambda_module.pyr   Lambda.__init__*   s:    ~~Ed4jFYFYE\]^^	    imgargskwargsc                 .    U R                   " U/UQ70 UD6$ )a  Run the user-provided transform function.

This method simply forwards all arguments to ``self.func``.
It is useful when you want to insert a custom Python callable inside a
``torch.nn.Module`` pipeline.

Args:
    img: Primary input tensor passed as the first positional argument.
        For image tasks this is commonly shaped ``(B, C, H, W)``, where
        ``B`` = batch size, ``C`` = number of channels,
        ``H`` = height, and ``W`` = width.
    *args: Additional positional arguments forwarded to ``self.func``.
    **kwargs: Additional keyword arguments forwarded to ``self.func``.

Returns:
    The output tensor returned by ``self.func``.
r	   )r   r   r   r   s       r   forwardLambda.forward1   s    $ yy.t.v..r   r   )r   
__module____qualname____firstlineno____doc__r   torchTensorr   r   r   __static_attributes____classcell__)r   s   @r   r   r      sW    "Xc5<<&78 T /5<< / /s /u|| / /r   r   )typingr   r   r"   r   Moduler    r   r   <module>r)      s    $ !  +/RYY +/r   