+
    åûj@  ã                   óZ   € ^ RI t ^ RIHt ]],          ] P                  ,          tR R ltR# )é    N)Úmse_lossc                ó„   € V ^8„  d   QhR\         P                  R\         P                  R\        R\         P                  /# )é   ÚimageÚtargetÚmax_valÚreturn)ÚtorchÚTensorÚ_PSNRMaxVal)Úformats   "ÚOC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\metrics\psnr.pyÚ__annotate__r      s:   € ÷ Y'ñ Y'”—‘ð Y'¤e§l¡lð Y'¼[ð Y'ÌUÏ\É\ñ Y'ó    c                óz  € \        V \        P                  4      '       g   \        R\	        V 4       R24      h\        V\        P                  4      '       g   \        R\	        V4       R24      hV P
                  VP
                  8w  d&   \        RV P
                   RVP
                   24      hV P                  4       '       g6   V P                  4       '       g    V P                  \        P                  4      p VP                  4       '       g6   VP                  4       '       g    VP                  \        P                  4      p\        P                  ! V P                  VP                  4      pV\        P                  \        P                  39   d   \        P                  MTpV P                  V4      VP                  V4      rTpV\        P                  \        P                  39   dp   \        V\        P                  4      '       dP   \        P                  ! W2P                  4      pVP                  \        P                  ! WBP                  4      4      p\        WRR7      p\        V\        P                  4      '       dŒ   VP                  \        P                  \        P                   \        P"                  \        P$                  39   d    VP                  \        P&                  4      p\        P(                  ! V^4      V,          pM7\        V\*        4      '       d   V^,          V,          pMV^,          V,          pR\        P,                  ! V4      ,          pV\        P                  \        P                  39   d   VP                  V4      pVP/                  VP
                  4      # )aã	  Compute the peak signal-to-noise ratio (PSNR), in dB, between two images.

``score = psnr(image, target, max_val)`` takes two images of the same shape ``(*)`` and their data range
:math:`\text{MAX}_I`, and returns the PSNR for the mean squared error over all :math:`N` elements:

.. math::

    \text{PSNR} = 10 \log_{10} \bigg(\frac{\text{MAX}_I^2}{\text{MSE}}\bigg), \quad
    \text{MSE} = \frac{1}{N}\sum_{k=1}^{N} (I_k - T_k)^2

Convention:
    - One MSE is pooled over every element, batch and channels included, so for a batch the score is the PSNR of
      the pooled MSE, not the mean of per-image PSNRs: compute per-image values one image at a time.
      :ref:`Losses and metrics <losses-metrics-conventions>` maps both onto scikit-image and torchmetrics.
    - ``max_val`` is the data range of the images (``1.0`` for ``[0, 1]``, ``255.0`` for ``[0, 255]``), not the
      maximum of the tensor; pixel values are not rescaled.
    - The shapes must match, without broadcasting, and the value is symmetric in the images. Identical inputs
      give an MSE of 0 and ``inf``, while a batch with one identical pair stays finite.
    - Integer and bool images are converted to float32 before computing the MSE, so an integer image paired with
      a half-precision image gives a float32 result. Uint8, int8, int16 and int32 tensor data ranges are widened
      to int64 before squaring to avoid overflow, except when the promoted image dtype is float16 or bfloat16,
      which uses float32 range arithmetic.
    - Float16 and bfloat16 inputs are evaluated in float32 and the result keeps their promoted dtype, also
      promoted with ``max_val.dtype`` for a tensor range: a float32 tensor range gives a float32 result for
      half-precision images.

Args:
    image: the image with shape ``(*)``.
    target: the reference image with the shape of ``image``.
    max_val: the data range :math:`\text{MAX}_I` of the images, as a float, integer or tensor.

Returns:
    the PSNR in dB, a 0-d tensor for a scalar range or with the shape of a tensor range.

See Also:
    - :func:`~kornia.losses.psnr_loss`: the negative PSNR, to minimise.
    - :class:`~kornia.losses.PSNRLoss`: the module form of that loss.
    - :func:`~kornia.metrics.ssim`: a structural measure of the same pair, per pixel and bounded.

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

Reference:
    https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio#Definition

zExpected torch.Tensor but got Ú.z*Expected tensors of equal shapes, but got z and Úmean)Ú	reductiong      $@)Ú
isinstancer
   r   Ú	TypeErrorÚtypeÚshapeÚis_floating_pointÚ
is_complexÚtoÚfloat32Úpromote_typesÚdtypeÚfloat16Úbfloat16ÚmseÚuint8Úint8Úint16Úint32Úint64ÚpowÚintÚlog10Úreshape)	r   r   r   r   Úcompute_dtypeÚresult_dtypeÚ	mse_valueÚratioÚresults	   &&&      r   Úpsnrr0      sz  € ôb �eœUŸ\™\×*Ò*ÜÐ8¼¸e»¸ÀQÐGÓHÐHä�fœeŸl™l×+Ò+ÜÐ8¼¸f»¸ÀaÐHÓIÐIà‡{�{�f—l‘lÔ"ÜÐDÀUÇ[Á[ÀMÐQVÐW]×WcÑWcÐVdÐeÓfÐfð ×"Ñ"×$Ò$¨U×-=Ñ-=×-?Ò-?Ø—‘œŸ™Ó'ˆØ×#Ñ#×%Ò%¨f×.?Ñ.?×.AÒ.AØ—‘œ5Ÿ=™=Ó)ˆä×Ò §¡¨V¯\©\Ó:€EØ%*¬u¯}©}¼e¿n¹nÐ.MÔ%M”E—M’MÐSX€MØ—H‘H˜]Ó+¨V¯Y©Y°}Ó-Eˆ6Ø€LØ”—‘¤§¡Ð/Ô/´J¸wÌÏÉ×4UÒ4UÜ×*Ò*¨5·-±-Ó@ˆà—*‘*œU×0Ò0°ÇÁÓNÓOˆô
 �E¨VÔ4€Iä�'œ5Ÿ<™<×(Ò(Ø�=‰=œUŸ[™[¬%¯*©*´e·k±kÄ5Ç;Á;ÐOÔOØ—j‘j¤§¡Ó-ˆGÜ—	’	˜' 1Ó%¨	Õ1‰Ü	�GœS×	!Ò	!Ø˜•
˜YÕ&‰à˜•
˜YÕ&ˆØ”E—K’K Ó&Õ&€FØ”—‘¤§¡Ð/Ô/Ø—‘˜<Ó(ˆØ�>‰>˜%Ÿ+™+Ó&Ð&r   )	r
   Útorch.nn.functionalr   r!   Úfloatr(   r   r   r0   © r   r   Ú<module>r4      s'   ðó$ Ý /ð �c�k˜EŸL™LÕ(€÷Y'r   