+
    öäûjï  ã                   óŒ   € ^ RI t ^ RI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Ht  ! R R	]4      tR# )
é    N)ÚAnyÚDictÚOptionalÚTupleÚUnion)Úrandom_generator)ÚGeometricAugmentationBase2D)ÚResampleÚSamplePadding)Ú_as_tensor_nonblocking)Úget_shear_matrix2dÚwarp_affinec                   óà   a a€ ] tR t^ t oRt]P                  P                  RR]P                  P                  RR3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# )ÚRandomShearaâ
  Shear images by random angles in degrees, applied per sample with probability ``p`` (default 0.5).

``output = RandomShear(shear, ...)(input)`` shears images of shape ``(B, C, H, W)`` about their centers by
sampled angles.

Args:
    shear: Range of degrees to select from.
        If float, a shear parallel to the x axis in the range (-shear, +shear) will be applied.
        If (a, b), a shear parallel to the x axis in the range (a, b) will be applied.
        If (a, b, c, d), then x-axis shear in (shear[0], shear[1]) and y-axis shear in (shear[2], shear[3])
        will be applied. Will not apply shear by default.
    resample: resample mode from "nearest" (0) or "bilinear" (1).
    padding_mode: padding mode from "torch.zeros" (0), "border" (1) or "reflection" (2).
    same_on_batch: apply the same transformation across the batch.
    align_corners: interpolation flag.
    p: probability of applying the transformation to each sample.
    keepdim: whether to keep the output shape the same as input (True) or broadcast it to the batch form (False).

Shape:
    - Input: ``(C, H, W)`` or ``(B, C, H, W)``
    - Output: ``(B, C, H, W)``

Convention:
    - See :class:`~kornia.augmentation.GeometricAugmentationBase2D` for coordinates, defaults and inverse.
    - ``shear`` supplies one or two degree ranges for the x and y shears; a scalar or pair supplies only x
      shear. The signs are those of :class:`RandomAffine`'s ``shear``.

.. note::
    This function internally uses :func:`kornia.geometry.transform.warp_affine`.

.. note::
    Unlike torchvision's ``RandomAffine(degrees=0, shear=...)``, which shears every image, this class shears each
    sample with probability ``p``, 0.5 by default; with ``same_on_batch=True`` one draw decides for the whole batch.
    Pass ``p=1.0`` to shear every sample.

See Also:
    - :class:`RandomAffine`: samples a combined affine transformation.

Examples:
    >>> import torch
    >>> rng = torch.manual_seed(0)
    >>> input = torch.rand(1, 1, 3, 3)
    >>> aug = RandomShear((-5., 2., 5., 10.), p=1.)
    >>> out = aug(input)
    >>> out, aug.transform_matrix
    (tensor([[[[0.4403, 0.7614, 0.1516],
              [0.1753, 0.3074, 0.6127],
              [0.4438, 0.8924, 0.4061]]]]), tensor([[[ 1.0000,  0.0100, -0.0100],
             [-0.1183,  0.9988,  0.1194],
             [ 0.0000,  0.0000,  1.0000]]]))
    >>> aug.inverse(out)
    tensor([[[[0.4045, 0.7577, 0.1393],
              [0.2071, 0.3074, 0.5582],
              [0.3958, 0.8868, 0.4265]]]])

To apply the exact augmenation again, you may take the advantage of the previous parameter state:
    >>> input = torch.randn(1, 3, 32, 32)
    >>> aug = RandomShear((-15., 20.), p=1.)
    >>> (aug(input) == aug(input, params=aug._params)).all()
    tensor(True)

