+
    ûäûj6  ã                   ó¸   € ^ RI HtHtHtHtHtHtHtHt ^ RI	t	^ RI	H
t
 ^ RIHt ^ RIHt ]! RRR7      tR	 R
 lt ! R R4      t ! R R]
P$                  4      tR# )é    )ÚAnyÚCallableÚDictÚListÚOptionalÚTupleÚTypeVarÚUnionN)Únn)Ú_AugmentationBase)Ú_to_device_nonblockingÚTÚOperationBase)Úboundc                óX   € V ^8„  d   QhR\         P                  R\         P                  /# ©é   ÚxÚreturn©ÚtorchÚTensor)Úformats   "ÚdC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\augmentation\auto\operations\base.pyÚ__annotate__r      s"   € ÷ ñ ”—‘ð ¤%§,¡,ñ ó    c                 ó   € V # ©N© )r   s   &r   Ú	_identityr       s   € Ø€Hr   c                   óH   a € ] tR t^!t o RtV 3R lR ltV 3R lR ltRtV tR# )Ú_RandomSignzkMultiply the magnitude mapping by a random sign per row; a class rather than a closure, so wrappers pickle.c                ód   <€ V ^8„  d   QhRS[ S[P                  .S[P                  3,          RR/# )r   Úfnr   N)r   r   r   )r   Ú__classdict__s   "€r   r   Ú_RandomSign.__annotate__$   s/   ø€ ÷ ñ ™8¡U§\¡\ N±E·L±LÐ$@ÕAð Àdñ r   c                ó   € Wn         R # r   ©r$   )Úselfr$   s   &&r   Ú__init__Ú_RandomSign.__init__$   s   € ØŽr   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# r   r   )r   r%   s   "€r   r   r&   '   s#   ø€ ÷ -ñ -™%Ÿ,™,ð -©5¯<©<ñ -r   c                óþ   € \         P                  ! \         P                  ! VP                  ^ ,          3VP                  R7      R8„  RR4      pV P                  V4      VP                  VP                  4      ,          # )r   ©Údeviceg      à?g      ð?g      ð¿)r   ÚwhereÚrandÚshaper/   r$   ÚtoÚdtype)r)   r   Úsigns   && r   Ú__call__Ú_RandomSign.__call__'   sU   € ô �{Š{œ5Ÿ:š: q§w¡w¨q¥z m¸A¿H¹HÔEÈÑKÈSÐRVÓWˆØ�w‰w�q‹z˜DŸG™G A§G¡GÓ,Õ,Ð,r   r(   N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r*   r6   Ú__static_attributes__Ú__classdictcell__)r%   s   @r   r"   r"   !   s   ø‡ € Ùu÷ð ÷-ö -r   r"   c                   ó6  a a€ ] tR t^.t oRtRV3R lV 3R llltV3R lV 3R ll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V3R lR llt
RV3R lR llt]V3R lR l4       t]V3R lR l4       t]V3R lR l4       t]V3R lR l4       tRtVtV ;t# )r   aÿ  Wrap one augmentation module for use in an automatic augmentation policy.

``output = OperationBase(op)(input)`` applies a wrapped shape-preserving augmentation to floating
images of shape ``(B, C, H, W)``. To control a magnitude, pass a list such as
``initial_magnitude=[("brightness_factor", 0.5)]`` for a brightness operation. Use
:class:`~kornia.augmentation.auto.PolicySequential` to compose operations into a policy.

Args:
    operation: Kornia augmentation module.
    initial_magnitude: targeted magnitude parameter name and its initial magnitude value.
        The magnitude parameter name shall align with the attribute inside the random_generator
        in each augmentation. If None, the augmentation will be randomly applied according to
        the augmentation sampling range.
    temperature: retained for API compatibility.
    is_batch_operation: initialize the legacy ``probability`` from ``p_batch`` instead of ``p``; sampling still
        uses the wrapped gates.

