+
    åûj2I  ã                   óÎ   € R t ^ RIHtHtHt ^ RIt^ RIHt ^ RIHt . ROt	R R lt
 ! R	 R]P                  4      tR
 R lt ! R R]P                  4      tR R ltRR R lltR# )z=nn.Module containing functionals for intensity normalisation.)ÚListÚTupleÚUnionN)Únn)Ú_as_tensor_nonblockingÚDenormalizeÚ	Normalizec                óX   € V ^8„  d   QhR\         P                  R\         P                  /# )é   ÚdataÚreturn©ÚtorchÚTensor)Úformats   "ÚTC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\enhance\normalize.pyÚ__annotate__r      s"   € ÷ 
.ñ 
.¤§¡ð 
.´·±ñ 
.ó    c                ó¦   € V P                  4       '       g   V P                  4       '       d   V # V P                  \        P                  ! 4       4      # )a  Return ``data`` in torch's default floating dtype if it is an integer or bool tensor.

:func:`normalize` and :func:`denormalize` cast ``mean`` and ``std`` to the dtype of ``data``. For an integer
tensor that truncates a fractional statistic to an integer (``0.5`` becomes ``0``) and runs the subtraction and
``addcmul`` in the integer dtype, where the result wraps. Promoting the data first, as ``data * 0.5`` does, keeps
a fractional statistic and computes in floating point. Floating and complex tensors are returned untouched.
)Úis_floating_pointÚ
is_complexÚtor   Úget_default_dtype)r   s   &r   Ú_promote_integer_datar      s<   € ð ×Ñ×Ò 4§?¡?×#4Ò#4ØˆØ�7‰7”5×*Ò*Ó,Ó-Ð-r   c                   óf   a a€ ] tR t^+t oRtV3R lV 3R lltV3R lR ltV3R lR ltRtVt	V ;t
# )	r   as  Normalize an image with a stored per-channel mean and standard deviation (module form).

``op = Normalize(mean, std)`` stores the statistics and ``out = op(input)`` is :func:`normalize` with them. A tensor
statistic is stored as a non-persistent buffer, and an ``nn.Parameter`` stays a parameter that optimizers and
checkpoints include.

Convention:
    - See the convention block of :func:`normalize`.

Args:
    mean: mean of each channel, a number, a list, a tuple or a tensor.
    std: standard deviation of each channel, in the same forms.

Shape:
    - Input: image ``(B, C, *)``.
    - Output: same shape as the input.

See Also:
    - :func:`normalize`: the one-call form.
    - :class:`Denormalize`: the inverse.
    - :class:`~kornia.augmentation.Normalize`: the same operation inside an augmentation pipeline.

Examples:
    >>> x = torch.rand(1, 4, 3, 3)
    >>> out = Normalize(0.0, 255.)(x)
    >>> out.shape
    torch.Size([1, 4, 3, 3])

    >>> x = torch.rand(1, 4, 3, 3)
    >>> mean = torch.zeros(4)
    >>> std = 255. * torch.ones(4)
    >>> out = Normalize(mean, std)(x)
    >>> out.shape
    torch.Size([1, 4, 3, 3])

