+
    ýäûjzŒ  ã                   ó6  € ^ RI t ^ RIt^ RIHtHt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Ht ^ RIHt ^ RIH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& ^RI'H(t(H)t) R.t*Rt+ ! R R]4      t, ! R R]"],4      t-RR R llt.R# )é    N)
ÚAnyÚDictÚIteratorÚListÚLiteralÚOptionalÚSequenceÚTupleÚUnionÚcast)Únn)Ú_AugmentationBaseÚ_BasicAugmentationBase)Úoverride_parameters)ÚImageModule)ÚImageModuleMixIn©Úeye_like)Úis_exporting)Ú_side_to_image_size)ÚImageSequentialBaseÚ_chain_transform_matrices)Ú_filter_child_optionsÚ_validate_extra_args)Ú	ParamItemÚPatchParamItemÚImageSequentiala›  `random_apply` samples with replacement when the drawn count is above the sum of `random_apply_weights`, so children repeat although they could fill the count. This is deprecated since kornia 0.9.1: a future minor release stops these repeats, which changes what the call selects for a given seed and how often each child runs. Weights that sum to at least the largest count give that behavior now (kornia#6114).c                   ó’   a € ] tR t^0t o Rt]V 3R lR l4       t]P                  RV 3R lR ll4       tV 3R lR ltV 3R lt	R	t
V tR
# )ÚImageModuleForSequentialMixInFc                ó    <€ V ^8„  d   QhRS[ /# ©é   Úreturn©Úbool)ÚformatÚ__classdict__s   "€Ú_C:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\augmentation\container\image.pyÚ__annotate__Ú*ImageModuleForSequentialMixIn.__annotate__4   s   ø€ ÷ &ñ &¡$ñ &ó    c                ó   € V P                   # ©N)Ú_disable_features)Úselfs   &r(   Údisable_featuresÚ.ImageModuleForSequentialMixIn.disable_features3   s   € à×%Ñ%Ð%r+   c                ó$   <€ V ^8„  d   QhRS[ RR/# )r"   Úvaluer#   Nr$   )r&   r'   s   "€r(   r)   r*   8   s   ø€ ÷ &ñ &¡dð &°dñ &r+   c                ó4   € Wn         V'       d
   R V n        R # R # r-   ©r.   Ú_output_image)r/   r3   s   &&r(   r0   r1   7   s   € à!&ÔßØ!%ˆDÖñ r+   c                ó8   <€ V ^8„  d   QhRS[ P                  RR/# )r"   Úargsr#   N)r   ÚModule)r&   r'   s   "€r(   r)   r*   =   s   ø€ ÷ ,ñ ,©2¯9©9ð ,¸ñ ,r+   c                óV   € V F"  p\        V\        4      '       g   K  R Vn        K$  	  R# )TN)Ú
isinstancer   r0   )r/   r8   Úargs   &* r(   Údisable_item_featuresÚ3ImageModuleForSequentialMixIn.disable_item_features=   s!   € ÛˆCÜ˜#œ{×+Ô+Ø'+�Ö$ó r+   c                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # )r"   r.   r$   )r&   r'   s   "€r(   r)   r*   0   s   ø‡ ‚ ÙÑ#ò r+   r5   N©T)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r.   Úpropertyr0   Úsetterr=   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__)r'   s   @r(   r   r   0   sM   ø‡ € Ø#Ðà÷&ó ð&ð ×Ñ÷&ñ &ó ð&÷
,ð ,÷ ƒ r+   r   c                   ól  a a€ ] tR t^Ct oRtRRRRRRRRRR	R
RR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R ltR+V3R l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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V 3R" llltR+V3R# lR$ lltR%RR&R'/V3R( lV 3R) llltR*tVtV ;t# ).r   a/  Chain image augmentations and image-processing modules on one image tensor.

``output = ImageSequential(*modules)(input)`` runs selected children on an image tensor and stores their order and
sampled Kornia augmentation parameters in ``_params`` for replay. Ordinary ``nn.Module`` children also run,
but their internal randomness is not recorded; use :class:`~kornia.augmentation.container.AugmentationSequential`
when masks, boxes or keypoints must receive the matching geometric transform.

See the Convention block on :class:`~kornia.augmentation.AugmentationBase2D`.

Args:
    *args : a list of kornia augmentation and image operation modules.
    same_on_batch: apply the same transformation across the batch.
        If None, it will not overwrite the function-wise settings.
    keepdim: whether to keep the output shape the same as input (True) or broadcast it
        to the batch form (False). If None, it will not overwrite the function-wise settings.
    random_apply: randomly select children to apply in random order. The selection probability aligns to the
        ``random_apply_weights``. Selections repeat when the requested count is larger than the number of children
        that can be drawn: the children with a nonzero weight, mix augmentations not counted, plus one place when
        the count and the mix augmentations together reach the number of children, since a mix augmentation is then
        certain to take a place. With only mix children one of them is drawn, and with all weights 0 and no mix
        child nothing is.
        An int or a range that is not fixed to the number of children also repeats when the drawn count is larger
        than the sum of the weights. That rule is deprecated since kornia 0.9.1: the calls whose draw it changes
        emit a ``FutureWarning``, and a future minor release stops them repeating, which changes what they select
        for a given seed and how often each child runs. Weights that sum to at least the largest count give the
        future behavior now.
        If int, a fixed number of transformations will be selected.
        If (a,), x number of transformations (a <= x <= len(args)) will be selected.
        If (a, b), x number of transformations (a <= x <= b) will be selected.
        If True, the whole list of args will be processed as a sequence in a random order, whatever the scale of
        the weights, and so will a count fixed to the number of children. With a non-mix child of weight 0 or more
        than one mix augmentation, that count cannot be filled: children repeat and some may be left out.
        If False, the whole list of args will be processed as a sequence in original order.
    random_apply_weights: a one-dimensional sequence or tensor of selection weights for each operation. The
        length shall be as same as the number of operations. Multiplying the weights by a constant does not change
        the selection probabilities; it changes whether selections repeat only through the deprecated rule of
        ``random_apply``. Integer and boolean weights are converted to floating point. By default, operations are
        sampled uniformly.
    if_unsupported_ops: what ``inverse`` does on reaching a plain ``nn.Module``, which has no inverse:
        ``'raise'`` raises ``NotImplementedError`` naming it, before anything is inverted, and ``'skip'``
        leaves it applied and inverts the other members. Any other value raises ``ValueError``.

