
    3jV	                    d    S SK Jr  S SKrS SKJr  S SKJr  SS jr " S S\R                  5      rg)	    )annotationsN)nn)metricsc                6    S[         R                  " XU5      -  $ )a  Compute the PSNR loss.

The loss is computed as follows:

 .. math::

    \text{loss} = -\text{psnr(x, y)}

See :meth:`~kornia.losses.psnr` for details abut PSNR.

Args:
    image: the input image with shape :math:`(*)`.
    target : the labels image with shape :math:`(*)`.
    max_val: The maximum value in the image tensor.

Return:
    the computed loss as a scalar.

Examples:
    >>> ones = torch.ones(1)
    >>> psnr_loss(ones, 1.2 * ones, 2.) # 10 * log(4/((1.2-1)**2)) / log(10)
    tensor(-20.0000)

g      )r   psnr)imagetargetmax_vals      L/home/wildlama/miniconda3/lib/python3.13/site-packages/kornia/losses/psnr.py	psnr_lossr      s    2 ',,ug666    c                  :   ^  \ rS rSrSrSU 4S jjrSS jrSrU =r$ )PSNRLoss6   aD  Create a criterion that calculates the PSNR loss.

The loss is computed as follows:

 .. math::

    \text{loss} = -\text{psnr(x, y)}

See :meth:`~kornia.losses.psnr` for details abut PSNR.

Args:
    max_val: The maximum value in the image tensor.

Shape:
    - Image: arbitrary dimensional tensor :math:`(*)`.
    - Target: arbitrary dimensional tensor :math:`(*)` same shape as image.
    - Output: a scalar.

Examples:
    >>> ones = torch.ones(1)
    >>> criterion = PSNRLoss(2.)
    >>> criterion(ones, 1.2 * ones) # 10 * log(4/((1.2-1)**2)) / log(10)
    tensor(-20.0000)

c                .   > [         TU ]  5         Xl        g N)super__init__r
   )selfr
   	__class__s     r   r   PSNRLoss.__init__Q   s    %r   c                .    [        XU R                  5      $ r   )r   r
   )r   r   r	   s      r   forwardPSNRLoss.forwardU   s    55r   )r
   )r
   floatreturnNone)r   torch.Tensorr	   r   r   r   )	__name__
__module____qualname____firstlineno____doc__r   r   __static_attributes____classcell__)r   s   @r   r   r   6   s    4&6 6r   r   )r   r   r	   r   r
   r   r   r   )	
__future__r   torchr   korniar   r   Moduler    r   r   <module>r+      s(   $ #   78 6ryy  6r   