c                óÎ   <€ V ^8„  d   QhRS[ S[P                  S[S[,          S[S[,          S[3,          RS[ S[P                  S[S[,          S[S[,          S[3,          RR/# ©r
   ÚmeanÚstdr   N)r   r   r   r   Úfloatr   )r   Ú__classdict__s   "€r   r   ÚNormalize.__annotate__Q   s]   ø€ ÷ ñ á‘E—L‘L¡%©¥,±±Uµ¹UÐBÕCðñ ‘5—<‘<¡¡u¥©t±E­{¹EÐAÕBðð 
ñ	r   c                ó’  <€ \         SV `  4        \        V\        P                  4      '       d6   \        V\
        P                  4      '       g   V P                  R VRR7       MWn        \        V\        P                  4      '       d7   \        V\
        P                  4      '       g   V P                  RVRR7       R# W n	        R# ©r   F)Ú
persistentr   N©
ÚsuperÚ__init__Ú
isinstancer   r   r   Ú	ParameterÚregister_bufferr   r   ©Úselfr   r   Ú	__class__s   &&&€r   r'   ÚNormalize.__init__Q   s†   ø€ ô
 	‰ÑÔä�dœEŸL™L×)Ò)´*¸TÄ2Ç<Á<×2PÒ2PØ× Ñ  ¨¸%Ð Õ@àŒIä�cœ5Ÿ<™<×(Ò(´¸CÄÇÁ×1NÒ1NØ× Ñ  ¨¸Ð Ö>àŽHr   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# ©r
   Úinputr   r   )r   r    s   "€r   r   r!   b   s#   ø€ ÷ +ñ +™UŸ\™\ð +©e¯l©lñ +r   c                ó¬  € \        V4      pV P                  pV P                  p\        V\        P
                  4      '       g4   \        P                  ! W!P                  VP                  R7      R,          p\        V\        P
                  4      '       g4   \        P                  ! W1P                  VP                  R7      R,          p\        WV4      # )a  Normalize an input tensor channel-wise with this module's statistics.

This method is a thin wrapper over :func:`normalize`, reusing the
``mean`` and ``std`` values stored in the module constructor.

Args:
    input: Tensor to normalize, typically with shape ``(*, C, ...)``,
        where ``*`` represents optional leading dimensions (for example
        batch) and ``C`` is the channel dimension.

Returns:
    A tensor with the same shape as ``input`` whose channel values are
    normalized by ``(x - mean) / std``.
©ÚdeviceÚdtypeN)
r   r   r   r(   r   r   Ú	as_tensorr4   r5   Ú	normalize©r,   r1   r   r   s   &&  r   ÚforwardÚNormalize.forwardb   sŒ   € ô" & eÓ,ˆð �y‰yˆØ�h‰hˆÜ˜$¤§¡×-Ò-Ü—?’? 4·±ÀEÇKÁKÔPÐQUÕVˆDÜ˜#œuŸ|™|×,Ò,Ü—/’/ #¯l©lÀ%Ç+Á+ÔNÈtÕTˆCÜ˜ cÓ*Ð*r   c                ó    <€ V ^8„  d   QhRS[ /# ©r
   r   ©Ústr)r   r    s   "€r   r   r!      ó   ø€ ÷ .ñ .™#ñ .r   c                óv   € R V P                    RV P                   R2pV P                  P                  V,           # ©z(mean=z, std=Ú)©r   r   r-   Ú__name__©r,   Úreprs   & r   Ú__repr__ÚNormalize.__repr__   ó3   € Ø˜Ÿ	™	�{ &¨¯©¨
°!Ð4ˆØ�~‰~×&Ñ&¨Õ-Ð-r   ©r   r   ©rD   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r'   r9   rG   Ú__static_attributes__Ú__classdictcell__Ú__classcell__©r-   r    s   @@r   r   r   +   s.   ù‡ € ñ#÷Jó ÷"+ð +÷:.÷ .ð .r   c                ó˜   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\         P                  /# ©r
   r   r   r   r   r   )r   s   "r   r   r   „   s>   € ÷ Vñ V”E—L‘Lð V¬¯©ð V¼5¿<¹<ð VÌEÏLÉLñ Vr   c                óš  € \        V 4      p V P                  p\        P                  P	                  4       '       dò   \        V\        P                  4      '       d!   \        V\        P                  4      '       g   \        R4      hVP                  4       ^8:  d   VP                  ^R4      pVP                  4       ^8:  d   VP                  ^R4      pVP                  ^ ,          ^8w  g   VP                  ^ ,          ^8w  d'   \        RVP                   RVP                   R24      hEMô\        V\        \        34      '       d=   \        P                  ! V.V^,          ,          V P                  V P                  R7      p\        V\        \        34      '       d=   \        P                  ! V.V^,          ,          V P                  V P                  R7      pVP                  '       d‘   VP                  ^ ,          ^8w  dy   VP                  ^ ,          V P                  ^,          8w  dP   VP                  R,          V P                  R,          8w  d'   \        RVP                   RV P                   R	24      hVP                  '       d‘   VP                  ^ ,          ^8w  dy   VP                  ^ ,          V P                  ^,          8w  dP   VP                  R,          V P                  R,          8w  d'   \        R
VP                   RV P                   R	24      h\        WP                  V P                  4      p\        W P                  V P                  4      pVR,          pVR,          p^pVR,           F  pWE,          pK  	  V P!                  V^ ,          V^,          V4      V,
          V,          pVP!                  V4      # )aS  Normalize an image or video with a per-channel mean and standard deviation.

``out = normalize(data, mean, std)`` returns ``(data - mean) / std`` for each channel of ``data`` ``(B, C, *)``,
with the channel on dimension 1.

Convention:
    - ``mean`` and ``std`` are converted to the dtype and device of ``data``; a floating ``data`` keeps its dtype.
    - An integer or bool ``data`` is converted to torch's default floating dtype first, so a fractional statistic is
      not truncated. Pixel values are not rescaled: give ``mean`` and ``std`` in the 0-255 scale for a uint8 image.

Args:
    data: image or video with shape ``(B, C, *)``.
    mean: mean of each channel: a number, a 0-d tensor, or a tensor with shape ``(C,)``, ``(1, C)`` for all samples
        or ``(B, C)`` for one per sample. A list raises.
    std: standard deviation of each channel, in the same forms.

Returns:
    Normalized tensor with the shape of ``data``.

See Also:
    - :func:`denormalize`: the inverse.
    - :func:`normalize_min_max`: scales each channel plane to a value range instead of using fixed statistics.
    - :class:`Normalize`: the module form.

Examples:
    >>> x = torch.rand(1, 4, 3, 3)
    >>> out = normalize(x, torch.tensor([0.0]), torch.tensor([255.]))
    >>> out.shape
    torch.Size([1, 4, 3, 3])

    >>> x = torch.tensor([[[[0, 255]]]], dtype=torch.uint8)
    >>> normalize(x, 127.5, 127.5)
    tensor([[[[-1.,  1.]]]])

    >>> x = torch.rand(1, 4, 3, 3)
    >>> mean = torch.zeros(4)
    >>> std = 255. * torch.ones(4)
    >>> out = normalize(x, mean, std)
    >>> out.shape
    torch.Size([1, 4, 3, 3])

ú6Only torch.Tensor is accepted when converting to ONNX.zqBatch dimension must be one for broadcasting when converting to ONNX.Try changing mean shape and std shape from (z, z) to (1, C) or (1, C, 1, 1).r3   ºNr
   Nú5mean length and number of channels do not match. Got ú and Ú.ú4std length and number of channels do not match. Got :r
   NNéÿÿÿÿ).N)r   Úshaper   ÚonnxÚis_in_onnx_exportr(   r   Ú
ValueErrorÚdimÚviewÚintr   Útensorr4   r5   r   Úreshape)r   r   r   r^   Únumelrb   Úouts   &&&    r   r7   r7   „   sÚ  € ôV ! Ó&€DØ�J‰J€Eä‡z�z×#Ñ#×%Ò%Ü˜$¤§¡×-Ò-´ZÀÄUÇ\Á\×5RÒ5RÜÐUÓVÐVà�8‰8‹:˜Œ?Ø—9‘9˜Q Ó#ˆDØ�7‰7‹9˜Œ>Ø—(‘(˜1˜b“/ˆCØ�:‰:�a�=˜AÔ §¡¨1¥°Ô!2Üð?Ø?C¿z¹z¸lÈ"ÈSÏYÉYÈKÐWsðuóð ñ "3ô �dœS¤%˜L×)Ò)Ü—<’<  ¨¨q­Õ 1¸$¿+¹+ÈTÏZÉZÔXˆDä�cœC¤˜<×(Ò(Ü—,’, ˜u u¨Q¥xÕ/¸¿¹È4Ï:É:ÔVˆCð �:�:ˆ:˜$Ÿ*™* Q�-¨1Ô,°·±¸AµÀ$Ç*Á*ÈQÅ-Ô1OÐTX×T^ÑT^Ð_aÕTbÐfj×fpÑfpÐqsÕftÔTtÜÐTÐUY×U_ÑU_ÐT`Ð`eÐfj×fpÑfpÐeqÐqrÐsÓtÐtð �9�9ˆ9˜Ÿ™ 1�¨Ô*¨s¯y©y¸­|¸t¿z¹zÈ!½}Ô/LÐQT×QZÑQZÐ[]ÕQ^Ðbf×blÑblÐmoÕbpÔQpÜÐSÐTW×T]ÑT]ÐS^Ð^cÐdh×dnÑdnÐcoÐopÐqÓrÐrä! $¯©°T·Z±ZÓ@€DÜ
  §k¡k°4·:±:Ó
>€Cà�	�?€DØ
ˆi�.€Cà€EØ�R�yˆyˆØ�Šñ ð Ÿ™ e¨A¥h°°aµ¸%Ó@À4ÕGÈ3ÕN€Cà�;‰;�uÓÐr   c                   óf   a a€ ] tR t^Ýt oRtV3R lV 3R lltV3R lR ltV3R lR ltRtVt	V ;t
# )	r   a–  Undo a per-channel mean and standard-deviation normalization with stored statistics (module form).

``op = Denormalize(mean, std)`` stores the statistics and ``out = op(input)`` is :func:`denormalize` with them. A
tensor statistic is stored as a non-persistent buffer, and an ``nn.Parameter`` stays a parameter that optimizers and
checkpoints include.

Convention:
    - See the convention block of :func:`denormalize`.

Args:
    mean: mean of each channel, a number, a list, a tuple or a tensor.
    std: standard deviation of each channel, in the same forms.

Shape:
    - Input: image ``(B, C, *)``.
    - Output: same shape as the input.

See Also:
    - :func:`denormalize`: the one-call form.
    - :class:`Normalize`: the inverse.
    - :class:`~kornia.augmentation.Denormalize`: the same operation inside an augmentation pipeline.

Examples:
    >>> x = torch.rand(1, 4, 3, 3)
    >>> out = Denormalize(0.0, 255.)(x)
    >>> out.shape
    torch.Size([1, 4, 3, 3])

    >>> x = torch.rand(1, 4, 3, 3, 3)
    >>> mean = torch.zeros(1, 4)
    >>> std = 255. * torch.ones(1, 4)
    >>> out = Denormalize(mean, std)(x)
    >>> out.shape
    torch.Size([1, 4, 3, 3, 3])

c                ó~   <€ V ^8„  d   QhRS[ S[P                  S[3,          RS[ S[P                  S[3,          RR/# r   )r   r   r   r   )r   r    s   "€r   r   ÚDenormalize.__annotate__  s@   ø€ ÷ ñ ™U¡5§<¡<±Ð#6Õ7ð ¹eÁEÇLÁLÑRWÐDWÕ>Xð Ð]añ r   c                ó’  <€ \         SV `  4        \        V\        P                  4      '       d6   \        V\
        P                  4      '       g   V P                  R VRR7       MWn        \        V\        P                  4      '       d7   \        V\
        P                  4      '       g   V P                  RVRR7       R# W n	        R# r#   r%   r+   s   &&&€r   r'   ÚDenormalize.__init__  s„   ø€ Ü‰ÑÔä�dœEŸL™L×)Ò)´*¸TÄ2Ç<Á<×2PÒ2PØ× Ñ  ¨¸%Ð Õ@àŒIä�cœ5Ÿ<™<×(Ò(´¸CÄÇÁ×1NÒ1NØ× Ñ  ¨¸Ð Ö>àŽHr   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# r0   r   )r   r    s   "€r   r   rk     s#   ø€ ÷ -ñ -™UŸ\™\ð -©e¯l©lñ -r   c                óà  € \        V4      pV P                  pV P                  p\        V\        P
                  4      '       gA   \        P                  ! \        P                  ! W!P                  VP                  R7      4      p\        V\        P
                  4      '       gA   \        P                  ! \        P                  ! W1P                  VP                  R7      4      p\        WV4      # )a�  Restore scale/offset from a tensor normalized by mean and std.

This method delegates to :func:`denormalize` using this module's stored
``mean`` and ``std`` parameters.

Args:
    input: Tensor to denormalize, commonly shaped ``(*, C, ...)``
        with channel dimension ``C``.

Returns:
    A tensor with the same shape as ``input`` where each channel is
    transformed by ``x * std + mean``.
r3   )r   r   r   r(   r   r   Ú
atleast_1dr6   r4   r5   Údenormalizer8   s   &&  r   r9   ÚDenormalize.forward  s�   € ô & eÓ,ˆð �y‰yˆØ�h‰hˆÜ˜$¤§¡×-Ò-Ü×#Ò#¤E§O¢O°DÇÁÐUZ×U`ÑU`Ô$aÓbˆDÜ˜#œuŸ|™|×,Ò,Ü×"Ò"¤5§?¢?°3¿|¹|ÐSX×S^ÑS^Ô#_Ó`ˆCÜ˜5¨Ó,Ð,r   c                ó    <€ V ^8„  d   QhRS[ /# r<   r=   )r   r    s   "€r   r   rk   -  r?   r   c                óv   € R V P                    RV P                   R2pV P                  P                  V,           # rA   rC   rE   s   & r   rG   ÚDenormalize.__repr__-  rI   r   rJ   rK   rS   s   @@r   r   r   Ý   s.   ù‡ € ñ#÷Jó ÷-ð -÷:.÷ .ð .r   c                óÜ   € V ^8„  d   QhR\         P                  R\        \         P                  \        3,          R\        \         P                  \        3,          R\         P                  /# rU   )r   r   r   r   )r   s   "r   r   r   2  sY   € ÷ V*ñ V*”e—l‘lð V*¬%´·±¼eÐ0CÕ*Dð V*Ì5ÔQV×Q]ÑQ]Ô_dÐQdÕKeð V*Ôjo×jvÑjvñ V*r   c                óÆ  € \        V 4      p V P                  p\        P                  P	                  4       '       d×   \        V\        P                  4      '       d!   \        V\        P                  4      '       g   \        R4      hVP                  4       ^8:  d   VP                  ^R	4      pVP                  4       ^8:  d   VP                  ^R	4      pVP                  ^ ,          ^8w  g   VP                  ^ ,          ^8w  d   \        R4      hEMô\        V\        \        34      '       d=   \        P                  ! V.V^,          ,          V P                  V P                  R7      p\        V\        \        34      '       d=   \        P                  ! V.V^,          ,          V P                  V P                  R7      pVP                  '       d‘   VP                  ^ ,          ^8w  dy   VP                  ^ ,          V P                  ^,          8w  dP   VP                  R,          V P                  R,          8w  d'   \        RVP                   RV P                   R24      hVP                  '       d‘   VP                  ^ ,          ^8w  dy   VP                  ^ ,          V P                  ^,          8w  dP   VP                  R,          V P                  R,          8w  d'   \        RVP                   RV P                   R24      h\        WP                  V P                  4      p\        W P                  V P                  4      pVP                  4       ^8X  d4   VP                  ! ^R	.^.V P                  4       ^,
          ,          O5!  pM;\!        VP                  4      V P                  4       8  d   VP#                  R	4      pK;  VP                  4       ^8X  d4   VP                  ! ^R	.^.V P                  4       ^,
          ,          O5!  pM;\!        VP                  4      V P                  4       8  d   VP#                  R	4      pK;  \        P$                  ! WV4      # )
a“  Undo a per-channel mean and standard-deviation normalization of an image or video.

``out = denormalize(data, mean, std)`` returns ``data * std + mean`` for each channel of ``data`` ``(B, C, *)``,
which inverts :func:`normalize` for the same ``mean`` and ``std``.

Convention:
    - ``mean`` and ``std`` take the forms of :func:`normalize`, are converted to the dtype and device of ``data``,
      and a floating ``data`` keeps its dtype.
    - An integer or bool ``data`` is converted to torch's default floating dtype first, so the result is floating
      and cannot wrap.

Args:
    data: image or video with shape ``(B, C, *)``.
    mean: mean of each channel: a number, a 0-d tensor, or a tensor with shape ``(C,)``, ``(1, C)`` or ``(B, C)``.
    std: standard deviation of each channel, in the same forms.

Returns:
    Denormalized tensor with the shape of ``data``.

See Also:
    - :func:`normalize`: the inverse.
    - :class:`Denormalize`: the module form.

Examples:
    >>> x = torch.rand(1, 4, 3, 3)
    >>> out = denormalize(x, 0.0, 255.)
    >>> out.shape
    torch.Size([1, 4, 3, 3])

    >>> x = torch.tensor([[[[0, 255]]]], dtype=torch.uint8)
    >>> denormalize(x, 10., 2.)
    tensor([[[[ 10., 520.]]]])

    >>> x = torch.rand(1, 4, 3, 3, 3)
    >>> mean = torch.zeros(1, 4)
    >>> std = 255. * torch.ones(1, 4)
    >>> out = denormalize(x, mean, std)
    >>> out.shape
    torch.Size([1, 4, 3, 3, 3])

rW   zEBatch dimension must be one for broadcasting when converting to ONNX.r3   rX   rY   rZ   r[   r\   r]   )r   r^   r   r_   r`   r(   r   ra   rb   rc   rd   r   re   r4   r5   r   ÚlenÚ	unsqueezeÚaddcmul)r   r   r   r^   s   &&& r   rq   rq   2  s  € ôT ! Ó&€DØ�J‰J€Eä‡z�z×#Ñ#×%Ò%Ü˜$¤§¡×-Ò-´ZÀÄUÇ\Á\×5RÒ5RÜÐUÓVÐVà�8‰8‹:˜Œ?Ø—9‘9˜Q Ó#ˆDØ�7‰7‹9˜Œ>Ø—(‘(˜1˜b“/ˆCØ�:‰:�a�=˜AÔ §¡¨1¥°Ô!2ÜÐdÓeÐeñ "3ô �dœS¤%˜L×)Ò)Ü—<’<  ¨¨q­Õ 1¸$¿+¹+ÈTÏZÉZÔXˆDä�cœC¤˜<×(Ò(Ü—,’, ˜u u¨Q¥xÕ/¸¿¹È4Ï:É:ÔVˆCð �:�:ˆ:˜$Ÿ*™* Q�-¨1Ô,°·±¸AµÀ$Ç*Á*ÈQÅ-Ô1OÐTX×T^ÑT^Ð_aÕTbÐfj×fpÑfpÐqsÕftÔTtÜÐTÐUY×U_ÑU_ÐT`Ð`eÐfj×fpÑfpÐeqÐqrÐsÓtÐtð �9�9ˆ9˜Ÿ™ 1�¨Ô*¨s¯y©y¸­|¸t¿z¹zÈ!½}Ô/LÐQT×QZÑQZÐ[]ÕQ^Ðbf×blÑblÐmoÕbpÔQpÜÐSÐTW×T]ÑT]ÐS^Ð^cÐdh×dnÑdnÐcoÐopÐqÓrÐrä! $¯©°T·Z±ZÓ@€DÜ
  §k¡k°4·:±:Ó
>€Cà‡x�xƒz�Q„Ø�yŠy˜˜BÐ: 1 #¨¯©«°a­Õ"8Ó:‰ô �$—*‘*‹o §¡£
Ô*Ø—>‘> "Ó%ŠDà
‡w�wƒy�A„~Ø�hŠh�q˜"Ð8   t§x¡x£z°A¥~Õ 6Ó8‰ä�#—)‘)‹n˜tŸx™x›zÔ)Ø—-‘- Ó#ŠCä�=Š=˜ SÓ)Ð)r   c          
      ó|   € V ^8„  d   QhR\         P                  R\        R\        R\        R\         P                  /# )r
   r1   Úmin_valÚmax_valÚepsr   )r   r   r   )r   s   "r   r   r   ‹  s<   € ÷ = ñ = Ü�<‰<ð= Ü"'ð= Ü8=ð= ÜJOð= ä
‡\�\ñ= r   c                óJ  € \        V \        P                  4      '       g   \        R\	        V 4       R24      hV P
                  ^8  d   \        RV P                   24      h^ V P                  RR 9   d   \        R4      h\        V\        4      '       g   \        R\	        V4       R24      h\        V\        4      '       g   \        R\	        V4       R24      hV P                  4       '       g    V P                  4       '       g
   V R,          p V P                  pV P                  RR	7      pVP                  RR
R7      ^ ,          pVP                  RR
R7      ^ ,          pW!,
          WV,
          ,          Wv,
          V,           ,          V,           pVP                  V4      # )aD  Rescale each channel plane of an image linearly to a value range.

``out = normalize_min_max(input, min_val, max_val)`` maps the minimum of each ``H x W`` plane of ``input`` to
``min_val`` and its maximum to just below ``max_val``, using that plane's own range:
``(max_val - min_val) * (x - x.min()) / (x.max() - x.min() + eps) + min_val``. A constant plane maps to ``min_val``.

Convention:
    - Input is ``(*, C, H, W)``. Empty leading dimensions are preserved; channel and spatial dimensions must be
      nonzero.
    - Integer and boolean inputs are promoted to torch's default floating dtype first, as in :func:`normalize`;
      floating inputs keep their dtype.

Args:
    input: image with shape ``(*, C, H, W)``.
    min_val: value of each plane's minimum, a ``float``.
    max_val: target of each plane's maximum, a ``float``.
    eps: value added to each plane's range ``r = x.max() - x.min()``, so the maximum lands at
        ``max_val - (max_val - min_val) * eps / (r + eps)``.

Returns:
    Rescaled image with the shape of ``input``.

See Also:
    - :func:`normalize`: subtracts a given mean and divides by a given standard deviation instead.

Example:
    >>> x = torch.rand(1, 5, 3, 3)
    >>> x_norm = normalize_min_max(x, min_val=-1., max_val=1.)
    >>> x_norm.min()
    tensor(-1.)
    >>> x_norm.max()
    tensor(1.0000)

z$data should be a torch.Tensor. Got: r[   z4Input tensor must have at least two dimensions. Got NzEInvalid input tensor, channel and spatial dimensions must be nonzero.z"'min_val' should be a float. Got: z"'max_val' should be a float. Got: ç      ð?)Ú	start_dimT)Úkeepdiméýÿÿÿéþÿÿÿr]   )r(   r   r   Ú	TypeErrorÚtypeÚndimra   r^   r   r   r   ÚflattenÚminÚmaxrf   )	r1   r|   r}   r~   r^   Ú
x_reshapedÚx_minÚx_maxÚx_outs	   &&&&     r   Únormalize_min_maxr�   ‹  s]  € ôJ �eœUŸ\™\×*Ò*ÜÐ>¼tÀE»{¸mÈ1ÐMÓNÐNà‡z�z�A„~ÜÐOÐPU×P[ÑP[È}Ð]Ó^Ð^àˆE�K‰K˜˜ÐÔÜÐ`ÓaÐaä�gœu×%Ò%ÜÐ<¼TÀ'»]¸OÈ1ÐMÓNÐNä�gœu×%Ò%ÜÐ<¼TÀ'»]¸OÈ1ÐMÓNÐNà×"Ñ"×$Ò$¨U×-=Ñ-=×-?Ò-?à˜•ˆØ�K‰K€EØ—‘¨�Ó,€JØ�N‰N˜2 tˆNÓ,¨QÕ/€EØ�N‰N˜2 tˆNÓ,¨QÕ/€EàÕ :Õ#5Õ6¸%½-È#Õ:MÕNÐQXÕX€EØ�=‰=˜ÓÐr   )r   r   rq   r7   r�   )g        r€   g�íµ ÷Æ°>)rO   Útypingr   r   r   r   r   Úkornia.core.utilsr   Ú__all__r   ÚModuler   r7   r   rq   r�   © r   r   Ú<module>r•      sb   ðñ$ Dç %Ñ %ã Ý å 4â
W€õ
.ôV.�—	‘	ô V.õrVôrR.�"—)‘)ô R.õjV*÷r= ñ = r   