+
    ûäûj3  ã                   ó  € ^ 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IHt ^ RIHtHt ^ RIHtHtHt ^ R	IHt ^ R
IHt ^ RIHt ]]]3,          t ]]!] ]] ,          3,          t"]]",          t# ! R R]]4      t$R# )é    )ÚAnyÚDictÚIteratorÚListÚOptionalÚTupleÚUnionÚcastN)Únn)ÚGeometricAugmentationBase2D)ÚOperationBase©ÚPolicySequential)ÚImageSequentialBaseÚTransformMatrixMinIn)ÚInputSequentialOpsÚ_filter_child_optionsÚ_validate_extra_args)Ú	ParamItem©Úeye_like)Úis_exportingc                   ó>  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R 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	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tR V3R lV 3R ll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RtVtV ;t# )!ÚPolicyAugmentBasea*  Build and replay image augmentation policies made of named operations.

``output = MyPolicy(policy)(input)`` applies :class:`~kornia.augmentation.auto.PolicySequential` children to
floating images of shape ``(B, C, H, W)`` once a subclass implements two hooks: ``compose_subpolicy_sequential``,
which builds one sub-policy, and ``get_forward_sequence``, which picks the sub-policies for a call or, given
``params``, returns the recorded ones. Without ``get_forward_sequence``, ``forward(input)`` raises
``NotImplementedError``.

Convention:
    - a concrete policy selects one or more :class:`~kornia.augmentation.auto.PolicySequential` children for each
      forward call and records that selected path, including every operation parameter dictionary, in ``_params``.
      Passing that list to ``forward(input, params=...)`` selects the recorded children rather than drawing a new
      path and reproduces their output.
    - the selected operations run in the order recorded in ``_params``: the listed order inside a sub-policy, and
      for :class:`~kornia.augmentation.auto.RandAugment` the order in which its sub-policies were drawn. When
      matrix computation is enabled, their geometric transformation matrices compose in that same execution order;
      a nonempty policy containing only intensity operations has the identity matrix. An empty selected sub-policy
      has no matrix. ``inverse`` reverses a geometry-only selected path and raises ``RuntimeError`` when an
      applied intensity operation cannot be undone.
    - input normalization, random-number generation, parameter placement, replay, and serialization follow
      the canonical augmentation contract in :doc:`/get-started/conventions`. This base does not expose a
      per-instance generator.

Concrete policies define how they select children and interpret policy magnitudes.

See Also:
    - :class:`~kornia.augmentation.auto.PolicySequential`: runs the operations in one sub-policy.
    - :class:`~kornia.augmentation.container.ImageSequential`: chains arbitrary image transforms without a policy.