Convention:
    - this container takes image tensors only. It has no ``data_keys``, so masks, boxes and keypoints go
      through :class:`~kornia.augmentation.container.AugmentationSequential` instead. It also carries no
      ``.transform_matrix`` attribute: the chained matrix is reachable through
      ``get_transformation_matrix``, which needs the recorded ``params=`` handed back to it. To use params
      from an older call, pass ``recompute=True``.
    - any ``nn.Module`` may sit in the chain next to the augmentations -- the modules of
      ``kornia.filters``, ``kornia.color`` and ``kornia.enhance`` among them. ``random_apply``
      samples ordinary members and mix augmentations through separate paths; a mix member's insertion
      does not honor its ordinary selection weight. Each selected member is recorded in ``_params``, but
      a plain module records a ``None`` payload: only augmentation members carry a parameter draw to replay.
    - ``inverse`` treats a plain ``nn.Module`` member according to ``if_unsupported_ops``, and a nested
      container according to its own setting. Augmentation children can still raise, for example a 3D
      geometric augmentation, while intensity and non-rigid augmentation children are left applied; the round
      trip is not in general the input.

.. note::
    Transformation matrix returned only considers the transformation applied in ``kornia.augmentation`` module.
    Those transformations in ``kornia.geometry`` will not be taken into account.

Note:
    The output cache retains a detached reference to the last tensor output and is omitted when pickled.
    Setting ``disable_features = True`` clears it.

See Also:
    - :class:`~kornia.augmentation.container.AugmentationSequential`: also transforms aligned masks and annotations.
    - :class:`~kornia.augmentation.container.PatchSequential`: runs transforms on a regular patch grid.
    - :class:`~kornia.augmentation.container.VideoSequential`: runs transforms on videos.
    - :class:`~kornia.core.ImageSequential`: the core container of the same name, which records no parameters to
      replay and adds a ``to_onnx`` export.

Examples:
    >>> _ = torch.manual_seed(77)
    >>> import kornia
    >>> input = torch.randn(2, 3, 5, 6)
    >>> aug_list = ImageSequential(
    ...     kornia.color.BgrToRgb(),
    ...     kornia.augmentation.ColorJiggle(0.1, 0.1, 0.1, 0.1, p=1.0),
    ...     kornia.filters.MedianBlur((3, 3)),
    ...     kornia.augmentation.RandomAffine(360, p=1.0),
    ...     kornia.enhance.Invert(),
    ...     kornia.augmentation.RandomMixUpV2(p=1.0),
    ...     same_on_batch=True,
    ...     random_apply=10,
    ... )
    >>> out = aug_list(input)
    >>> out.shape
    torch.Size([2, 3, 5, 6])

    Reproduce with provided params.
    >>> out2 = aug_list(input, params=aug_list._params)
    >>> torch.equal(out, out2)
    True

Perform ``OneOf`` transformation with ``random_apply=1`` and ``random_apply_weights`` in ``ImageSequential``.

    >>> import kornia
    >>> input = torch.randn(2, 3, 5, 6)
    >>> aug_list = ImageSequential(
    ...     kornia.color.BgrToRgb(),
    ...     kornia.augmentation.ColorJiggle(0.1, 0.1, 0.1, 0.1, p=1.0),
    ...     kornia.filters.MedianBlur((3, 3)),
    ...     kornia.augmentation.RandomAffine(360, p=1.0),
    ...     random_apply=1,
    ...     random_apply_weights=[0.5, 0.3, 0.2, 0.5]
    ... )
    >>> out= aug_list(input)
    >>> out.shape
    torch.Size([2, 3, 5, 6])