Fg      à?c                óâ   <€ V ^8„  d   QhRS[ S[P                  S[S[S[S[3,          S[S[S[S[S[3,          3,          RS[ S[S[S[3,          RS[RS[RS[ S[S[S[	3,          RS[RS[RR	/# )
é   ÚshearÚresampleÚsame_on_batchÚalign_cornersÚpadding_modeÚpÚkeepdimÚreturnN)
r   ÚtorchÚTensorÚfloatr   ÚstrÚintr
   Úboolr   )ÚformatÚ__classdict__s   "€ÚcC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\augmentation\_2d\geometric\shear.pyÚ__annotate__ÚRandomShear.__annotate__`   sž   ø€ ÷ 
ñ 
á‘U—\‘\¡5©%±±u°Õ*=¹uÁUÉEÑSXÑZ_ÐE_Õ?`Ð`Õað
ñ ™™S¡(Ð*Õ+ð
ñ ð	
ñ
 ð
ñ ™C¡¡mÐ3Õ4ð
ñ ð
ñ ð
ð 
ñ
ó    c                óÊ   <€ \         SV `  WcVR 7       \        P                  ! V4      V n        R\
        P                  ! V4      R\        P                  ! V4      RV/V n        R# ))r   r   r   r   r   r   N)	ÚsuperÚ__init__ÚrgÚShearGeneratorÚ_param_generatorr
   Úgetr   Úflags)	Úselfr   r   r   r   r   r   r   Ú	__class__s	   &&&&&&&&€r#   r)   ÚRandomShear.__init__`   sV   ø€ ô 	‰Ñ˜1À7ÐÔKÜ35×3DÒ3DÀUÓ3KˆÔàœŸš XÓ.ØœM×-Ò-¨lÓ;Ø˜]ð
ˆŽ
r&   c                óš   <€ V ^8„  d   QhRS[ P                  RS[S[S[ P                  3,          RS[S[S[3,          RS[ P                  /# )r   ÚinputÚparamsr.   r   )r   r   r   r   r   )r!   r"   s   "€r#   r$   r%   r   sN   ø€ ÷ 
ñ 
Ù—\‘\ð
Ù+/±±U·\±\Ð0AÕ+Bð
ÙKOÑPSÑUXÐPXÍ>ð
á	�‰ñ
r&   c                óR  € \         P                  R ,          p\        VR,          VP                  VP                  4      V,          p\        VR,          VP                  VP                  4      V,          p\        \        VR,          VP                  VP                  4      VV4      # )g     €f@Úshear_xÚshear_yÚcenter)ÚmathÚpir   ÚdeviceÚdtyper   )r/   r3   r4   r.   Údeg2rad_factorr6   r7   s   &&&&   r#   Úcompute_transformationÚ"RandomShear.compute_transformationr   s   € ô
 !%§¡¨%¥ˆÜ(¨°	Õ):¸E¿L¹LÈ%Ï+É+ÓVÐYgÕgˆÜ(¨°	Õ):¸E¿L¹LÈ%Ï+É+ÓVÐYgÕgˆÜ!Ü" 6¨(Õ#3°U·\±\À5Ç;Á;ÓOØØó
ð 	
r&   c          
      óÄ   <€ V ^8„  d   QhRS[ P                  RS[S[S[ P                  3,          RS[S[S[3,          RS[S[ P                  ,          RS[ P                  /# )r   r3   r4   r.   Ú	transformr   )r   r   r   r   r   r   )r!   r"   s   "€r#   r$   r%   €   sd   ø€ ÷ 
ñ 
á�|‰|ð
ñ ‘S™%Ÿ,™,Ð&Õ'ð
ñ ‘C™�H�~ð	
ñ
 ™EŸL™LÕ)ð
ñ 
�‰ñ
r&   c           	     óN  € VP                   w   rVp\        V\        P                  4      '       g   \	        R \        V4       R24      h\        VVR,          Wg3VR,          P                  P                  4       VR,          VR,          P                  P                  4       R7      # )ú0Expected the `transform` be a torch.Tensor. Got Ú.r   r   r   )r   r   )ºNNN:Nr   NrE   )	ÚshapeÚ
isinstancer   r   Ú	TypeErrorÚtyper   ÚnameÚlower)r/   r3   r4   r.   rA   Ú_ÚheightÚwidths   &&&&&   r#   Úapply_transformÚRandomShear.apply_transform€   s”   € ð $Ÿk™kÑˆˆ1�eÜ˜)¤U§\¡\×2Ò2ÜÐNÌtÐT]ËÐN_Ð_`ÐaÓbÐbäØØ�hÕØˆOØ�*Õ×"Ñ"×(Ñ(Ó*Ø Õ0Ø˜~Õ.×3Ñ3×9Ñ9Ó;ô
ð 	
r&   c                óÀ   <€ V ^8„  d   QhRS[ P                  RS[S[S[3,          RS[S[ P                  ,          RS[S[S[S[3,          ,          RS[ P                  /# )r   r3   r.   rA   Úsizer   )r   r   r   r   r   r   r   r   )r!   r"   s   "€r#   r$   r%   ”   sc   ø€ ÷ 
ñ 
á�|‰|ð
ñ ‘C™�H�~ð
ñ ™EŸL™LÕ)ð	
ñ
 ‘u™S¡#˜X•Õ'ð
ñ 
�‰ñ
r&   c           
     ó  € \        V\        P                  4      '       g   \        R \	        V4       R24      hV P                  VV P                  \        P                  ! W1P                  VP                  R7      VR7      # )rC   rD   )r;   r<   )r4   rA   r.   )
rG   r   r   rH   rI   rO   Ú_paramsÚ	as_tensorr;   r<   )r/   r3   r.   rA   rR   s   &&&&&r#   Úinverse_transformÚRandomShear.inverse_transform”   sl   € ô ˜)¤U§\¡\×2Ò2ÜÐNÌtÐT]ËÐN_Ð_`ÐaÓbÐbØ×#Ñ#ØØ—<‘<Ü—o’o i¿¹ÈEÏKÉKÔXØð	 $ó 
ð 	
r&   )r,   r.   )N)NN)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r
   ÚBILINEARrJ   r   ÚZEROSr)   r>   rO   rV   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r0   r"   s   @@r#   r   r       sd   ù‡ € ñ=ðD /7×.?Ñ.?×.DÑ.DØ#Ø#Ø7D×7JÑ7J×7OÑ7OØØ÷
õ 
÷$
ð 
÷
ò 
÷(
÷ 
ò 
r&   r   )r9   Útypingr   r   r   r   r   r   Úkornia.augmentationr   r*   Ú&kornia.augmentation._2d.geometric.baser	   Úkornia.constantsr
   r   Úkornia.core.utilsr   Úkornia.geometry.transformr   r   r   © r&   r#   Ú<module>ri      s4   ðó$ ß 4Õ 4ã å 6Ý Nß 4Ý 4÷ FôB
Ð-ö B
r&   