c                ó:   <€ V ^8„  d   QhRS[ S[,          RS[RR/# )é   ÚpolicyÚtransformation_matrix_modeÚreturnN)r   ÚSUBPOLICY_CONFIGÚstr)ÚformatÚ__classdict__s   "€ÚYC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\augmentation\auto\base.pyÚ__annotate__ÚPolicyAugmentBase.__annotate__E   s/   ø€ ÷ Yñ Y™tÑ$4Õ5ð YÑSVð YÐgkñ Yó    c                óœ   <€ V P                  V4      p\        SV `  ! V!   R V n        . V n        V P                  V4       \        3V n        R # ©N)Úcompose_policyÚsuperÚ__init__Ú_transform_matrixÚ_transform_matricesÚ!_parse_transformation_matrix_moder   Ú$_valid_ops_for_transform_computation)Úselfr   r   ÚpoliciesÚ	__class__s   &&& €r$   r,   ÚPolicyAugmentBase.__init__E   sJ   ø€ Ø×&Ñ& vÓ.ˆÜ‰Ò˜(Ò#à9=ˆÔØACˆÔ Ø×.Ñ.Ð/IÔJÜFVÐEXˆÖ1r'   c                ó$   <€ V ^8„  d   QhRS[ RR/# )r   Úmoduler   Nr   )r"   r#   s   "€r$   r%   r&   N   s!   ø€ ÷ Añ AÑ<Lð AÐQUñ Ar'   c                óP   € V P                   P                  VP                  4       R # r)   )r.   ÚappendÚtransform_matrix)r1   r6   s   &&r$   Ú%_update_transform_matrix_for_valid_opÚ7PolicyAugmentBase._update_transform_matrix_for_valid_opN   s   € Ø× Ñ ×'Ñ'¨×(?Ñ(?Ö@r'   c                ó   <€ V ^8„  d   QhRR/# )r   r   N© )r"   r#   s   "€r$   r%   r&   Q   s   ø€ ÷ %ñ %˜Tñ %r'   c                ó@   <€ V P                  4        \        SV `	  4       # )z4Reset cached params and transformation-matrix state.)Ú_reset_transform_matrix_stater+   Úclear_state)r1   r3   s   &€r$   r@   ÚPolicyAugmentBase.clear_stateQ   s   ø€ à×*Ñ*Ô,Ü‰wÑ"Ó$Ð$r'   c                óF   <€ V ^8„  d   QhRS[ S[,          RS[ S[,          /# )r   r   r   )r   r    r   )r"   r#   s   "€r$   r%   r&   V   s+   ø€ ÷ Vñ V¡TÑ*:Õ%;ð VÁÑEUÕ@Vñ Vr'   c                óL   € V Uu. uF  q P                  V4      NK  	  up# u upi )z-Compose policy by the provided policy config.)Úcompose_subpolicy_sequential)r1   r   Ú	subpolicys   && r$   r*   Ú PolicyAugmentBase.compose_policyV   s#   € áNTÓUÉfÀ×1Ñ1°)Ö<ÉfÑUÐUùÒUs   …!c                ó&   <€ V ^8„  d   QhRS[ RS[/# )r   rE   r   )r    r   )r"   r#   s   "€r$   r%   r&   Z   s   ø€ ÷ 	"ñ 	"Ñ6Fð 	"ÑK[ñ 	"r'   c                ó   € \         h)zÒBuild a :class:`PolicySequential` from a single sub-policy spec.

Args:
    subpolicy: Sub-policy definition used by the concrete augmentation.

Returns:
    The sequential module representing that sub-policy.
)ÚNotImplementedError)r1   rE   s   &&r$   rD   Ú.PolicyAugmentBase.compose_subpolicy_sequentialZ   s
   € ô "Ð!r'   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# )r   Úinputr   )ÚtorchÚTensor)r"   r#   s   "€r$   r%   r&   e   s#   ø€ ÷ "ñ "¡U§\¡\ð "±e·l±lñ "r'   c                ó   € \        ^V4      # )zReturn identity matrix.r   )r1   rL   s   &&r$   Úidentity_matrixÚ!PolicyAugmentBase.identity_matrixe   s   € ä˜˜5Ó!Ð!r'   c                ó¶   <€ V ^8„  d   QhRS[ P                  RS[S[S[,          ,          RS[RS[S[S[S[3,          ,          RS[S[ P                  ,          /# )r   rL   ÚparamsÚ	recomputeÚ
extra_argsr   )	rM   rN   r   r   r   Úboolr   r!   r   )r"   r#   s   "€r$   r%   r&   i   s`   ø€ ÷ ñ á�|‰|ðñ ™™i�Õ)ðñ ð	ñ
 ™T¡#¡s (�^Õ,ðñ 
‘%—,‘,Õ	ñr'   c           	     ót  € Vf   \        R4      h\        WV4      pV P                  V4      pRp\        YRe   TM. 4       Ft  w  w  rxp	\	        \
        V4      p\        W„V	4      p
VP                  V\	        \        \        \        ,          ,          V	P                  4      W:R7      pVf   TMW¶,          pKv  	  V# )aj  Compute the transformation matrix according to the provided parameters.

Args:
    input: the input torch.Tensor.
    params: params for the sequence.
    recompute: if to recompute the transformation matrix according to the params.
        default: False.
    extra_args: Optional dictionary of extra arguments with specific options for different input types.

Nzrequires params to be provided.)rS   rT   rU   )rI   r   Úget_forward_sequenceÚzipr
   r   r   Úget_transformation_matrixr   r   r   Údata)r1   rL   rS   rT   rU   Únamed_modulesÚres_matÚ_r6   ÚparamÚ
child_argsÚmats   &&&&&       r$   rZ   Ú+PolicyAugmentBase.get_transformation_matrixi   s¸   € ð" Š>Ü%Ð&GÓHÐHÜ)¨$¸FÓCˆ
Ø9=×9RÑ9RÐSYÓ9Zˆð +/ˆÜ"% mÒ?Q±VÐWYÖ"ZÑ‰KˆQ˜ÜÔ*¨FÓ3ˆFÜ.¨vÀ5ÓIˆJØ×2Ñ2Øœd¤8¬D´­OÕ#<¸e¿j¹jÓIÐU^ð 3ó ˆCð %š_‘c°#µ-ŠGñ #[ð ˆr'   c                óF   <€ V ^8„  d   QhRS[ S[S[,          ,          RS[/# ©r   rS   r   )r   r   r   rV   )r"   r#   s   "€r$   r%   r&   Š   s$   ø€ ÷ ñ ©±±iµÕ(Að ÉTñ r'   c                ó�   € V P                  V4      pV F.  w  r4\        \        V4      pVP                  4       '       d   K-   R# 	  R# )záCheck whether all selected sub-policies are intensity-only.

Args:
    params: Optional parameters that define which sub-policies to inspect.

Returns:
    ``True`` if no geometric transform is selected, ``False`` otherwise.
FT)rX   r
   r   Úis_intensity_only)r1   rS   r\   r^   r6   s   &&   r$   rf   Ú#PolicyAugmentBase.is_intensity_onlyŠ   sE   € ð :>×9RÑ9RÐSYÓ9ZˆÛ&‰IˆAÜÔ*¨FÓ3ˆFØ×+Ñ+×-Ô-Úñ 'ñ r'   c                óF   <€ V ^8„  d   QhRS[ S[,          RS[ S[,          /# rd   )r   r   r!   )r"   r#   s   "€r$   r%   r&   š   s#   ø€ ÷ ñ ©$©y­/ð ¹dÁ3½iñ r'   c                ó–  € . p\        V P                  V4      V4       EF&  w  w  r4p\        \        V4      p\        \        \
        ,          VP                  4      p\        VP                  V4      V4       FÉ  w  w  r8p	\        \        V4      p\        VP                  \        4      '       d   K:  \        \        \        \        P                  3,          V	P                  4      P                  R4      p
V
e   V
P!                  4       '       g   Kš  VP#                  VP                  P$                  P&                  4       KË  	  EK)  	  V# )aC  Name every applied operation that :meth:`inverse` cannot undo.

An operation whose probability gate skipped every sample left the input untouched, so it does
not count.

Args:
    params: Parameters recorded by a forward pass.

Returns:
    Class names of the applied operations that are not geometric, in execution order.
Ú
batch_prob)rY   rX   r
   r   r   r   r[   r   Ú
isinstanceÚopr   r   r!   rM   rN   ÚgetÚanyr8   r3   Ú__name__)r1   rS   Únamesr^   r6   r_   rE   Ú	subparamsÚ	operationÚsubparamrj   s   &&         r$   Ú_non_invertible_opsÚ%PolicyAugmentBase._non_invertible_opsš   sõ   € ð ˆÜ"% d×&?Ñ&?ÀÓ&GÈ×"PÑ‰KˆQ˜ÜÔ-¨vÓ6ˆIÜœT¤)�_¨e¯j©jÓ9ˆIÜ,/°	×0NÑ0NÈyÓ0YÐ[dÖ,eÑ(‘� Ü ¤°	Ó:�	Ü˜iŸl™lÔ,G×HÒHÙÜ!¤$¤s¬E¯L©LÐ'8Õ"9¸8¿=¹=ÓI×MÑMÈlÓ[�
ØÒ)°*·.±.×2BÒ2BÙØ—‘˜YŸ\™\×3Ñ3×<Ñ<Ö=ô -fñ #Qð ˆr'   c          	      ó    <€ V ^8„  d   QhRS[ P                  RS[S[S[,          ,          RS[S[S[S[3,          ,          RS[ P                  /# ©r   rL   rS   rU   r   ©rM   rN   r   r   r   r   r!   r   )r"   r#   s   "€r$   r%   r&   ´   sV   ø€ ÷ Eñ EÙ—\‘\ðEÙ+3±D¹µOÕ+DðEÙYaÑbfÑgjÑloÐgoÕbpÕYqðEá	�‰ñEr'   c                óê   <€ Vf   V P                   pVeO   V P                  V4      pV'       d6   \        RV P                  P                   RRP                  V4       R24      h\        SV `  WVR7      # )aõ  Undo the drawn sub-policy, or refuse when it cannot be undone.