Úsame_on_batchNÚkeepdimÚrandom_applyFÚrandom_apply_weightsÚif_unsupported_opsÚraiser=   TÚdisable_sequential_featuresc                óü   <€ V ^8„  d   QhRS[ P                  RS[S[,          RS[S[,          RS[S[S[S[S[S[3,          3,          RS[S[S[S[,          S[	P                  3,          ,          RS[RS[RS[R	R
/	# )r"   r8   rK   rL   rM   rN   rO   r=   rQ   r#   N)r   r9   r   r%   r   Úintr
   r	   ÚfloatÚtorchÚTensorÚstr)r&   r'   s   "€r(   r)   ÚImageSequential.__annotate__¶   sœ   ø€ ÷ ""ñ ""á�y‰yð""ñ  ¡•~ð""ñ ™$•ð	""ñ
 ™C¡¡u©S±#¨X¥Ð6Õ7ð""ñ '¡u©X±e­_¹e¿l¹lÐ-JÕ'KÕLð""ñ  ð""ñ  $ð""ñ &*ð""ð 
ñ""r+   c               óä  <€ VR
9  d   \        RV: R24      hV'       d   V P                  ! V!   V'       d   RV n        \        S
V `  ! VRVRV/  V P                  V\        V4      4      V n        Ve>   \        V4      \        V 4      8w  d%   \        R\        V4       R\        V 4       R24      hVe   \        P                  ! V4      M\        P                  ! \        V 4      4      p	V	P                  4       ^8w  d#   \        R	\        V	P                  4       R24      hV	P                  4       '       g%   V	P                  \        P                   ! 4       4      p	W�n        WPn        RV n        R# )rP   z;`if_unsupported_ops` must be either `raise` or `skip`. Got Ú.TrK   rL   NzUThe length of `random_apply_weights` must be as same as the number of operations.Got z and z:`random_apply_weights` must be one-dimensional. Got shape )rP   Úskip)Ú
ValueErrorr=   r0   ÚsuperÚ__init__Ú_read_random_applyÚlenrM   rU   Ú	as_tensorÚonesÚdimÚtupleÚshapeÚis_floating_pointÚtoÚget_default_dtyperN   rO   r6   )r/   rK   rL   rM   rN   rO   r=   rQ   r8   ÚweightsÚ	__class__s   &$$$$$$$* €r(   r^   ÚImageSequential.__init__¶   sR  ø€ ð Ð%6Ô6ÜÐZÐ[mÑZpÐpqÐrÓsÐsß Ø×&Ò&¨Ò-ß&Ø$(ˆDÔ!Ü‰Ò˜$ÐM¨mÐMÀWÒMà ×3Ñ3°LÄ#ÀdÃ)ÓLˆÔØÒ+´Ð4HÓ0IÌSÐQUËYÔ0VÜðÜÐ/Ó0Ð1°´s¸4³y°kÀðDóð ð <PÒ;[”%—/’/Ð"6Ô7Ôaf×akÒakÔloÐptÓluÓavˆØ�;‰;‹=˜AÔÜÐYÔZ_Ð`g×`mÑ`mÓZnÐYoÐopÐqÓrÐrØ×(Ñ(×*Ò*Ø—j‘j¤×!8Ò!8Ó!:Ó;ˆGØ$+Ô!Ø"4ÔØ!ˆÖr+   c                ó6   <€ V ^8„  d   QhRS[ S[S[3,          /# r!   )ÚdictrW   r   )r&   r'   s   "€r(   r)   rX   Ú   s   ø€ ÷ ñ ™d¡3© 8�nñ r+   c                óH   <€ \         SV `  4       pVP                  R R4       V# )r6   N)r]   Ú__getstate__Úpop)r/   Ústaterj   s   & €r(   ro   ÚImageSequential.__getstate__Ú   s#   ø€ Ü‘Ñ$Ó&ˆØ�	‰	�/ 4Ô(Øˆr+   c          	      óˆ   <€ V ^8„  d   QhRS[ S[S[S[S[S[3,          3,          RS[RS[ S[S[S[3,          S[3,          /# )r"   rM   Ú
max_lengthr#   )r   rS   r%   r
   )r&   r'   s   "€r(   r)   rX   ß   sK   ø€ ÷ $ñ $Ù!¡#¡t©U±3¹°8­_Ð"<Õ=ð$ÙKNð$á	‰u‘S™#�X�¡Ð$Õ	%ñ$r+   c                óô  € Tp\        V\        4      '       d   VRJ d   RpEM(\        V\        4      '       d   VRJ d   W"^,           3pEM \        V\        4      '       d   W^,           3pMß\        V\        4      '       de   \	        V4      ^8X  dU   \        V^ ,          \        4      '       d8   \        V^,          \        4      '       d   V^ ,          V^,          ^,           3pMe\        V\        4      '       dA   \	        V4      ^8X  d1   \        V^ ,          \        4      '       d   V^ ,          V^,           3pM\        RV R24      hVRJdp   \        V\        4      '       dK   \	        V4      ^8X  d;   \        V^ ,          \        4      '       d   \        V^,          \        4      '       g   \        RV R24      hVRJd3   V^ ,          ^ 8  g   V^,          V^ ,          8:  d   \        RV R24      hV# )z'Process the scenarios for random apply.FTzNon-readable random_apply. Got rZ   z"Expect a tuple of (int, int). Got zurandom_apply must select a non-negative number of transformations, with the lower bound not above the upper one. Got )r;   r%   rS   rd   r`   r\   ÚAssertionError)r/   rM   rt   Ú	requesteds   &&& r(   r_   Ú"ImageSequential._read_random_applyß   sª  € ð !ˆ	Ü�l¤D×)Ò)¨l¸eÓ.CØ ŠLÜ˜¤d×+Ò+°ÀÓ0DØ&°Q­Ð7ŠLÜ˜¤c×*Ò*Ø(¸Õ*:Ð;‰Lä�|¤U×+Ò+Ü�LÓ! QÔ&Ü˜<¨�?¬C×0Ò0Ü˜<¨�?¬C×0Ò0à(¨�O¨\¸!­_¸qÕ-@ÐA‰LÜ˜¤e×,Ò,´°\Ó1BÀaÔ1GÌJÐWcÐdeÕWfÔhk×LlÒLlØ(¨�O¨Z¸!­^Ð<‰LäÐ>¸|¸nÈAÐNÓOÐOØ˜uÓ$Ü�|¤U×+Ò+Ü�LÓ! QÔ&Ü˜<¨�?¬C×0Ò0Ü˜<¨�?¬C×0Ò0ä Ð#EÀlÀ^ÐSTÐ!UÓVÐVð ˜uÓ$¨,°q­/¸AÔ*=ÀÈaÅÐT`ÐabÕTcÔAcÜð&Ø&/ [°ð3óð ð Ðr+   c                óv   <€ V ^8„  d   QhRS[ RS[S[S[S[S[P
                  3,          ,          S[ 3,          /# )r"   Úwith_mixr#   )r%   r
   r   rW   r   r9   )r&   r'   s   "€r(   r)   rX     sF   ø€ ÷ F@ñ F@±Dð F@ÁEÉ(ÑSXÑY\Ñ^`×^gÑ^gÐYgÕShÕJiÑkoÐJoÕDpñ F@r+   c                ó„  € \        V P                  \        4      '       d<   \        \        P
                  ! . V P                  ORN5!  P                  4       4      pM!\        R\        V P                  4       24      hV P                  P                  4       pV P                  V P                  4       4      p^ W4&   VP                  4       P                  4       p\        \        P                  ! V4      P                  4       4      pV'       d   \        V4      M^ p\        V^ 8g  ;'       d    Wr,           \        V 4      8¬  4      pW&V,           8„  p	V P                  \        V 4      \        V 4      ^,           38w  d,   T	;'       g    W%8„  p	V P!                  V P                  WVV4       V^ 8X  g   V^ 8X  d5   ^ p
\        P"                  ! . VP$                  \        P&                  R7      pM/Tp
V	'       d   TM
\)        W&4      p\        P*                  ! W<V	R7      pRpV'       Ed   V^ 8”  Ed   \        V4      ^ 8w  dö   \        P,                  ! ^4      \        V4      V
,           \        V 4      ,          8  P                  4       '       d©   \        P.                  ! V\        P0                  R7      pRWä&   \        P*                  ! V^4      p\        V4      ^ 8X  d   TpM,\        V4      V
8  d   \        P2                  ! W¿.4      pMWûR	&   V\        P4                  ! \        V4      4      ,          pRpV P7                  V4      V3# )
a‰  Get a forward sequence when random apply is in need.

Whether the draw samples with replacement follows the ``random_apply`` argument's description, including its
deprecated rule for counts above the sum of the weights.

Args:
    with_mix: if to require a mix augmentation for the sequence.

Note:
    Mix augmentations (e.g. RandomMixUp) will be only applied once even in a random forward.

z$random apply should be a tuple. Got ©ÚdeviceÚdtype)ÚreplacementF)r~   ç      ð?T)é   éÿÿÿÿ)r;   rM   rd   rS   rU   ÚrandintÚitemÚ	TypeErrorÚtyperN   ÚcloneÚget_mix_augmentation_indicesÚnamed_childrenÚsumÚcount_nonzeror`   Ú _warn_if_sum_rule_changes_a_drawÚtensorr}   ÚlongÚminÚmultinomialÚrandÚ
zeros_likeÚfloat32ÚcatÚrandpermÚget_children_by_indices)r/   rz   Únum_samplesÚmultinomial_weightsÚmix_indicesÚtotal_weightÚnum_nonzeroÚnum_mixÚ	mix_placer   ÚcountÚindicesÚdrawnÚ	mix_addedÚmix_maskÚmix_idxs   &&              r(   Úget_random_forward_sequenceÚ+ImageSequential.get_random_forward_sequence  sš  € ô �d×'Ñ'¬×/Ò/ÜœeŸmšmÐE¨T×->Ñ->ÐEÀÓE×JÑJÓLÓM‰KäÐBÄ4È×HYÑHYÓCZÐB[Ð\Ó]Ð]à"×7Ñ7×=Ñ=Ó?Ðà×7Ñ7¸×8KÑ8KÓ8MÓNˆà+,ÐÑ(à*×.Ñ.Ó0×5Ñ5Ó7ˆô œ%×-Ò-Ð.AÓB×GÑGÓIÓJˆß&.”#�kÔ"°AˆÜ˜ 1™×KÐK¨Õ)>Ä#ÀdÃ)Ñ)KÓLˆ	Ø!°)Õ$;Ñ;ˆð
 ×Ñ¤ T£¬C°«I¸­MÐ :Ô:Ø%×CÐC¨Ñ)CˆKØ×1Ñ1°$×2CÑ2CÀ\Ð`gÔhà˜1Ô ¨qÔ 0ØˆEÜ—l’l 2Ð.A×.HÑ.HÔPU×PZÑPZÔ[‰GàˆEß#.‘K´C¸Ó4QˆEÜ×'Ò'Ð(;ÐP[Ô\ˆGàˆ	÷ ˆHØ˜a•Ü�KÓ  AÔ%Ü—’˜A“¤3 {Ó#3°eÕ#;¼sÀ4»yÕ"HÑI×OÑO×QÒQô ×'Ò'Ð(;Ä5Ç=Á=ÔQˆHØ$'ˆHÑ!Ü×'Ò'¨°!Ó4ˆGÜ�7‹|˜qÔ Ø!‘Ü�W“ Ô%ÜŸ)š) WÐ$6Ó7‘à%˜‘ØœeŸnšn¬S°«\Ó:Õ;ˆGØˆIà×+Ñ+¨GÓ4°iÐ?Ð?r+   c          
      óL   <€ V ^8„  d   QhRS[ S[S[3,          RS[RS[RS[RR/# )r"   Úcount_rangerš   r›   rœ   r#   N)r
   rS   rT   )r&   r'   s   "€r(   r)   rX   M  sD   ø€ ÷ Wñ WÙ ¡¡c �?ðWÙ:?ðWÙNQðWÙ\_ðWà	ñWr+   c                óB  € T\        V^ 8g  ;'       d    WC,           ^,           \        V 4      8¬  4      ,           p\        V^,          ^,
          V4      pV^ 8w  dF   Wb8”  d>   V\        V^ ,          ^4      8¼  d$   \        P
                  ! \        \        ^R7       R# R# R# R# )aW  Warn if ``count_range``, with its exclusive end, holds a count whose draw the deprecated sum rule changes.

The rule changes a drawn count above ``total_weight`` that the members can fill without repeating. Those counts
run up to ``num_nonzero``, plus one when the certain mix place is open at that count, so the largest one in the
range decides. A count of 1 does not change, since ``torch.multinomial`` draws it the same way with and without
replacement, and neither do all-zero weights, which skip the draw. The whole range warns and not only the count
drawn in this call: a seeded run moves at the first draw of such a count.

This takes a few comparisons of values the draw has already read: no host conversion and no random number, so
the unaffected path keeps its draw. The message is a constant, so the default filter prints it once per
location.
)Ú
stacklevelN)rS   r`   r�   ÚmaxÚwarningsÚwarnÚ_RANDOM_APPLY_SUM_RULE_MESSAGEÚFutureWarning)r/   r§   rš   r›   rœ   ÚdrawableÚchanges_up_tos   &&&&&  r(   rŒ   Ú0ImageSequential._warn_if_sum_rule_changes_a_drawM  s‹   € ð ¤ W°¡\×%\Ð%\°gÕ6KÈaÕ6OÔSVÐW[ÓS\Ñ6\Ó!]Õ]ˆÜ˜K¨�N¨QÕ.°Ó9ˆØ˜1Ô Ô!=À-ÔSVÐWbÐcdÕWeÐghÓSiÔBiÜ�MŠMÔ8¼-ÐTU×Vñ CjÑ!=Ñr+   c                óp   <€ V ^8„  d   QhRS[ S[S[S[P                  3,          ,          RS[S[,          /# )r"   Únamed_modulesr#   )r   r
   rW   r   r9   r   rS   )r&   r'   s   "€r(   r)   rX   a  s8   ø€ ÷ sñ s¹(Á5ÉÉbÏiÉiÈÕCXÕ:Yð sÑ^bÑcfÕ^gñ sr+   c           	     óœ   € \        V4       UUUu. uF,  w  pw  r4\        V\        P                  4      '       g   K*  VNK.  	  uppp# u upppi )zzGet all the mix augmentations since they are label-involved.

Special operations needed for label-involved augmentations.
)Ú	enumerater;   ÚKÚMixAugmentationBaseV2)r/   r³   ÚidxÚ_Úchilds   &&   r(   rˆ   Ú,ImageSequential.get_mix_augmentation_indicesa  s<   € ô ,5°]Ô+CÕrÑ+C™˜™Z˜aÄzÐRWÔYZ×YpÑYp×Gq—�Ñ+CÓrÐrùÔrs
   �'A¼Ac                ó€   <€ V ^8„  d   QhRS[ S[S[,          ,          RS[S[S[S[P                  3,          ,          /# )r"   Úparamsr#   )r   r   r   r   r
   rW   r   r9   )r&   r'   s   "€r(   r)   rX   i  s=   ø€ ÷ 3ñ 3©8±D¹µOÕ+Dð 3ÑPXÑY^Ñ_bÑdf×dmÑdmÐ_mÕYnÕPoñ 3r+   c                ó,  € Vf�   V P                  V P                  4       4      pV P                  '       d   V P                  4       ^ ,          # \	        V4      ^8”  d   \        R\	        V4       R24      hV P                  4       # V P                  V4      # )aR  Return the module sequence used for the current forward call.

Args:
    params: Optional recorded parameters. When provided, the sequence is
        reconstructed from them.

Returns:
    Iterator of ``(name, module)`` pairs.

Raises:
    ValueError: More than one mix augmentation is present while
        ``random_apply`` is disabled.
zOMultiple mix augmentation is prohibited without enabling random_apply.Detected z mix augmentations.)rˆ   r‰   rM   r¤   r`   r\   Úget_children_by_params)r/   r½   r™   s   && r(   Úget_forward_sequenceÚ$ImageSequential.get_forward_sequencei  s—   € ð Š>à×;Ñ;¸D×<OÑ<OÓ<QÓRˆKà× × Ð Ø×7Ñ7Ó9¸!Õ<Ð<ä�;Ó !Ô#Ü ð Ü # KÓ 0Ð1Ð1DðFóð ð
 ×&Ñ&Ó(Ð(à×*Ñ*¨6Ó2Ð2r+   c                óJ   <€ V ^8„  d   QhRS[ P                  RS[S[,          /# )r"   Úbatch_shaper#   )rU   ÚSizer   r   )r&   r'   s   "€r(   r)   rX   ˆ  s#   ø€ ÷ ñ ©e¯j©jð ¹TÁ)½_ñ r+   c                ó"  € V P                  4       p. pV Fv  w  rE\        V\        \        P                  \
        34      '       d   VP                  V4      p\        WF4      pM\        VR4      p\        WqV4      pVP                  V4       Kx  	  V# )z¦Generate parameters for all modules in the chosen sequence.

Args:
    batch_shape: Input batch shape.

Returns:
    Parameter list aligned with the execution order.
N)
rÀ   r;   r   r¶   r·   r   Úforward_parametersr   Ú_get_new_batch_shapeÚappend)r/   rÃ   r³   r½   ÚnameÚmoduleÚ	mod_paramÚparams   &&      r(   rÆ   Ú"ImageSequential.forward_parametersˆ  s„   € ð :>×9RÑ9RÓ9Tˆà"$ˆã)‰LˆDÜ˜&Ô#4´a×6MÑ6MÔObÐ"c×dÒdØ"×5Ñ5°kÓB�	Ü! $Ó2‘ä! $¨Ó-�Ü.¨uÀ6ÓJˆKØ�M‰M˜%Ö ñ *ð ˆr+   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# )r"   Úinputr#   )rU   rV   )r&   r'   s   "€r(   r)   rX   Ÿ  s#   ø€ ÷ "ñ "¡U§\¡\ð "±e·l±lñ "r+   c                ó   € \        ^V4      # )zReturn identity matrix.r   )r/   rÏ   s   &&r(   Úidentity_matrixÚImageSequential.identity_matrixŸ  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"   rÏ   r½   Ú	recomputeÚ
extra_argsr#   )	rU   rV   r   r   r   r%   r   rW   r   )r&   r'   s   "€r(   r)   rX   £  s`   ø€ ÷ >ñ >á�|‰|ð>ñ ™™i�Õ)ð>ñ ð	>ñ
 ™T¡#¡s (�^Õ,ð>ñ 
‘%—,‘,Õ	ñ>r+   c                óJ  € Vf   \        R4      h\        WV4      pV P                  V4      pRp\        YRe   TM. 4       EFL  w  w  rxp	\	        W„V	4      p
\        V\        P                  4      '       Ed.   \        V	P                  \        4      '       Ed   VP                  p VP                  V4      pV'       d6   \        VP                  V
RR7      pVP                  WP                  V4      pMTVP                   e9   \"        P$                  ! VP                   VP&                  VP(                  R7      pM\+        V R24      hVf   TM
\-        WÖ4      pVP/                  W4      pVP0                  '       d'   W±P                  8w  d   VP3                  4       pEK]  EK`  EKc  \        V\4        4      '       g   EK|  \        V\        P6                  4      '       dF   V'       g>   VP                   pVe-   \"        P$                  ! WáP&                  VP(                  R7      pMC\9        \:        \<        \>        ,          ,          V	P                  4      pVPA                  WW:R7      pVf   VPC                  V4      MTpVf   TM
\-        WÖ4      pEKO  	  V#   \         d     ELìi ; i)a'  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.

Returns:
    the chained matrix, or ``None`` if no geometric module contributes one. In a caller's autocast region it
    keeps the input's dtype, and float32 input is computed in float32.
Nzrequires params to be provided.F)Úin_placer|   z3._transform_matrix is None while `recompute=False`.)rÔ   rÕ   )"ÚNotImplementedErrorr   rÀ   Úzipr   r;   r¶   ÚGeometricAugmentationBase2DÚdatarm   re   Útransform_tensorr\   r   ÚflagsÚgenerate_transformation_matrixÚtransform_matrixrU   ra   r}   r~   ÚRuntimeErrorr   Útransform_output_tensorrL   Úsqueezer   ÚAugmentationSequentialr   r   r   r   Úget_transformation_matrixrÑ   )r/   rÏ   r½   rÔ   rÕ   r³   Úres_matr¹   rÊ   rÌ   Ú
child_argsÚ	ori_shaperÝ   ÚmatÚ_matÚmaybe_param_datas   &&&&&           r(   rä   Ú)ImageSequential.get_transformation_matrix£  s,  € ð( Š>Ü%Ð&GÓHÐHÜ)¨$¸FÓCˆ
Ø9=×9RÑ9RÐSYÓ9Zˆð +/ˆÜ"% mÒ?Q±VÐWY×"ZÑ‰KˆQ˜Ü.¨vÀ5ÓIˆJÜ˜&¤!×"?Ñ"?×@Ó@ÄZÐPU×PZÑPZÔ\`×EaÓEaØ!ŸK™K�	ðØ"×3Ñ3°EÓ:�E÷ Ü/°·±¸jÐSXÔY�EØ ×?Ñ?ÀÇzÁzÐSXÓY‘CØ×,Ñ,Ò8ÜŸ/š/¨&×*AÑ*AÈ%Ï,É,Ð^c×^iÑ^iÔj‘Cä&¨&¨Ð1dÐ'eÓfÐfØ!(¢™#Ô6OÐPSÓ6]�Ø×6Ñ6°uÓH�Ø—>—>�> i·;±;Ô&>Ø%Ÿo™oÓ/“Gò '?’>ä˜FÔ$7×8Õ8ä˜f¤a×&>Ñ&>×?Ò?Ï	Ø!×2Ñ2�DØÒ'Ü$Ÿš¨t¿L¹LÐPU×P[ÑP[Ô\˜øä'+¬H´T¼)µ_Õ,EÀuÇzÁzÓ'RÐ$Ø!×;Ñ;Ø¸9ð <ó �Dð 8<²|�f×,Ñ,¨UÔ3È�Ø!(¢™#Ô6OÐPSÓ6]“ñE #[ðF ˆøô7 "ô Úðús   Â$JÊJ"Ê!J"c          	      ó�   <€ V ^8„  d   QhRS[ P                  RS[S[,          RS[S[S[S[3,          ,          RS[ P                  /# )r"   rÏ   r½   rÕ   r#   )rU   rV   r   r   r   r   rW   r   )r&   r'   s   "€r(   r)   rX   ã  sQ   ø€ ÷ Lñ LÙ—\‘\ðLÙ+/±	­?ðLÙHPÑQUÑVYÑ[^ÐV^ÕQ_ÕH`ðLá	�‰ñLr+   c           	     óF  <€ V P                   R8X  d€   \        \        \        P                  P
                  P                  3pV P                  V4       F;  w  rV\        Wd4      '       d   K  \        RV R\        V4      P                   R24      h	  \        SV `5  WVR7      # )aª  Apply inverse transforms for an input tensor.

Args:
    input: Tensor produced by :meth:`transform_inputs`.
    params: Parameters used during forward execution.
    extra_args: Optional per-input-type overrides.

Returns:
    Tensor mapped back through inverse operations.

Raises:
    NotImplementedError: if ``if_unsupported_ops`` is ``'raise'`` and ``params`` records a plain
        ``nn.Module``, which has no inverse.
rP   zCannot invert `z` (zŸ): a plain `nn.Module` has no inverse, so the result would keep it applied. Pass `if_unsupported_ops='skip'` to invert the other members and leave it in place.)rÕ   )rO   r   r   r¶   ÚautoÚ
operationsÚOperationBaserÀ   r;   rØ   r†   rA   r]   Úinverse_inputs)r/   rÏ   r½   rÕ   Ú
invertiblerÉ   rÊ   rj   s   &&&&   €r(   rñ   ÚImageSequential.inverse_inputsã  sš   ø€ ð" ×"Ñ" gÔ-ä0Ô2EÄqÇvÁv×GXÑGX×GfÑGfÐgˆJØ $× 9Ñ 9¸&Ö A‘�Ü! &×5Ô5Ü-Ø)¨$¨¨s´4¸³<×3HÑ3HÐ2Ið J?ð ?óð ñ !Bô ‰wÑ% eÀ
Ð%ÓKÐKr+   c                ó&   <€ V ^8„  d   QhRS[ RS[ /# )r"   Ústrictr#   r$   )r&   r'   s   "€r(   r)   rX     s   ø€ ÷ ñ ©ð ¹ñ r+   c                óò   € V P                  4        Fb  p\        V\        4      '       d   VP                  V4      '       g    R# K5  V'       g   K?  \        V\        P
                  4      '       d   Ka   R# 	  R# )ag  Check if all transformations are intensity-based.

Args:
    strict: if strict is False, it will allow non-augmentation Modules to be passed.
        e.g. `kornia.enhance.AdjustBrightness` will be recognized as non-intensity module
        if strict is set to True.

Note: patch processing would break the continuity of labels (e.g. bbounding boxes, masks).

FT)Úchildrenr;   r   Úis_intensity_onlyr¶   ÚIntensityAugmentationBase2D)r/   rõ   r<   s   && r(   rø   Ú!ImageSequential.is_intensity_only  s[   € ð —=‘=–?ˆCÜ˜#œ×/Ò/Ø×,Ñ,¨V×4Ò4Ú ñ 5ç‘¤
¨3´×0MÑ0M× NÔ Nò ñ #ñ r+   Úinput_names_to_handleÚoutput_typeÚptc          
      óf   <€ V ^8„  d   QhRS[ RS[S[S[ ,          ,          RS[R,          RS[ RS[ /# )r"   Úinputsrû   rü   Úkwargsr#   )rý   ÚnumpyÚpil)r   r   r   r   )r&   r'   s   "€r(   r)   rX     sL   ø€ ÷ !ñ !áð!ñ  (©©S­	Õ2ð!ñ Ð1Õ2ð	!ñ
 ð!ñ 
ñ!r+   c          	     ó(  <€ V P                   '       go   V P                  V4       V P                  \        SV `  W4VRV P
                  R7      pV P                  V P                  VR4      R4       V P                  WR4      pV# \        SV `  ! V/ VB pV# )aö  Overwrite the __call__ function to handle various inputs.

Args:
    inputs: Inputs to operate on.
    input_names_to_handle: List of input names to convert.
        If None, convert every tensor, NumPy array and PIL image argument, and load a string as an image
        path only if it is the first positional argument.
    output_type: Desired output type ('pt', 'numpy', or 'pil').
    kwargs: Additional arguments.

Returns:
    Callable: Decorated function with converted input and output types.

rý   )Úsignature_source)r.   Ú_check_output_typeÚ_call_convertedr]   Ú__call__ÚforwardÚ_store_output_imageÚ_convert_output)r/   rû   rü   rÿ   r   Útensor_outputr6   rj   s   &$$*,  €r(   r  ÚImageSequential.__call__  s¢   ø€ ð, ×%×%Ð%Ø×#Ñ# KÔ0ð !×0Ñ0Ü‘Ñ  &Ð2GÈÐ`d×`lÑ`lð 1ó ˆMð ×$Ñ$ T×%9Ñ%9¸-ÈÓ%NÐPTÔUØ ×0Ñ0°ÓLˆMð Ðô "™GÒ,¨fÐ?¸Ñ?ˆMØÐr+   )r6   r0   rO   rM   rN   r@   r-   )NFN)rA   rB   rC   rD   Ú__doc__r^   ro   r_   r¤   rŒ   rˆ   rÀ   rÆ   rÑ   rä   rñ   rø   r  rH   rI   Ú__classcell__)rj   r'   s   @@r(   r   r   C   sþ   ù‡ € ñpðd""ð )-ð""ð #'ð	""ð
 ;@ð""ð PTð""ð #*ð""ð '+ð""ð -2÷""õ ""÷Hó ÷
$ð $÷LF@ò F@÷PWð W÷(sð s÷3ò 3÷>ð ÷."ð "÷>ò >÷@Lõ L÷<ò ð*!ð 6:ð!ð 6:÷	!÷ !õ !r+   c                óš   € V ^8„  d   QhR\         R\        P                  R\        \        P
                  ,          R\        P                  /# )r"   rÌ   rÃ   rÊ   r#   )r   rU   rÄ   r   r   r9   )r&   s   "r(   r)   r)   :  sE   € ÷ pñ p¤	ð p¼¿
¹
ð pÌHÔUW×U^ÑU^ÕL_ð pÔkp×kuÑkuñ pr+   c                ó  € V P                   pVf   V# Ve    ^RIHp \        W$4      '       d‰   VP                  R8X  dv   VP
                  w  rV\        V4      pVR;;,          VR,          V,          ,          uu&   VR;;,          VR,          V,          ,          uu&   \        P                  ! V4      # V# \        V\        4      '       dw   V'       d    \        V^ ,          \        4      '       d   V# Ve   \        VP                  4       4      M/ pV F(  p	\        W‘VP                  V	P                  4      4      pK*  	  V# \        V\        P                   \        P"                  34      '       Ed   VP$                  \        V\        P                   4      '       d   RMR,          p
V
eÌ   \        V4      pV
 Uu. uF  p\&        P(                  ! V4      NK  	  pp\        V\        P                   4      '       dX   VP$                  P                  RR4      '       g6   \+        V\-        V4      ) R V4       UUu. uF  w  rÛ\/        WÛ4      NK  	  pppWÇ\-        V4      ) R% \        P                  ! V4      pV^ ,          ^ 8X  EdJ   \        V\0        4      '       Ed3   RV9   gO   \        V\        P2                  \        P4                  \        P6                  \        P8                  34      '       dÞ   VP$                  P                  R4      p
V
f   V# \        V\        P8                  4      '       dI   \        V
\:        4      '       d3   \=        W¡R,          VR,          ,          VP$                  R,          4      p
\        V4      pV
 Uu. uF  p\&        P(                  ! V4      NK  	  upV\-        V
4      ) R% \        P                  ! V4      # RV9   Ed–   Ve   \?        VR	/ 4      P                  R4      MRp
\        V\        P@                  \        PB                  34      ;'       do    VPD                  R
8H  ;'       dX    VPF                  R
8H  ;'       dA    V
RJ;'       d5    \H        ;QJ d    R V
 4       F  '       d   K   RM	  RM! R V
 4       4      p\K        4       '       g
   V'       Ed   V
eB   \        V\        P@                  \        PB                  34      '       d   VPF                  R8X  d   V# \        V\        P8                  4      '       dI   \        V
\:        4      '       d3   \=        W¡R,          VR,          ,          VP$                  R,          4      p
\        V4      pV
 Uu. uF  p\&        P(                  ! V4      NK  	  upWsR,          PL                  R,          ) R% \        P                  ! V4      # VP                  RR4      pVf   V# VPO                  4       ^8X  d   VPQ                  4       MV^ ,          PQ                  4       pVR8:  d   V# \        V4      pVR,          ^ ,          WsR,          PL                  R,          ) R% \        P                  ! V4      # V# u upi u uppi u upi u upi )a0  Get the new batch shape if the augmentation changes the image size.

Note:
   Augmentations that change the spatial size provide `output_size` with shape (B, spatial_dims).
   `PadTo` and `RandomMosaic(output_size=...)` provide none, so their configured size is used; with
   `crop_if_exceeds=False`, `PadTo` keeps a dimension that is already larger.
   Empty crops and resizes have no sampled output-size rows, so their configured size is used,
   whatever their probability: an empty gate takes the transformed branch, as the image
   forward does (#4429).

N)ÚPatchSequentialÚvalidÚsizeÚoutput_sizeÚcrop_if_exceedsTÚsiderÝ   r€   c              3   óB   "  € T F  p\        V\        4      x € K  	  R # 5ir-   )r;   rS   )Ú.0rc   s   & r(   Ú	<genexpr>Ú'_get_new_batch_shape.<locals>.<genexpr>‹  s   é € Ð9±D¨S”J˜s¤C×(Ð(³Dùs   ‚Fg        Ú
batch_probg      à?éþÿÿÿr‚   ))rÛ   Úpatchr  r;   ÚpaddingÚ	grid_sizeÚlistrU   rÄ   r   rm   r‰   rÇ   ÚgetrÉ   r¶   ÚPadToÚRandomMosaicrÝ   ÚoperatorÚindexrÙ   r`   rª   r   Ú
RandomCropÚ
CenterCropÚRandomResizedCropÚResizerS   r   ÚgetattrÚCenterCrop3DÚRandomCrop3DÚpÚp_batchÚallr   re   Únumelr„   )rÌ   rÃ   rÊ   rÛ   r  ÚrowsÚcolumnsÚnew_batch_shaper÷   r-  r  rc   ÚdimsÚoldÚstatic_crop3dr  Úprobs   &&&              r(   rÇ   rÇ   :  s  € ð �:‰:€DØ‚|ØÐð ÒÝ*ä�f×.Ò.Ø�~‰~ Ô(à &× 0Ñ 0‘�Ü"& {Ó"3�Ø ×# °rÕ':¸TÕ'AÕAÓ#Ø ×# °rÕ':¸WÕ'DÕDÓ#Ü—z’z /Ó2Ð2ØÐô �$œ×Òß”J˜t A�w¬×7Ò7àÐØ4:Ò4F”4˜×-Ñ-Ó/Ô0ÈBˆÛˆAÜ.¨q¸x¿|¹|ÈAÏFÉFÓ?SÓTŠKñ àÐô
 �&œ1Ÿ7™7¤A§N¡NÐ3×4Ó4Ø�|‰|¤j°¼¿¹×&AÒ&A™FÀ}ÕUˆØÒÜ" ;Ó/ˆOÙ37Ó8±4¨C”H—N’N 3Ö'±4ˆDÐ8Ü˜&¤!§'¡'×*Ò*°6·<±<×3CÑ3CÐDUÐW[×3\Ò3\ä69¸/Ì3ÈtË9È*È,Ð:WÐY]Ô6^Ô_Ñ6^©(¨#œ˜CžÑ6^�Ñ_Ø,0œS ›Y˜J˜LÐ)ÜŸ*š* _Ó5ˆKð 	�A�˜!ÕÜ�vÔ0×1Ó1Ø˜dÔ"¤j°¼!¿,¹,ÌÏÉÔVW×ViÑViÔkl×ksÑksÐ9t×&uÒ&uð �|‰|×Ñ Ó'ˆØŠ<ØÐÜ�fœaŸh™h×'Ò'¬J°t¼S×,AÒ,AÜ& t¸­_¸{È2½Õ-NÐPV×P\ÑP\Ð]cÕPdÓeˆDÜ˜{Ó+ˆÙHLÓ(MÉÀ¬¯ª¸Ö)<ÉÑ(Mˆœ˜T›˜
˜Ð%Ü�zŠz˜/Ó*Ð*ð ˜ÕØ;AÒ;MŒw�v˜w¨Ó+×/Ñ/°Ô7ÐSWˆô �v¤§¡´·±Ð?Ó@÷ :ð :Ø—‘˜C‘÷:ð :à—‘ #Ñ%÷:ð :ð ˜DÐ ÷:ð :÷ “Ñ9±DÓ9——’Ñ9±DÓ9Ó9ð 	ô �>Š>Ÿ]˜]ð Š|¤
¨6´A·N±NÄAÇNÁNÐ3S× TÒ TÐY_×YgÑYgÐknÔYnØ"Ð"Ü˜&¤!§(¡(×+Ò+´
¸4Ä×0EÒ0EÜ*¨4¸RµÀ;ÈrÅ?Õ1RÐTZ×T`ÑT`ÐagÕThÓi�Ü" ;Ó/ˆOÙ`dÓ@eÑ`dÐY\ÄÇÂÐPSÖATÑ`dÑ@eˆO -Õ0×6Ñ6°rÕ:Ð:Ð<Ð=Ü—:’:˜oÓ.Ð.à—X‘X˜l¨DÓ1ˆ
ØÒàÐà$.×$4Ñ$4Ó$6¸!Ô$;ˆz�‰Ô ÀÈAÅ×ASÑASÓAUˆØ�3Œ;ØÐä˜{Ó+ˆØ<@ÀÕ<OÐPQÕ<Rˆ˜mÕ,×2Ñ2°2Õ6Ð6Ð8Ð9Ü�zŠz˜/Ó*Ð*àÐùòA 9ùó `ùò" )Nùò8 Afs   Æ;Y.È:Y3Î
Y9Õ0Y>r-   )/r$  r«   Útypingr   r   r   r   r   r   r	   r
   r   r   rU   r   Úkornia.augmentationÚaugmentationr¶   Úkornia.augmentation.baser   r   Úkornia.augmentation.utilsr   Úkornia.corer   Úkornia.core.mixin.image_moduler   Úkornia.core.opsr   Úkornia.core.utilsr   Ú!kornia.geometry.transform.affwarpr   Úbaser   r   Úopsr   r   r½   r   r   Ú__all__r­   r   r   rÇ   © r+   r(   Ú<module>rF     s|   ðó$ Û ß ]× ]× ]ã Ý å ß NÝ 9Ý #Ý ;Ý $Ý *Ý Aç @ß <ß -àÐ
€ðSð ô,Ð$4ô ,ô&tÐ)Ð+Hô t÷npñ pr+   