Convention:
    - ``probability`` is initialized from the wrapped augmentation's ``p`` (``p_batch`` for a batch operation),
      clamped to ``[1e-7, 1 - 1e-7]`` and kept in ``state_dict()`` for checkpoint compatibility, but it takes
      no part in sampling and receives no gradient: the gate is drawn from the wrapped augmentation's own
      ``p`` and ``p_batch`` as a hard ``0`` or ``1``. ``magnitude``, where the operation has one, is clamped to
      the wrapped generator's range and receives a gradient where the wrapped augmentation is differentiable
      in it; ``forward_parameters`` substitutes it into the wrapped augmentation's draw. The substituted factor
      is on the device of the magnitude, while the other parameters stay where the generator returns them.
    - ``forward`` linearly blends the wrapped output with the input using ``batch_prob``. The wrapped
      augmentation transforms every row whose gate is above ``0``, so the same supplied fractional
      ``batch_prob`` produces the same soft blend whatever the wrapped ``p`` or ``p_batch``. Below ``p = 1`` the
      wrapped augmentation skips a row with gate ``0``, so that row's matrix stays the identity.
      Consequently, a wrapped operation that changes spatial dimensions cannot be used, even when
      ``is_batch_operation=True``.
    - ``magnitude_range`` is read-only and reads the wrapped generator on each access. A range that is an
      ``nn.Parameter`` belongs to the generator, so ``state_dict()`` and ``named_parameters()`` have no
      ``magnitude_range`` entry for it; a checkpoint or pickle that still has the former entry loads.
    - a symmetric magnitude applies the magnitude mapping first and then a random sign per row, so a mapping
      that quantizes to zero stays zero (``Posterize`` maps ``0.5`` to ``0`` bits with ``magnitude_range=(0, 8)``).
    - the concrete classes in ``kornia.augmentation.auto.operations.ops`` wrap public 2D augmentations and
      inherit their input, dtype, RNG and replay contracts. A wrapper pickles, with either sign setting, when
      its magnitude mapping is picklable.

See Also:
    - :class:`~kornia.augmentation.auto.PolicySequential`: runs the operations of a policy in order.
    - :class:`~kornia.augmentation.auto.operations.ops.Rotate`: is a concrete geometric policy operation.