Only geometric operations are invertible. A policy draw that contains an intensity operation is
not round-trippable, and inverting it would return a tensor that still carries that operation --
for a draw with no geometry at all, the input unchanged. This raises instead, as ``inverse`` on
:class:`~kornia.augmentation.MixAugmentationBaseV2` already does for the mix classes.

Args:
    input: Tensor produced by a forward pass.
    params: Parameters used during that forward pass. Defaults to the cached ones.
    extra_args: Optional per-input-type overrides.

Returns:
    The inverse-transformed tensor.

Raises:
    RuntimeError: The drawn sub-policy contains a non-invertible operation.
zInverse for z0 is not supported: the drawn sub-policy applied z, zz, which cannot be inverted. Only geometric operations are invertible, and the sub-policy is redrawn on every forward pass.)rU   )Ú_paramsrt   ÚRuntimeErrorr3   ro   Újoinr+   Úinverse)r1   rL   rS   rU   Únon_invertibler3   s   &&&& €r$   r}   ÚPolicyAugmentBase.inverse´   s~   ø€ ð* Š>Ø—\‘\ˆFØÒØ!×5Ñ5°fÓ=ˆNßÜ"Ø" 4§>¡>×#:Ñ#:Ð";Ð;kØ—y‘y Ó0Ð1ð 2WðWóð ô
 ‰w‰˜u¸ˆÓDÐDr'   c                óJ   <€ V ^8„  d   QhRS[ P                  RS[S[,          /# )r   Úbatch_shaper   )rM   ÚSizer   r   )r"   r#   s   "€r$   r%   r&   Õ   s#   ø€ ÷ ñ ©e¯j©jð ¹TÁ)½_ñ r'   c                óº   € V P                  4       p. pV FB  w  rE\        \        V4      pVP                  V4      p\	        WF4      pVP                  V4       KD  	  V# )zÒGenerate per-module parameters for one policy forward pass.

Args:
    batch_shape: Input shape used to sample operation parameters.

Returns:
    Parameters for each selected child module, in execution order.
)rX   r
   r   Úforward_parametersr   r8   )r1   r�   r\   rS   Únamer6   Ú	mod_paramr_   s   &&      r$   r„   Ú$PolicyAugmentBase.forward_parametersÕ   s\   € ð :>×9RÑ9RÓ9Tˆà"$ˆã)‰LˆDÜœ-¨Ó0ˆFØ×1Ñ1°+Ó>ˆIÜ˜dÓ.ˆEØ�M‰M˜%Ö ñ	 *ð
 ˆr'   c          	      ó�   <€ V ^8„  d   QhRS[ P                  RS[S[,          RS[S[S[S[3,          ,          RS[ P                  /# rw   )rM   rN   r   r   r   r   r!   r   )r"   r#   s   "€r$   r%   r&   é   sK   ø€ ÷ ñ Ù—\‘\ðÙ+/±	­?ðÙHPÑQUÑVYÑ[^ÐV^ÕQ_ÕH`ðá	�‰ñr'   c                ó  € \        WV4      pV P                  4        V FG  pV P                  VP                  4      p\        P
                  ! WWCR7      pV P                  V4       KI  	  \        4       '       g   W n        V# )a­  Apply a prepared parameter list to the input tensor.