c                óØ   <€ V ^8„  d   QhRS[ RS[S[S[S[S[S[,          3,          ,          ,          RS[RS[RS[S[S[P                  .S[P                  3,          ,          RS[RR/# )	r   Ú	operationÚinitial_magnitudeÚtemperatureÚis_batch_operationÚmagnitude_fnÚsymmetric_megnituder   N)
r   r   r   r   ÚstrÚfloatÚboolr   r   r   )r   r%   s   "€r   r   ÚOperationBase.__annotate__]   s‹   ø€ ÷ Cñ Cá$ðCñ $¡D©©s±H¹UµOÐ/CÕ)DÕ$EÕFðCñ ð	Cñ
 !ðCñ ™x©¯©¨¹¿¹Ð(DÕEÕFðCñ "ðCð 
ñCr   c                óÞ  <€ \         SV `  4        \        V\        4      '       g   \	        R V R24      hWn        V P                  V4       RV n        W@n        V'       dT   \        P                  ! \        P                  ! ^4      P                  V P
                  P                  4      4      V n        MR\        P                  ! \        P                  ! ^4      P                  V P
                  P                   4      4      V n        V^ 8  d   \	        RV R24      hV P#                  R\        P                  ! ^4      P                  V4      4       W`n        V P'                  V4      V n        R# )z)Only Kornia augmentations supported. Got Ú.z-Expect temperature value greater than 0. Got rC   N)gH¯¼šò×z>gËPÊÿÿï?)Úsuperr*   Ú
isinstancer   Ú
ValueErrorÚopÚ_init_magnitudeÚprobability_rangeÚ_is_batch_operationr   Ú	Parameterr   ÚemptyÚfill_Úp_batchÚ_probabilityÚpÚregister_bufferrF   Ú_init_magnitude_fnÚ_magnitude_fn)r)   rA   rB   rC   rD   rE   rF   Ú	__class__s   &&&&&&&€r   r*   ÚOperationBase.__init__]   s  ø€ ô 	‰ÑÔÜ˜)Ô%6×7Ò7ÜÐHÈÈÐSTÐUÓVÐVàŒà×ÑÐ.Ô/ð "2ˆÔØ#5Ô ßÜ "§¢¬U¯[ª[¸«^×-AÑ-AÀ$Ç'Á'Ç/Á/Ó-RÓ SˆDÕä "§¢¬U¯[ª[¸«^×-AÑ-AÀ$Ç'Á'Ç)Á)Ó-LÓ MˆDÔà˜Œ?ÜÐLÈ[ÈMÐYZÐ[Ó\Ð\Ø×Ñ˜]¬E¯KªK¸«N×,@Ñ,@ÀÓ,MÔNà#6Ô Ø!×4Ñ4°\ÓBˆÖr   c                ó:   <€ V ^8„  d   QhRS[ S[S[3,          RR/# )r   Ústater   N©r   rG   r   )r   r%   s   "€r   r   rJ   }   s#   ø€ ÷ 3ñ 3¡$¡s©C x¥.ð 3°Tñ 3r   c                ó–   <€ \         SV `  V4       V P                  P                  R R4       V P                  P                  R R4       R# ©Úmagnitude_rangeN)rM   Ú__setstate__Ú_parametersÚpopÚ__dict__)r)   r`   r]   s   &&€r   re   ÚOperationBase.__setstate__}   s>   ø€ Ü‰Ñ˜UÔ#ð 	×Ñ×ÑÐ.°Ô5Ø�‰×ÑÐ+¨TÖ2r   c          
      óL   <€ V ^8„  d   QhRS[ S[S[3,          RS[RS[RS[RR/# )r   Ú
state_dictÚprefixÚargsÚkwargsr   Nra   )r   r%   s   "€r   r   rJ   …   sB   ø€ ÷ Kñ K±±S¹#°Xµð KÉð KÑTWð KÑcfð KÐkoñ Kr   c                óZ   <€ VP                  V R 2R4       \        SV `  ! W.VO5/ VB  R# rc   )rg   rM   Ú_load_from_state_dict)r)   rk   rl   rm   rn   r]   s   &&&*,€r   rp   Ú#OperationBase._load_from_state_dict…   s1   ø€ ð 	�‰˜&˜ Ð1°4Ô8Ü‰Ò% jÐJ¸4ÒJÀ6ÔJr   c                ó¶   <€ V ^8„  d   QhRS[ S[S[P                  .S[P                  3,          ,          RS[S[P                  .S[P                  3,          /# )r   rE   r   )r   r   r   r   )r   r%   s   "€r   r   rJ   Œ   sJ   ø€ ÷ 	ñ 	Ù$¡X©u¯|©|¨n¹e¿l¹lÐ.JÕ%KÕLð	á	‘5—<‘<�.¡%§,¡,Ð.Õ	/ñ	r   c                óT   € Vf   \         pV P                  '       d   \        V4      # V# r   )r    rF   r"   )r)   rE   s   &&r   r[   Ú OperationBase._init_magnitude_fnŒ   s,   € ð ÒÜ$ˆLà×#×#Ð#Ü˜|Ó,Ð,àÐr   c                ój   <€ V ^8„  d   QhRS[ S[S[S[S[ S[,          3,          ,          ,          RR/# )r   rB   r   N)r   r   r   rG   rH   )r   r%   s   "€r   r   rJ   —   s9   ø€ ÷ ^ñ ^±¹$¹uÁSÉ(ÑSXÍ/ÐEYÕ?ZÕ:[Õ1\ð ^Ðaeñ ^r   c                ó  € \        V\        \        34      '       dd   \        ;QJ d    R  V 4       F  '       d   K   RM	  RM! R  V 4       4      '       g   \	        RV 24      h\        V4      ^8w  d   \        R4      hVf   RV n        RV n        R# V^ ,          ^ ,          V n        V P                  P                  f1   \	        RV P                   RV P                  P                   R24      h\        V P                  P                  V P                  4       RV n        V^ ,          ^,          eO   \        P                  ! \        P                  ! ^4      P!                  V^ ,          ^,          4      4      V n        R# R# )	c              3   óz   "  € T F1  p\        V\        \        34      ;'       d    \        V4      ^8H  x € K3  	  R# 5i)r   N)rN   ÚlistÚtupleÚlen)Ú.0Úini_mags   & r   Ú	<genexpr>Ú0OperationBase._init_magnitude.<locals>.<genexpr>™   s2   é € ÐqÑ_pÐT[”z '¬D´%¨=Ó9×OÐO¼cÀ'»lÈaÑ>OÔOÓ_pùs   ‚!;¤;FTz=`initial_magnitude` shall be a list of 2-element tuples. Got z2Multi magnitudes operations are not yet supported.NzNo valid magnitude `z` found in `z`.)rN   rx   ry   ÚallrO   rz   ÚNotImplementedErrorÚ_factor_nameÚ
_magnituderP   Ú_param_generatorÚgetattrr   rT   r   rU   rV   )r)   rB   s   &&r   rQ   ÚOperationBase._init_magnitude—   s4  € ÜÐ'¬$´¨×7Ò7ß“3ÑqÑ_pÓq—3—3’3ÑqÑ_pÓq×qÒqÜ Ð#`ÐarÐ`sÐ!tÓuÐuÜÐ$Ó%¨Ô*Ü)Ð*^Ó_Ð_àÒ$Ø $ˆDÔØ"ˆDŽOà 1°!Õ 4°QÕ 7ˆDÔØ�w‰w×'Ñ'Ò/Ü Ð#7¸×8IÑ8IÐ7JÈ,ÐW[×W^ÑW^×WoÑWoÐVpÐprÐ!sÓtÐtä�D—G‘G×,Ñ,¨d×.?Ñ.?Ô@à"ˆDŒOØ  Õ# AÕ&Ò2Ü"$§,¢,¬u¯{ª{¸1«~×/CÑ/CÐDUÐVWÕDXÐYZÕD[Ó/\Ó"]�–ñ 3r   c                óŽ   <€ V ^8„  d   QhRS[ P                  RS[S[ P                  ,          RS[S[S[ P                  3,          /# )r   Úbatch_shapeÚmagr   )r   ÚSizer   r   r   rG   )r   r%   s   "€r   r   rJ   ¬   s@   ø€ ÷ ñ Ù Ÿ:™:ðÙ,4±U·\±\Õ,Bðá	‰c‘5—<‘<ÐÕ	 ñr   c                óô  € Vf   V P                   pV P                  P                  V4      pVeŽ   V P                  f   \	        R4      hW0P                  ,          p\        V\        P                  4      '       d   VP                  MVP                  p\        P                  ! WER7      V,           W0P                  &   V P                  e.   V P                  W0P                  ,          4      W0P                  &   V# )a9  Sample parameters for the wrapped augmentation op.

Args:
    batch_shape: Input batch shape used for sampling.
    mag: Optional magnitude override. When set, it replaces the sampled
        factor before the magnitude mapping function is applied.

Returns:
    Parameter dictionary consumed by :meth:`forward`.
z6No factor found in the params while `mag` is provided.r.   )Ú	magnituderP   Úforward_parametersr�   ÚRuntimeErrorrN   r   r   r/   Ú
zeros_liker\   )r)   r‡   rˆ   ÚparamsÚdrawr/   s   &&&   r   rŒ   Ú OperationBase.forward_parameters¬   sÄ   € ð Š;Ø—.‘.ˆCà—‘×+Ñ+¨KÓ8ˆàŠ?Ø× Ñ Ò(Ü"Ð#[Ó\Ð\ð ×+Ñ+Õ,ˆDÜ#-¨c´5·<±<×#@Ò#@�S—Z’ZÀdÇkÁkˆFÜ(-×(8Ò(8¸Ô(MÐPSÕ(SˆF×$Ñ$Ñ%à×ÑÒ(Ø(,×(:Ñ(:¸6×BSÑBSÕ;TÓ(UˆF×$Ñ$Ñ%àˆr   c                óŽ   <€ V ^8„  d   QhRS[ P                  RS[S[S[S[ P                  3,          ,          RS[ P                  /# )r   Úinputr�   r   )r   r   r   r   rG   )r   r%   s   "€r   r   rJ   Ì   sE   ø€ ÷ ]ñ ]™UŸ\™\ð ]±8¹DÁÁeÇlÁlÐARÕ<SÕ3Tð ]Ñ`e×`lÑ`lñ ]r   c                óÆ  € Vf   V P                  VP                  4      p\        VR,          RR\        VP                  4      ^,
          ,          ,           ,          VP                  VP
                  4      pVP                  4       pVR,          ^ 8„  P                  VR,          P
                  4      VR&   W0P                  WR7      ,          ^V,
          V,          ,           # )a)  Apply the operation with soft probabilistic blending.

Args:
    input: Input tensor.
    params: Optional precomputed parameters. If omitted, parameters are
        sampled from ``input.shape``.

Returns:
    Tensor blended with the wrapped augmentation's output according to
    ``batch_prob``.
Ú
batch_prob)r�   ).r   )	rŒ   r2   r   rz   r/   r4   Úcopyr3   rP   )r)   r“   r�   r•   Úwrapped_paramss   &&&  r   ÚforwardÚOperationBase.forwardÌ   sµ   € ð Š>Ø×,Ñ,¨U¯[©[Ó9ˆFä+Ø�<Õ  ¨7´c¸%¿+¹+Ó6FÈÕ6JÕ+KÕ!LÕMÈuÏ|É|Ð]b×]hÑ]hó
ˆ
ð  Ÿ™›ˆØ(.¨|Õ(<¸qÑ(@×'DÑ'DÀVÈLÕEY×E_ÑE_Ó'`ˆ�|Ñ$àŸG™G E˜GÓAÕAÀQÈÅ^ÐW\ÕD\Õ\Ð\r   c                óD   <€ V ^8„  d   QhRS[ S[P                  ,          /# ©r   r   ©r   r   r   )r   r%   s   "€r   r   rJ   è   s   ø€ ÷ ñ ¡(©5¯<©<Õ"8ñ r   c                ój   € \        V P                  R4      '       d   V P                  P                  # R# )z–Return the latest transform matrix from the wrapped op, if available.

Returns:
    Transform matrix tensor or ``None`` for non-geometric operations.
Útransform_matrixN)ÚhasattrrP   rž   ©r)   s   &r   rž   ÚOperationBase.transform_matrixç   s)   € ô �4—7‘7Ð.×/Ò/Ø—7‘7×+Ñ+Ð+Ùr   c                óp   <€ V ^8„  d   QhRS[ S[S[P                  S[S[S[3,          3,          ,          /# r›   )r   r
   r   r   r   rH   )r   r%   s   "€r   r   rJ   ó   s3   ø€ ÷ Dñ D¡©%±·±¹eÁEÉ5ÀLÕ>QÐ0QÕ*RÕ!Sñ Dr   c                óv   € V P                   f   R# \        V P                  P                  V P                   4      # )aà  Return the wrapped generator's range for the magnitude, as it holds it at this moment.

It is read on every access rather than stored: ``.to()`` replaces the tensors of the generator, so a reference
kept here would go on pointing at the tensor from before the move.

Returns:
    A tensor of shape ``(2,)`` on the device the generator keeps it on, or the ``(low, high)`` pair of a
    generator that keeps the constructor's numbers. ``None`` when this operation has no magnitude.
N)r�   r„   rP   rƒ   r    s   &r   rd   ÚOperationBase.magnitude_rangeò   s0   € ð ×ÑÒ$ÙÜ�t—w‘w×/Ñ/°×1BÑ1BÓCÐCr   c                óD   <€ V ^8„  d   QhRS[ S[P                  ,          /# r›   rœ   )r   r%   s   "€r   r   rJ     s   ø€ ÷ "ñ "™8¡E§L¡LÕ1ñ "r   c                óè   € V P                   f   R# V P                   pV P                  pVf   V# \        V\        P                  4      '       d   \        W!P                  4      pVP                  ! V!  # )zïReturn the learned magnitude value for the operation.

Returns:
    Magnitude tensor, clamped to ``magnitude_range`` when defined; otherwise
    the raw learnable value. Returns ``None`` when this operation has no
    magnitude parameter.
N)r‚   rd   rN   r   r   r   r/   Úclamp)r)   rˆ   Úboundss   &  r   r‹   ÚOperationBase.magnitude  s]   € ð �?‰?Ò"ÙØ�o‰oˆØ×%Ñ%ˆØŠ>ØˆJä�fœeŸl™l×+Ò+Ü+¨F·J±JÓ?ˆFØ�yŠy˜&Ñ!Ð!r   c                ó4   <€ V ^8„  d   QhRS[ P                  /# r›   r   )r   r%   s   "€r   r   rJ     s   ø€ ÷ @ñ @™UŸ\™\ñ @r   c                óJ   € V P                   P                  ! V P                  !  # )z†Return the operation probability after applying configured bounds.

Returns:
    Probability tensor clamped to ``probability_range``.
)rX   r§   rR   r    s   &r   ÚprobabilityÚOperationBase.probability  s!   € ð × Ñ ×&Ò&¨×(>Ñ(>Ñ?Ð?r   )r�   rS   r‚   r\   rX   rP   rR   rF   )Ngš™™™™™¹?FNFr   )r8   r9   r:   r;   r<   r*   re   rp   r[   rQ   rŒ   r˜   Úpropertyrž   rd   r‹   r¬   r=   r>   Ú__classcell__)r]   r%   s   @@r   r   r   .   sµ   ù‡ € ñ,÷\Cõ C÷@3ó 3÷Kó K÷	ð 	÷^ð ^÷*ò ÷@]ò ]ð6 ÷ó ðð ÷Dó ðDð ÷"ó ð"ð& ÷@ó ÷@ð @r   )Útypingr   r   r   r   r   r   r	   r
   r   r   Úkornia.augmentation.baser   Úkornia.core.utilsr   r   r    r"   ÚModuler   r   r   r   Ú<module>r´      sL   ð÷$ N× MÓ Mã Ý å 6Ý 4áˆC�Ô'€õ÷
-ñ 
-ôn@�B—I‘Iö n@r   