Resets the cached parameters and transformation matrix first, so a policy nested inside another
container ends up in the same state as after :meth:`forward` with these ``params``.

Args:
    input: Input tensor.
    params: Parameters produced by :meth:`forward_parameters`.
    extra_args: Optional overrides forwarded to child transforms.

Returns:
    Transformed tensor.
)r6   r_   rU   )	r   r@   Úget_submoduler…   r   Ú	transformÚ"_update_transform_matrix_by_moduler   rz   )r1   rL   rS   rU   r_   r6   s   &&&&  r$   Útransform_inputsÚ"PolicyAugmentBase.transform_inputsé   sm   € ô  *¨$¸FÓCˆ
Ø×ÑÔÛˆEØ×'Ñ'¨¯
©
Ó3ˆFÜ&×0Ò0°ÈUÔjˆEØ×3Ñ3°FÖ;ñ ô �~Š~Ø!ŒLØˆr'   c          	      ó    <€ V ^8„  d   QhRS[ P                  RS[S[S[,          ,          RS[S[S[S[3,          ,          RS[ P                  /# rw   rx   )r"   r#   s   "€r$   r%   r&     sV   ø€ ÷ Rñ RÙ—\‘\ðRÙ+3±D¹µOÕ+DðRÙYaÑbfÑgjÑloÐgoÕbpÕYqðRá	�‰ñRr'   c                ó|   € Vf'   V P                  VRR7      w  rEV P                  V4      pV P                  WVR7      # )a#  Apply the policy to ``input`` and cache the parameters used.

Args:
    input: Input tensor.
    params: Optional precomputed parameters. If omitted, parameters are
        sampled on-the-fly.
    extra_args: Optional overrides forwarded to child transforms.

Returns:
    Augmented tensor.
)Ú	dim_range)rS   rU   )r   é   )Úautofill_dimr„   r�   )r1   rL   rS   rU   r^   Ú	out_shapes   &&&&  r$   ÚforwardÚPolicyAugmentBase.forward  sF   € ð Š>Ø×,Ñ,¨U¸fÐ,ÓE‰LˆAØ×,Ñ,¨YÓ7ˆFà×$Ñ$ UÀjÐ$ÓQÐQr'   )rz   r.   r-   r0   )Úsilence)NFNr)   )NN)ro   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r,   r:   r@   r*   rD   rP   rZ   rf   rt   r}   r„   r�   r•   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r3   r#   s   @@r$   r   r   %   sž   ù‡ € ñ÷>Yõ Y÷Að A÷%ó %÷
Vð V÷	"ð 	"÷"ð "÷ò ÷Bò ÷ ð ÷4Eõ E÷Bð ÷(ò ÷4R÷ Rò Rr'   r   )%Útypingr   r   r   r   r   r   r	   r
   rM   r   Ú&kornia.augmentation._2d.geometric.baser   Ú(kornia.augmentation.auto.operations.baser   Ú*kornia.augmentation.auto.operations.policyr   Ú"kornia.augmentation.container.baser   r   Ú!kornia.augmentation.container.opsr   r   r   Ú$kornia.augmentation.container.paramsr   Úkornia.core.opsr   Úkornia.core.utilsr   ÚfloatÚintÚNUMBERr!   Ú	OP_CONFIGr    r   r=   r'   r$   Ú<module>r¬      st   ð÷$ K× JÓ Jã Ý å NÝ BÝ Gß Xß mÑ mÝ :Ý $Ý *à	ˆu�cˆzÕ	€Ø�#�v˜x¨Õ/Ð/Õ0€	Ø˜	•?Ð ôpRÐ+Ð-Aö pRr'   