+
    åûj™% ã                   óÜ  € R t ^ RIt^ RI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Ht ^ RIHt ^ RIHt ^R	IHtHtHtHtHt . R>OtR R ltR?R R lltR?R R lltR R ltR R ltR R ltR R lt R R  lt!R@R! R" llt"RAR# R$ llt#RBR% R& llt$RCR' R( llt%R@R) R* llt&RBR+ R, llt'RAR- R. llt(RDR/ R0 llt)RER1 R2 llt*RFR3 R4 llt+RGR5 R6 llt, ! R7 R]PZ                  4      t. ! R8 R
]PZ                  4      t/ ! R9 R]PZ                  4      t0 ! R: R]PZ                  4      t1 ! R; R]PZ                  4      t2 ! R< R]PZ                  4      t3 ! R= R]PZ                  4      t4R# )Hu&  Rotate, shift, zoom, shear or resize images, and warp them by an affine matrix at their size.

The affine functions take ``(C, H, W)`` or ``(B, C, H, W)`` images, or ``(C, D, H, W)`` and ``(B, C, D, H, W)``
volumes for the ``3d`` forms, keep the input size and warp with :func:`~kornia.geometry.transform.warp_affine` (or
:func:`~kornia.geometry.transform.warp_affine3d`); all but ``affine`` and ``affine3d`` build the sourceâ†’destination
pixel matrix themselves. Centres and shifts are pixels in ``(x, y)`` (or ``(x, y, z)``) order, rotation angles are
degrees (the shear angles of :class:`Affine` are radians), and a positive 2D angle turns counter-clockwise on
screen. The resizes take ``(*, H, W)`` and change the size with :func:`torch.nn.functional.interpolate`. A module
form stores its tensors as buffers, or as parameters when given a ``torch.nn.Parameter``, so they follow
``Module.to``.

Which function to use:

- Warp by an affine matrix at the input size: :func:`affine` ``(B, 2, 3)``, :func:`affine3d` ``(B, 3, 4)``.
  :class:`Affine` builds the 2D matrix from an angle, a translation, a scale and a shear in one module.
- Rotate about the centre: :func:`rotate` and :class:`Rotate`; a volume by an axis-angle vector: :func:`rotate3d`.
- Shift by pixels: :func:`translate` and :class:`Translate`. Zoom about the centre at the same size: :func:`scale`
  and :class:`Scale`. Shear by raw factors: :func:`shear` and :class:`Shear`.
- Change the size: to ``(h, w)`` or one side's length, :func:`resize` and :class:`Resize`; by a factor,
  :func:`rescale` and :class:`Rescale`; to the nearest multiples of a factor, :func:`resize_to_be_divisible`.
- For an output size other than the input's, warp by a matrix with :func:`~kornia.geometry.transform.warp_affine`
  or :func:`~kornia.geometry.transform.warp_perspective`.
N)ÚOptionalÚTupleÚUnion)Únn)Ú_emit_deprecation_warning)ÚKORNIA_CHECK_SHAPE)Ú_device_literalÚeye_like)Ú_extract_device_dtype)Úgaussian_blur2d)Úget_affine_matrix2dÚget_projective_transformÚget_rotation_matrix2dÚwarp_affineÚwarp_affine3dÚAffineÚRescaleÚResizeÚRotateÚScaleÚShearÚ	Translatec                ó~   € V ^8„  d   QhR\         P                  R\        R\        \        P
                  ,          RR/# )é   ÚmoduleÚnameÚvalueÚreturnN)r   ÚModuleÚstrr   ÚtorchÚTensor)Úformats   "Ú]C:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\geometry\transform\affwarp.pyÚ__annotate__r$   M   s6   € ÷ >ñ >¤r§y¡yð >¼ð >ÄHÌUÏ\É\ÕDZð >Ð_cñ >ó    c                 ó’   € \        V\        P                  4      '       d   V P                  W4       R# V P	                  WR R7       R# )F)Ú
persistentN)Ú
isinstancer   Ú	ParameterÚregister_parameterÚregister_buffer)r   r   r   s   &&&r#   Ú_register_transform_tensorr,   M   s6   € ô �%œŸ™×&Ò&Ø×!Ñ! $Ö.à×Ñ˜t°uÐÖ=r%   c                óŽ   € V ^8„  d   QhR\         P                  R\        \         P                  ,          R\         P                  /# )r   ÚtensorÚliker   )r    r!   r   )r"   s   "r#   r$   r$   Y   s:   € ÷ Tñ T¤5§<¡<ð T´xÄÇÁÕ7Mð TÔY^×YeÑYeñ Tr%   c                ó(  € ^\        V P                  4      u;8:  d   ^8:  g   M \        RV P                   R24      hV P                  RR w  r#\        V^,
          4      ^,          p\        V^,
          4      ^,          pVe#   VP	                  4       '       d   VP
                  MV P
                  p\        P                  P                  4       '       d%   \        P                  ! WE.V P                  VR7      # \        WE.V P                  VR7      # )a(  Compute the center of tensor plane for (H, W), (C, H, W) and (B, C, H, W).

The center is in the dtype of ``like`` when it is a floating-point tensor, the parameter it is combined with, so
that the default center gives the same matrix as one passed explicitly (#6545); otherwise in ``tensor``'s.
z-Must be a 3D tensor as HW, CHW and BCHW. Got Ú.N©ÚdeviceÚdtypeéþÿÿÿ)ÚlenÚshapeÚAssertionErrorÚfloatÚis_floating_pointr4   r    ÚjitÚis_scriptingr.   r3   r   )r.   r/   ÚheightÚwidthÚcenter_xÚcenter_yr4   s   &&     r#   Ú_compute_tensor_centerrA   Y   sÓ   € ð ”�F—L‘LÓ!Ö& QÖ&ÜÐLÈVÏ\É\ÈNÐZ[Ð\Ó]Ð]Ø—L‘L  Ð%�M€FÜ˜E A�IÓ&¨Õ*€HÜ˜F Q�JÓ'¨!Õ+€HØÒ*¨t×/EÑ/E×/GÒ/GˆD�JŠJÈVÏ\É\€Eô ‡y�y×Ñ×ÒÜ�|Š|˜XÐ0¸¿¹ÈeÔTÐTÜ˜HÐ/¸¿¹ÈUÔSÐSr%   c                óŽ   € V ^8„  d   QhR\         P                  R\        \         P                  ,          R\         P                  /# )r   r.   r4   r   )r    r!   r   r4   )r"   s   "r#   r$   r$   l   s:   € ÷ ^ñ ^¤U§\¡\ð ^¼(Ä5Ç;Á;Õ:Oð ^Ô[`×[gÑ[gñ ^r%   c                ó   € ^\        V P                  4      u;8:  d   ^8:  g   M \        RV P                   R24      hV P                  RR w  r#p\        V^,
          4      ^,          p\        V^,
          4      ^,          p\        V^,
          4      ^,          pVf   V P                  MTp\
        P                  P                  4       '       d&   \
        P                  ! WVV.V P                  VR7      # \        WVV.V P                  VR7      # )zSCompute the center of tensor plane for (D, H, W), (C, D, H, W) and (B, C, D, H, W).z0Must be a 3D tensor as DHW, CDHW and BCDHW. Got r1   Nr2   éýÿÿÿ)r6   r7   r8   r9   r4   r    r;   r<   r.   r3   r   )r.   r4   Údepthr=   r>   r?   r@   Úcenter_zs   &&      r#   Ú_compute_tensor_center3drG   l   sÛ   € à”�F—L‘LÓ!Ö& QÖ&ÜÐOÐPV×P\ÑP\È~Ð]^Ð_Ó`Ð`Ø!Ÿ<™<¨¨Ð,Ñ€E�5Ü˜E A�IÓ&¨Õ*€HÜ˜F Q�JÓ'¨!Õ+€HÜ˜E A�IÓ&¨Õ*€HØ!šMˆF�LŠL¨u€Eä‡y�y×Ñ×ÒÜ�|Š|˜X°Ð:À6Ç=Á=ÐX]Ô^Ð^Ü˜H°Ð9À&Ç-Á-ÐW\Ô]Ð]r%   c                óx   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  /# )r   ÚangleÚcenterr   ©r    r!   )r"   s   "r#   r$   r$   {   s-   € ÷ ñ ¤E§L¡Lð ¼%¿,¹,ð Ì5Ï<É<ñ r%   c                óJ   € \         P                  ! V4      p\        WV4      pV# )ú&Compute a pure affine rotation matrix.)r    Ú	ones_liker   )rI   rJ   ÚscaleÚmatrixs   &&  r#   Ú_compute_rotation_matrixrQ   {   s!   € äŸ/š/¨&Ó1€EÜ0°ÀÓF€FØ€Mr%   c          
      ó¸   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\         P                  R\         P                  /# )r   ÚyawÚpitchÚrollrJ   r   rK   )r"   s   "r#   r$   r$   ‚   sH   € ÷ ñ Ü	�‰ðÜ#Ÿl™lðÜ27·,±,ðÜHMÏÉðä
‡\�\ñr%   c           	     ó¬  € \        V P                  4      \        VP                  4      u;8X  d#   \        VP                  4      u;8X  d   ^ 8X  d:   M M6V P                  ^ R7      p VP                  ^ R7      pVP                  ^ R7      p\        V P                  4      \        VP                  4      u;8X  d#   \        VP                  4      u;8X  d   ^8X  d:   M M6V P                  ^R7      p VP                  ^R7      pVP                  ^R7      p\        V P                  4      \        VP                  4      u;8X  d#   \        VP                  4      u;8X  d   ^8X  g6   M \        RV P                   RVP                   RVP                   R24      h\        P
                  ! WV.^R7      p\        P                  ! V 4      p\        W4V4      pV# )rM   ©Údimz,Expected yaw, pitch, roll to be (B, 1). Got z, r1   )r6   r7   Ú	unsqueezer8   r    ÚcatrN   r   )rS   rT   rU   rJ   ÚanglesÚscalesrP   s   &&&&   r#   Ú_compute_rotation_matrix3dr]   ‚   sQ  € ô ˆ3�9‰9ƒ~œ˜UŸ[™[Ó)ÖA¬S°·±«_ÖAÀ×AØ�m‰m ˆmÓ"ˆØ—‘ A�Ó&ˆØ�~‰~ !ˆ~Ó$ˆä
ˆ3�9‰9ƒ~œ˜UŸ[™[Ó)ÖA¬S°·±«_ÖAÀ×AØ�m‰m ˆmÓ"ˆØ—‘ A�Ó&ˆØ�~‰~ !ˆ~Ó$ˆä�—	‘	‹Nœc %§+¡+Ó.ÖF´#°d·j±j³/ÖFÀQÖFÜÐKÈCÏIÉIÈ;ÐVXÐY^×YdÑYdÐXeÐegÐhl×hrÑhrÐgsÐstÐuÓvÐvä Ÿ9š9 c°$Ð%7¸QÔ?€FÜ Ÿ?š?¨3Ó/€FÜ3°FÀFÓK€FØ€Mr%   c                óX   € V ^8„  d   QhR\         P                  R\         P                  /# )r   Útranslationr   rK   )r"   s   "r#   r$   r$   ™   s"   € ÷ ñ ¬U¯\©\ð ¼e¿l¹lñ r%   c                ó¬   € \        ^V RR7      p\        P                  ! V ^RR7      w  r#VR;;,          V,          uu&   VR;;,          V,          uu&   V# )z&Compute affine matrix for translation.F©Úshared_memory©ÚchunksrX   éÿÿÿÿ).é    ºr   é   N).é   rg   ©r	   r    Úchunk)r_   rP   ÚdxÚdys   &   r#   Ú_compute_translation_matrixrn   ™   sI   € ä# A {À%ÔH€Fä�[Š[˜¨Q°BÔ7�F€BØ
ˆ;×˜2ÕÓØ
ˆ;×˜2ÕÓØ€Mr%   c                óx   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  /# )r   rO   rJ   r   rK   )r"   s   "r#   r$   r$   £   s-   € ÷ ñ ¤5§<¡<ð ¼¿¹ð Ì%Ï,É,ñ r%   c                óš   € \         P                  ! V P                  R,          V P                  V P                  R7      p\        WV 4      pV# )z"Compute affine matrix for scaling.ºNri   Nr2   )r    Úzerosr7   r3   r4   r   )rO   rJ   rI   rP   s   &&  r#   Ú_compute_scaling_matrixrs   £   s8   € äŸ+š+ e§k¡k°"¥o¸e¿l¹lÐRW×R]ÑR]Ô^€EÜ0°ÀÓF€FØ€Mr%   c                óX   € V ^8„  d   QhR\         P                  R\         P                  /# )r   Úshearr   rK   )r"   s   "r#   r$   r$   ª   s"   € ÷ ñ ¤§¡ð ´%·,±,ñ r%   c                ó¬   € \        ^V RR7      p\        P                  ! V ^RR7      w  r#VR;;,          V,          uu&   VR;;,          V,          uu&   V# )z#Compute affine matrix for shearing.Fra   rc   re   ).rf   :ri   r   N).ri   :rf   ri   Nrj   )ru   rP   ÚshxÚshys   &   r#   Ú_compute_shear_matrixry   ª   sI   € ä# A u¸EÔB€Fä�{Š{˜5¨°Ô3�H€CØ
ˆ;×˜3ÕÓØ
ˆ;×˜3ÕÓØ€Mr%   c                óœ   € V ^8„  d   QhR\         P                  R\         P                  R\        R\        R\        R\         P                  /# ©r   r.   rP   ÚmodeÚpadding_modeÚalign_cornersr   ©r    r!   r   Úbool)r"   s   "r#   r$   r$   ¸   sX   € ÷ Rñ RÜ�L‰LðRä�L‰LðRô ðRô ð	Rô
 ðRô ‡\�\ñRr%   c                óZ  € VP                  4       ^8X  d   VP                  ^ 4      p\        V. RO4       V P                  4       ^8H  pV'       d   \        P                  ! V ^ R7      p V P                  ^ ,          ^8X  dq   VP                  ^ ,          ^8w  dY   V P                  VP                  ^ ,          V P                  ^,          V P                  ^,          V P                  ^,          4      p VP                  ^ ,          ^8w  g+   V P                  ^ ,          ^ 8X  g   VP                  '       d%   VP                  V P                  ^ ,          RR4      pV P                  R,          pV P                  R,          p\        WWg3W#V4      pV'       d   \        P                  ! V^ R7      pV# )u<  Warp an image by a sourceâ†’destination affine matrix, keeping its size.

``out = affine(tensor, matrix)`` warps ``(C, H, W)`` or ``(B, C, H, W)`` images by ``(B, 2, 3)`` sourceâ†’destination
pixel affine matrices and returns them at their own size: :func:`warp_affine` with ``dsize=(H, W)``, plus an
unbatched image and broadcasting. One matrix, ``(1, 2, 3)`` or ``(2, 3)``, serves every image of a batch, and one
image, unbatched or of batch 1, is warped by every matrix, so it returns ``(B, C, H, W)`` for ``B > 1`` matrices.
For another output size, use :func:`warp_affine`; to build the matrix from an angle, a shift, a scale and a shear,
use :class:`Affine`.

.. image:: _static/img/warp_affine.png

Convention:
    See :doc:`Conventions & Pitfalls </get-started/conventions>` for the ``align_corners``
    defaults and sampling rules.

    - ``matrix`` is the sourceâ†’destination **pixel** affine matrix ``(B, 2, 3)``; an unbatched ``(2, 3)`` matrix
      is read as ``(1, 2, 3)``.

Args:
    tensor: The image tensor to be warped in shapes of
        ``(C, H, W)`` or ``(B, C, H, W)``.
    matrix: The 2x3 affine transformation matrices, with shape ``(B, 2, 3)``, or one ``(2, 3)`` matrix.
    mode: interpolation mode to calculate output values ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values
      ``'zeros'`` | ``'border'`` | ``'reflection'``.
    align_corners: interpolation flag.

Returns:
    The warped image with the same shape as the input, except that one image warped by ``B > 1`` matrices
    returns ``(B, C, H, W)``.

See Also:
    - :func:`warp_affine`: the same warp with an explicit output size, for batched images.
    - :func:`affine3d`: the same for volumes, by ``(B, 3, 4)`` matrices.
    - :class:`Affine`: a module built from an angle, a translation, a scale and a shear instead of a matrix.
    - :func:`rotate`: rotate about the centre without building the matrix.

Example:
    >>> img = torch.rand(1, 2, 3, 5)
    >>> aff = torch.eye(2, 3)[None]
    >>> out = affine(img, aff)
    >>> print(out.shape)
    torch.Size([1, 2, 3, 5])

rW   )ÚBÚ2Ú3re   r5   )	rX   rY   r   r    r7   ÚexpandÚrequires_gradr   Úsqueeze)	r.   rP   r|   r}   r~   Úis_unbatchedr=   r>   Úwarpeds	   &&&&&    r#   ÚaffinerŠ   ¸   s=  € ðl ‡z�zƒ|�qÔØ×!Ñ! !Ó$ˆÜ�všÔ/ð  Ÿ™›¨Ñ*€LßÜ—’ ¨QÔ/ˆð ‡|�|�A…˜!Ô §¡¨Q¥°1Ô 4Ø—‘˜vŸ|™|¨A�°·±¸QµÀÇÁÈaÅÐRX×R^ÑR^Ð_`ÕRaÓbˆð ‡|�|�A…˜!Ô˜vŸ|™|¨A�°!Ô3°v×7K×7KÐ7KØ—‘˜vŸ|™|¨A�°°BÓ7ˆð —,‘,˜rÕ"€FØ—‘˜bÕ!€EÜ& v¸°ÈÐ\iÓj€F÷ Ü—’˜v¨1Ô-ˆà€Mr%   c                óœ   € V ^8„  d   QhR\         P                  R\         P                  R\        R\        R\        R\         P                  /# r{   r   )r"   s   "r#   r$   r$     sX   € ÷ Añ AÜ�L‰LðAä�L‰LðAô ðAô ð	Aô
 ðAô ‡\�\ñAr%   c                ó†  € V P                  4       ^8H  pV'       d   \        P                  ! V ^ R7      p VP                  V P                  ^ ,          RR4      pV P                  R,          pV P                  R,          pV P                  R,          p\        WWgV3W#V4      p	V'       d   \        P                  ! V	^ R7      p	V	# )uÛ  Warp a volume by a sourceâ†’destination 3x4 affine matrix, keeping its size.

``out = affine3d(tensor, matrix)`` warps ``(C, D, H, W)`` or ``(B, C, D, H, W)`` volumes by ``(B, 3, 4)``
sourceâ†’destination voxel affine matrices and returns them at their own size, as :func:`warp_affine3d` with
``dsize=(D, H, W)`` does; one matrix serves every volume of a batch. Pass ``align_corners=True``: at the default
``False`` the warp mixes two voxel normalizations, so a translation of ``t`` voxels moves the volume
``t * size / (size - 1)`` voxels along that axis (`#4503 <https://github.com/kornia/kornia/issues/4503>`_). For
images, use :func:`affine`.

Convention:
    - ``matrix`` is the sourceâ†’destination **pixel** affine matrix ``(B, 3, 4)``
    - align_corners: ``False`` by default (the 2D :func:`affine` defaults to ``True``)

Args:
    tensor: The image tensor to be warped in shapes of
        ``(C, D, H, W)`` or ``(B, C, D, H, W)``.
    matrix: The affine transformation matrix with shape ``(B, 3, 4)``.
    mode: interpolation mode to calculate output values
      ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values
      ``'zeros'`` | ``'border'`` | ``'reflection'``.
    align_corners: interpolation flag.

Returns:
    The warped image, with the shape of the input.

See Also:
    - :func:`affine`: the 2D warp of images, whose default ``align_corners=True`` is correct.
    - :func:`warp_affine3d`: the same warp with an explicit output size.
    - :func:`rotate3d`: rotate a volume about its centre without building the matrix.

Example:
    >>> img = torch.rand(1, 2, 4, 3, 5)
    >>> aff = torch.eye(3, 4)[None]
    >>> out = affine3d(img, aff)
    >>> print(out.shape)
    torch.Size([1, 2, 4, 3, 5])

rW   re   rD   r5   )rX   r    rY   r…   r7   r   r‡   )
r.   rP   r|   r}   r~   rˆ   rE   r=   r>   r‰   s
   &&&&&     r#   Úaffine3dr�     s¡   € ð^  Ÿ™›¨Ñ*€LßÜ—’ ¨QÔ/ˆð �]‰]˜6Ÿ<™<¨�?¨B°Ó3€Fð —‘˜bÕ!€EØ—,‘,˜rÕ"€FØ—‘˜bÕ!€EÜ(¨¸%ÈÐ9OÐQUÐerÓs€F÷ Ü—’˜v¨1Ô-ˆà€Mr%   c                óÖ   € V ^8„  d   QhR\         P                  R\         P                  R\        \         P                  R3,          R\        R\        R\        R\         P                  /# )	r   r.   rI   rJ   Nr|   r}   r~   r   ©r    r!   r   r   r€   )r"   s   "r#   r$   r$   U  sz   € ÷ \[ñ \[Ü�L‰Lð\[ä�<‰<ð\[ô ”%—,‘, Ð$Õ%ð\[ô ð	\[ô
 ð\[ô ð\[ô ‡\�\ñ\[r%   c                óà  € \        V \        P                  4      '       g   \        R\	        V 4       24      h\        V\        P                  4      '       g   \        R\	        V4       24      hVe8   \        V\        P                  4      '       g   \        R\	        V4       24      h\        V P                  4      R9  d   \        RV P                   24      hVf   \        W4      pV P                  4       ^8X  d   V P                  ^ ,          M^pV P                  4       ^8X  d…   V^ 8”  d~   VP                  R8X  dm   VP                  '       g[   VP                  '       gI   VP                  R8X  g   VP                  R8X  d'   \        P                  P                  4       '       g   ^pVP                  V4      pVP                  VR	4      p\        W4      p\        WR
,          W4V4      # )a{  Rotate an image counter-clockwise by an angle in degrees about its centre or a given point.

``out = rotate(tensor, angle)`` rotates ``(C, H, W)`` or ``(B, C, H, W)`` images by ``angle`` degrees, ``(B,)`` or
one value for all, counter-clockwise as displayed, about ``center`` (``(B, 2)`` ``(x, y)`` pixels, by default the
image centre ``((W - 1) / 2, (H - 1) / 2)``), and returns them at their size; the uncovered corners are padded
by ``padding_mode``. For a stored angle, use :class:`Rotate`; for volumes, :func:`rotate3d`; for the matrix, to
compose or reuse it, :func:`get_rotation_matrix2d`.

.. image:: _static/img/rotate.png

Convention:
    - ``center`` is ``(x, y)`` in pixels, origin at top-left; defaults to the tensor center
    - positive ``angle`` rotates counter-clockwise as displayed (y-down image axes)

Args:
    tensor: The image tensor to be warped in shapes of ``(C, H, W)`` or ``(B, C, H, W)``.
    angle: The angle through which to rotate. The tensor
      must have a shape of (B), where B is batch size.
    center: The center through which to rotate. The tensor
      must have a shape of (B, 2), where B is batch size and last
      dimension contains cx and cy.
    mode: interpolation mode to calculate output values
      ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values
      ``'zeros'`` | ``'border'`` | ``'reflection'``.
    align_corners: interpolation flag.

Returns:
    The rotated tensor with shape as input.

See Also:
    - :class:`Rotate`: the module form, with the angle stored.
    - :func:`rotate3d`: rotate volumes by an axis-angle vector; a positive ``z`` angle turns clockwise on screen
      (3D rotations are right-handed by design).
    - :func:`get_rotation_matrix2d`: the ``(B, 2, 3)`` matrix of this rotation, with a scale.
    - :func:`rot180`: a half turn by flipping both axes, without interpolation.

.. note::
   See a working example `here <https://www.kornia.org/tutorials/nbs/rotate_affine.html>`__.

Example:
    >>> img = torch.rand(1, 3, 4, 4)
    >>> angle = torch.tensor([90.])
    >>> out = rotate(img, angle)
    >>> print(out.shape)
    torch.Size([1, 3, 4, 4])

ú-Input tensor type is not a torch.Tensor. Got z,Input angle type is not a torch.Tensor. Got ú-Input center type is not a torch.Tensor. Got ú7Invalid tensor shape, we expect CxHxW or BxCxHxW. Got: ©rh   é   )ri   )r   )ri   r   re   ©.:Nr   NºNrh   N)r(   r    r!   Ú	TypeErrorÚtyper6   r7   Ú
ValueErrorrA   rX   r†   r;   Ú
is_tracingr…   rQ   rŠ   )r.   rI   rJ   r|   r}   r~   ÚbatchÚrotation_matrixs   &&&&&&  r#   Úrotaterž   U  sƒ  € ôp �fœeŸl™l×+Ò+ÜÐGÌÈVËÀ~ÐVÓWÐWä�eœUŸ\™\×*Ò*ÜÐFÄtÈEÃ{ÀmÐTÓUÐUàÒ¤*¨V´U·\±\×"BÒ"BÜÐGÌÈVËÀ~ÐVÓWÐWä
ˆ6�<‰<Ó Ô&ÜÐRÐSY×S_ÑS_ÐR`ÐaÓbÐbð ‚~Ü'¨Ó6ˆð  &Ÿz™z›|¨qÔ0ˆF�L‰L˜ŽO°a€Eà�
‰
‹˜ÔØ�AŒIØ�K‰K˜4ÔØ×#×#Ð#Ø×$×$Ð$Ø�\‰\˜TÔ! V§\¡\°VÔ%;Ü—	‘	×$Ñ$×&Ò&àˆØ�L‰L˜Ó€EØ�]‰]˜5 "Ó%€FÜ$<¸UÓ$K€Oô �&¨+Õ6¸ÈMÓZÐZr%   c                ó  € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\         P                  R\        \         P                  R3,          R\        R\        R	\        R
\         P                  /	# )r   r.   rS   rT   rU   rJ   Nr|   r}   r~   r   r�   )r"   s   "r#   r$   r$   ´  sš   € ÷ `]ñ `]Ü�L‰Lð`]ä	�‰ð`]ô �<‰<ð`]ô �,‰,ð	`]ô
 ”%—,‘, Ð$Õ%ð`]ô ð`]ô ð`]ô ð`]ô ‡\�\ñ`]r%   c                óì  € \        V \        P                  4      '       g   \        R\	        V 4       24      h\        V\        P                  4      '       g   \        R\	        V4       24      h\        V\        P                  4      '       g   \        R\	        V4       24      h\        V\        P                  4      '       g   \        R\	        V4       24      hVe8   \        V\        P                  4      '       g   \        R\	        V4       24      h\        V P                  4      R9  d   \        RV P                   24      hVfš   RpVP                  4       '       g-   VP                  4       '       g   VP                  4       '       dK   \        P                  ! \        P                  ! VP                  VP                  4      VP                  4      p\        W4      pV P                  4       ^8X  d   V P                  ^ ,          M^p	VP                  V	4      pVP                  V	4      pVP                  V	4      pVP                  V	R	4      p\        WW44      p
\        W
R
,          WVV4      # )a  Rotate a volume by an axis-angle vector of yaw, pitch and roll in degrees.

``out = rotate3d(tensor, yaw, pitch, roll)`` rotates ``(C, D, H, W)`` or ``(B, C, D, H, W)`` volumes by the
axis-angle vector ``(yaw, pitch, roll)`` in degrees, ``(B,)`` each, about ``center`` (``(B, 3)`` ``(x, y, z)``
pixels, by default the volume centre), and returns them at their size. Positive angles follow the right-hand rule,
so a positive ``roll``, about ``z``, turns clockwise on screen, the opposite of :func:`rotate`
(3D rotations are right-handed by design). Pass ``align_corners=True``: at the default ``False`` the
warp mixes two voxel normalizations, which changes the rotation unless it turns about the volume centre in a plane
whose two sizes are equal, as any rotation of a cube about its centre does
(`#4503 <https://github.com/kornia/kornia/issues/4503>`_).

Convention:
    - ``center`` is ``(x, y, z)`` in pixels, origin at the top-left of the first depth
      slice (``z = 0``); defaults to the tensor center
    - ``yaw``, ``pitch`` and ``roll`` are **one axis-angle vector** ``(rx, ry, rz)`` in degrees,
      not three composed per-axis Euler rotations: the three are concatenated and handed to
      :func:`~kornia.geometry.transform.get_projective_transform`, which applies Rodrigues'
      formula. The rotation axis is ``(rx, ry, rz) / ||(rx, ry, rz)||`` and the angle is
      ``||(rx, ry, rz)||`` degrees, so ``(90, 90, 0)`` turns through ``90 * sqrt(2)`` degrees
      about ``(1, 1, 0) / sqrt(2)`` while ``(30, 0, 0)`` is a 30-degree turn about ``x``. A
      single non-zero component therefore *is* the per-axis rotation it names, which is why
      one angle reads the same under either reading; two or more do not, and neither Euler
      order reproduces the axis-angle result.
    - align_corners: ``False`` by default (the 2D :func:`rotate` defaults to ``True``)

Args:
    tensor: The image tensor to be warped in shapes of ``(C, D, H, W)`` or ``(B, C, D, H, W)``.
    yaw: The ``rx`` component of the axis-angle vector. The tensor
      must have a shape of (B), where B is batch size.
    pitch: The ``ry`` component of the axis-angle vector. The tensor
      must have a shape of (B), where B is batch size.
    roll: The ``rz`` component of the axis-angle vector. The tensor
      must have a shape of (B), where B is batch size.
    center: The center through which to rotate. The tensor
      must have a shape of (B, 3), where B is batch size and last
      dimension contains x, y and z.
    mode: interpolation mode to calculate output values
      ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values
      ``'zeros'`` | ``'border'`` | ``'reflection'``.
    align_corners: interpolation flag.

Returns:
    torch.Tensor: The rotated tensor with shape as input.

See Also:
    - :func:`rotate`: the 2D rotation of images, counter-clockwise on screen.
    - :func:`affine3d`: warp a volume by any ``(B, 3, 4)`` affine matrix.
    - :func:`get_projective_transform`: the ``(B, 3, 4)`` matrix of this rotation, with a scale.

r‘   zyaw is not a torch.Tensor. Got z!pitch is not a torch.Tensor. Got z roll is not a torch.Tensor. Got Nr’   z;Invalid tensor shape, we expect CxDxHxW or BxCxDxHxW. Got: )r•   é   re   ).r—   :Nr•   N)r(   r    r!   r˜   r™   r6   r7   rš   r:   Úpromote_typesr4   rG   rX   r…   r]   r�   )r.   rS   rT   rU   rJ   r|   r}   r~   Úcenter_dtyperœ   r�   s   &&&&&&&&   r#   Úrotate3dr¤   ´  sç  € ôz �fœeŸl™l×+Ò+ÜÐGÌÈVËÀ~ÐVÓWÐWä�cœ5Ÿ<™<×(Ò(ÜÐ9¼$¸s»)¸ÐEÓFÐFä�eœUŸ\™\×*Ò*ÜÐ;¼DÀ»K¸=ÐIÓJÐJä�dœEŸL™L×)Ò)ÜÐ:¼4À»:¸,ÐGÓHÐHàÒ¤*¨V´U·\±\×"BÒ"BÜÐGÌÈVËÀ~ÐVÓWÐWä
ˆ6�<‰<Ó Ô&ÜÐVÐW]×WcÑWcÐVdÐeÓfÐfð ‚~à.2ˆØ× Ñ ×"Ò" e×&=Ñ&=×&?Ò&?À4×CYÑCY×C[ÒC[Ü ×.Ò.¬u×/BÒ/BÀ3Ç9Á9ÈeÏkÉkÓ/ZÐ\`×\fÑ\fÓgˆLÜ)¨&Ó?ˆð  &Ÿz™z›|¨qÔ0ˆF�L‰L˜ŽO°a€EØ
�*‰*�UÓ
€CØ�L‰L˜Ó€EØ�;‰;�uÓ€DØ�]‰]˜5 "Ó%€FÜ$>¸sÈ4Ó$X€Oô �F¨KÕ8¸$ÈmÓ\Ð\r%   c                óœ   € V ^8„  d   QhR\         P                  R\         P                  R\        R\        R\        R\         P                  /# )r   r.   r_   r|   r}   r~   r   r   )r"   s   "r#   r$   r$     s`   € ÷ C^ñ C^Ü�L‰LðC^ä—‘ðC^ô ðC^ô ð	C^ô
 ðC^ô ‡\�\ñC^r%   c                óÌ  € \        V \        P                  4      '       g   \        R\	        V 4       24      h\        V\        P                  4      '       g   \        R\	        V4       24      h\        V P                  4      R9  d   \        RV P                   24      hVP                  4       ^8X  d   VP                  ^ 4      p\        V4      p\        WR,          W#V4      # )a4  Shift an image by a translation in pixels.

``out = translate(tensor, translation)`` shifts ``(C, H, W)`` or ``(B, C, H, W)`` images by ``translation``
``(B, 2)``, ``(dx, dy)`` in pixels, a positive ``dx`` to the right and a positive ``dy`` down, and returns them at
their size; a fractional shift interpolates, and the uncovered border is padded by ``padding_mode``. One
translation, ``(1, 2)`` or ``(2,)``, serves every image of a batch, and one image, unbatched or of batch 1, is
shifted by every translation. For a stored translation, use :class:`Translate`; for the matrix,
:func:`get_translation_matrix2d`.

.. image:: _static/img/translate.png

Convention:
    - ``translation`` is ``(dx, dy)`` in pixels

Args:
    tensor: The image tensor to be warped in shapes of ``(C, H, W)`` or ``(B, C, H, W)``.
    translation: tensor containing the amount of pixels to
      translate in the x and y direction. The tensor must have a shape of
      (B, 2), where B is batch size, last dimension contains dx dy, or (2,) for one translation.
    mode: interpolation mode to calculate output values
      ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values
      ``'zeros'`` | ``'border'`` | ``'reflection'``.
    align_corners: interpolation flag.

Returns:
    The translated tensor with shape as input, except that one image shifted by ``B > 1`` translations returns
    ``(B, C, H, W)``.

See Also:
    - :class:`Translate`: the module form, with the translation stored.
    - :func:`get_translation_matrix2d`: the ``(B, 3, 3)`` matrix of this shift.
    - :func:`affine`: warp by any affine matrix at the input size.

Example:
    >>> img = torch.rand(1, 3, 4, 4)
    >>> translation = torch.tensor([[1., 0.]])
    >>> out = translate(img, translation)
    >>> print(out.shape)
    torch.Size([1, 3, 4, 4])

r‘   z2Input translation type is not a torch.Tensor. Got r“   r”   r–   )r(   r    r!   r˜   r™   r6   r7   rš   rX   rY   rn   rŠ   )r.   r_   r|   r}   r~   Útranslation_matrixs   &&&&& r#   Ú	translater¨     sÉ   € ôb �fœeŸl™l×+Ò+ÜÐGÌÈVËÀ~ÐVÓWÐWä�k¤5§<¡<×0Ò0ÜÐLÌTÐR]ÓM^ÐL_Ð`ÓaÐaä
ˆ6�<‰<Ó Ô&ÜÐRÐSY×S_ÑS_ÐR`ÐaÓbÐbð ‡�Ó˜AÔØ!×+Ñ+¨AÓ.ˆô (CÀ;Ó'OÐô �&¨[Õ9¸4È}Ó]Ð]r%   c                óÖ   € V ^8„  d   QhR\         P                  R\         P                  R\        \         P                  R3,          R\        R\        R\        R\         P                  /# )	r   r.   Úscale_factorrJ   Nr|   r}   r~   r   r�   )r"   s   "r#   r$   r$   ]  sz   € ÷ IZñ IZÜ�L‰LðIZä—,‘,ðIZô ”%—,‘, Ð$Õ%ðIZô ð	IZô
 ðIZô ðIZô ‡\�\ñIZr%   c                ó,  € \        V \        P                  4      '       g   \        R\	        V 4       24      h\        V\        P                  4      '       g   \        R\	        V4       24      h\        VP                  4      ^8X  d   VP                  R4      pVf   \        W4      pV P                  4       ^8X  d   V P                  ^ ,          M^pVP                  VR4      pVP                  V^4      p\        W4      p\        WR,          W4V4      # )au  Zoom an image about its centre by a scale factor, keeping its size.

``out = scale(tensor, scale_factor)`` scales the content of ``(C, H, W)`` or ``(B, C, H, W)`` images by
``scale_factor``, ``(B,)`` for both axes or ``(B, 2)`` as ``(sx, sy)``, about ``center`` (``(B, 2)`` ``(x, y)``
pixels, by default the image centre), and returns them at their size: a factor above 1 zooms in and crops, one
below 1 shrinks the content and pads the border. To change the image size instead, use :func:`rescale` or
:func:`resize`; for a stored factor, :class:`Scale`.

.. image:: _static/img/scale.png

Convention:
    - ``center`` is ``(x, y)`` in pixels, origin at top-left; defaults to the tensor center

Args:
    tensor: The image tensor to be warped in shapes of ``(C, H, W)`` or ``(B, C, H, W)``.
    scale_factor: The scale factor apply. The tensor
      must have a shape of (B) or (B, 2), where B is batch size.
      If (B), isotropic scaling will perform.
      If (B, 2), x-y-direction specific scaling will perform.
    center: The center through which to scale. The tensor
      must have a shape of (B, 2), where B is batch size and last
      dimension contains cx and cy.
    mode: interpolation mode to calculate output values
      ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values
      ``'zeros'`` | ``'border'`` | ``'reflection'``.
    align_corners: interpolation flag.

Returns:
    The scaled tensor with the same shape as the input.

See Also:
    - :class:`Scale`: the module form, with the factor stored.
    - :func:`rescale`: change the image size by a factor, given height first.
    - :func:`get_rotation_matrix2d`: the matrix of this scaling, with a zero angle.

Example:
    >>> img = torch.rand(1, 3, 4, 4)
    >>> scale_factor = torch.tensor([[2., 2.]])
    >>> out = scale(img, scale_factor)
    >>> print(out.shape)
    torch.Size([1, 3, 4, 4])

r‘   z3Input scale_factor type is not a torch.Tensor. Got re   r–   )r(   r    r!   r˜   r™   r6   r7   rY   rA   rX   r…   rs   rŠ   )r.   rª   rJ   r|   r}   r~   rœ   Úscaling_matrixs   &&&&&&  r#   rO   rO   ]  sì   € ôh �fœeŸl™l×+Ò+ÜÐGÌÈVËÀ~ÐVÓWÐWä�l¤E§L¡L×1Ò1ÜÐMÌdÐS_ÓN`ÐMaÐbÓcÐcä
ˆ<×ÑÓ !Ô#à#×-Ñ-¨bÓ1ˆð ‚~Ü'¨Ó=ˆð  &Ÿz™z›|¨qÔ0ˆF�L‰L˜ŽO°a€EØ�]‰]˜5 "Ó%€FØ×&Ñ& u¨aÓ0€LÜ#:¸<Ó#P€Nô �&¨Õ5°tÈ=ÓYÐYr%   c                óœ   € V ^8„  d   QhR\         P                  R\         P                  R\        R\        R\        R\         P                  /# )r   r.   ru   r|   r}   r~   r   r   )r"   s   "r#   r$   r$   ©  s`   € ÷ JXñ JXÜ�L‰LðJXä�<‰<ðJXô ðJXô ð	JXô
 ðJXô ‡\�\ñJXr%   c                óÌ  € \        V \        P                  4      '       g   \        R\	        V 4       24      h\        V\        P                  4      '       g   \        R\	        V4       24      h\        V P                  4      R9  d   \        RV P                   24      hVP                  4       ^8X  d   VP                  ^ 4      p\        V4      p\        WR,          W#V4      # )aÅ	  Shear an image by raw shear factors about pixel (0, 0).

``out = shear(tensor, shear)`` shears ``(C, H, W)`` or ``(B, C, H, W)`` images by ``shear`` ``(B, 2)``, the raw
factors ``(shx, shy)`` described below, and returns them at their size. One pair of factors, ``(1, 2)`` or ``(2,)``,
serves every image of a batch, and one image, unbatched or of batch 1, is sheared by every pair. For shear angles in
radians, use :class:`Affine`, about the image centre by default, or :func:`get_shear_matrix2d`, about a centre you
pass; both shear by the negative tangent, so values below ``pi / 2`` in magnitude shear the other way there. For
stored factors, use :class:`Shear`.

.. image:: _static/img/shear.png

Convention:
    - ``shear`` is a pair of raw factors ``(shx, shy)`` about pixel ``(0, 0)``:
      ``x_out = x + shx * y``, ``y_out = y + shy * x`` (x right, y down).
    - Known defect: :class:`Affine` reads its ``shear`` as angles in radians about the image centre and shears
      by their negative tangent, so the same tensor shears the other way there while its values stay below
      ``pi / 2`` in magnitude (`#5661 <https://github.com/kornia/kornia/issues/5661>`_).
    - align_corners: ``False`` by default (differs from the other 2D affine warps and from
      :class:`Shear`, which default to ``True``)

Args:
    tensor: The image tensor to be skewed with shape of ``(C, H, W)`` or ``(B, C, H, W)``.
    shear: tensor containing raw shear factors
      in the x and y direction about pixel (0, 0). The tensor must have a shape of
      (B, 2), where B is batch size, last dimension contains shx shy, or (2,) for one pair.
    mode: interpolation mode to calculate output values
      ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values
      ``'zeros'`` | ``'border'`` | ``'reflection'``.
    align_corners: interpolation flag.

Returns:
    The skewed tensor with shape same as the input, except that one image sheared by ``B > 1`` pairs of
    factors returns ``(B, C, H, W)``.

See Also:
    - :class:`Shear`: the module form, which defaults to ``align_corners=True``.
    - :func:`get_shear_matrix2d`: a shear given as angles in radians about a centre, the reading of
      :class:`Affine`.
    - :func:`affine`: warp by any affine matrix at the input size.

Example:
    >>> img = torch.rand(1, 3, 4, 4)
    >>> shear_factor = torch.tensor([[0.5, 0.0]])
    >>> out = shear(img, shear_factor)
    >>> print(out.shape)
    torch.Size([1, 3, 4, 4])

r‘   z,Input shear type is not a torch.Tensor. Got r“   r”   r–   )r(   r    r!   r˜   r™   r6   r7   rš   rX   rY   ry   rŠ   )r.   ru   r|   r}   r~   Úshear_matrixs   &&&&& r#   ru   ru   ©  sÁ   € ôp �fœeŸl™l×+Ò+ÜÐGÌÈVËÀ~ÐVÓWÐWä�eœUŸ\™\×*Ò*ÜÐFÄtÈEÃ{ÀmÐTÓUÐUä
ˆ6�<‰<Ó Ô&ÜÐRÐSY×S_ÑS_ÐR`ÐaÓbÐbð ‡y�yƒ{�aÔØ—‘ Ó"ˆô "7°uÓ!=€Lô �& {Õ3°TÈÓWÐWr%   c          
      ój   € V ^8„  d   QhR\         R\        R\        R\        \         \         3,          /# )r   Ú	side_sizeÚaspect_ratioÚsider   )Úintr9   r   r   )r"   s   "r#   r$   r$   ö  s5   € ÷ 	4ñ 	4¤3ð 	4´eð 	4Ä3ð 	4ÔUZÔ[^Ô`cÐ[cÕUdñ 	4r%   c                 ó  € VR9  d   \        RV R24      hVR8X  d   V \        W,          4      3# VR8X  d   \        W,          4      V 3# VR 8H  VR8  ,          '       d   V \        W,          4      3# \        W,          4      V 3# )ÚshortÚvertÚhorzz=side can be one of 'short', 'long', 'vert', and 'horz'. Got 'Ú'ç      ð?)r¶   Úlongr·   r¸   )rš   r´   )r±   r²   r³   s   &&&r#   Ú_side_to_image_sizer¼   ö  s‘   € ØÐ4Ô4ÜÐXÐY]ÐX^Ð^_Ð`ÓaÐaØˆv„~Øœ#˜iÕ6Ó7Ð7Ð7Øˆv„~Ü�9Õ+Ó,¨iÐ7Ð7Ø�‰˜L¨3Ñ.×/Ô/Øœ#˜iÕ6Ó7Ð7Ð7ÜˆyÕ'Ó(¨)Ð3Ð3r%   c                óî   € V ^8„  d   QhR\         P                  R\        \        \        \        \        3,          3,          R\
        R\        \        ,          R\
        R\        R\         P                  /# )r   ÚinputÚsizeÚinterpolationr~   r³   Ú	antialiasr   )r    r!   r   r´   r   r   r   r€   )r"   s   "r#   r$   r$     su   € ÷ Nñ NÜ�<‰<ðNä
””Uœ3¤˜8•_Ð$Õ
%ðNô ðNô œD•>ð	Nô
 ðNô ðNô ‡\�\ñNr%   c                ó(
  € \        V \        P                  4      '       g   \        R\	        V 4       24      h\        V P                  4      ^8  d"   \        R\        V P                  4       24      hVR9   d   \        RV: R24      hV P                  pV P                  RR w  rx\        V\        4      '       d5   V^ 8:  g   V^ 8:  d   \        RV RV R24      hW‡,          p	\        WV4      p\        V4      ^8X  d"   V P                  ^ 4      P                  ^ 4      p M_\        V4      ^8X  d   V P                  ^ 4      p M=\        V4      ^8”  d.   ^p
VRR  F  pW«,          p
K  	  V P                  ! V
.VRR O5!  p V^ ,          ^ 8X  g   V^,          ^ 8X  d’   V P                  R4      R	,          P                  V P                  R
7      ^ ,          pVP                  ! ^.V P                  4       ,          !  P                  ! . V P                  RR OV^ ,          NV^,          N5!  pEMvV^ 8:  g   V^ 8:  d   \        RV RV R24      hWq^ ,          ,          W�^,          ,          3pT;'       d    \!        V4      ^8„  pV'       Ed   \!        V^ ,          R,
          R,          R4      \!        V^,          R,
          R,          R4      3p\        \!        RV^ ,          ,          ^4      4      \        \!        RV^,          ,          ^4      4      3pV^ ,          ^,          '       d
   V^ ,          MV^ ,          ^,           V^,          ^,          '       d
   V^,          MV^,          ^,           3pV^8X  d   ^MV^ ,          V^8X  d   ^MV^,          3p\#        V VV4      p VR8X  dÏ   \        P$                  P'                  4       '       d«   \)        RWq^ ,          3W�^,          334       F…  w  pw  pp\        P*                  ! VV P,                  R7      R,           VV,          ,          P/                  4       pV P1                  VVP3                  4       P5                  V^,
          R7      4      p K‡  	  T pM+\        P6                  P8                  P;                  WW#R7      p\        V4      ^8X  d   VR,          pV# \        V4      ^8X  d   V^ ,          pV# \        V4      ^8”  d)   VP                  ! . VRR OV^ ,          NV^,          N5!  pV# )a¤
  Resize an image to a given size, or one side to a given length keeping the aspect ratio.

``out = resize(input, size)`` resamples the last two dimensions of ``(*, H, W)`` tensors to ``size = (h, w)`` with
:func:`torch.nn.functional.interpolate` and returns ``(*, h, w)``. An ``int`` size sets the length of one side and
keeps the aspect ratio, truncating the other side to an integer: the shorter side by default, or the longer side,
the height or the width with ``side='long'``, ``'vert'`` or ``'horz'``. ``antialias=True`` blurs with a Gaussian
before downscaling. To scale by a factor, use :func:`rescale`; to zoom the content and keep the size,
:func:`scale`.

.. image:: _static/img/resize.png

Convention:
    See :doc:`Conventions & Pitfalls </get-started/conventions>` for sampling and ``align_corners``
    conventions. When resizing camera images, see
    :doc:`camera and world conventions </get-started/camera-conventions>` for matching intrinsics scaling.

    - input: ``(*, H, W)``; ``size`` is ``(h, w)``
    - align_corners: ``None`` by default (follows ``torch.nn.functional.interpolate``;
      note :func:`warp_perspective`/:func:`rotate` default ``True``)
    - ``side`` resizing preserves aspect ratio using the named side

Args:
    input: The image tensor to resize, with shape ``(*, H, W)``; ``*`` means any number of dimensions.
    size: Desired output size. If size is a sequence like (h, w),
        output size will be matched to this. If size is an int, the side that ``side`` names will be matched to
        this number; with the default ``side='short'``, if height > width, the image will be rescaled
        to (size * height / width, size)
    interpolation:  algorithm used for upsampling: ``'nearest'`` | ``'nearest-exact'`` | ``'bilinear'`` |
        ``'bicubic'`` | ``'area'``.
    align_corners: interpolation flag.
    side: Corresponding side if ``size`` is an integer. Can be one of ``'short'``, ``'long'``, ``'vert'``,
        or ``'horz'``.
    antialias: if True, then image will be filtered with Gaussian before downscaling.
        No effect for upscaling.

Returns:
    The resized tensor with the shape as the specified size.

See Also:
    - :class:`Resize`: the module form, with the size stored.
    - :func:`rescale`: the output size as a factor of the input size.
    - :func:`resize_to_be_divisible`: the nearest size whose sides are multiples of a factor.
    - :func:`scale`: zoom the content about the centre and keep the size.
    - :func:`crop_and_resize`: resamples a box of each image, not the whole image, to a fixed size.

Example:
    >>> img = torch.rand(1, 3, 4, 4)
    >>> out = resize(img, (6, 8))
    >>> print(out.shape)
    torch.Size([1, 3, 6, 8])

r‘   ú4Input tensor must have at least two dimensions. Got zinterpolation=zo is not supported: resize resamples (H, W), so use 'nearest', 'nearest-exact', 'bilinear', 'bicubic' or 'area'.Nz.Input image size must be positive. Got height=z, width=r1   rq   )r4   rº   g       @gü©ñÒMbP?znearest-exact)r3   g      à?)Úmax)r¿   r|   r~   )ÚlinearÚ	trilinearr5   rD   re   g      @)r5   re   )rf   rf   )r(   r    r!   r˜   r™   r6   r7   rš   r´   r¼   rY   ÚreshapeÚsumr4   rX   r…   rÄ   r   ÚonnxÚis_in_onnx_exportÚzipÚaranger3   ÚfloorÚindex_selectr»   Úclampr   Ú
functionalÚinterpolate)r¾   r¿   rÀ   r~   r³   rÁ   Úoriginal_shapeÚhÚwr²   Ú
batch_sizeÚdÚzeroÚoutputÚfactorsÚsigmasÚksrX   Úin_sizeÚout_sizeÚindexs   &&&&&&               r#   Úresizerß     s~  € ôx �eœUŸ\™\×*Ò*ÜÐGÌÈUËÀ}ÐUÓVÐVä
ˆ5�;‰;Ó˜!ÔÜÐOÔPSÐTY×T_ÑT_ÓP`ÐOaÐbÓcÐcàÐ/Ô/ÜØ˜]Ñ-ð .@ð @ó
ð 	
ð
 —[‘[€NØ�;‰;�r�sÐ�D€Aä�$œ×ÒØ�Œ6�Q˜!”Vô ÐMÈaÈSÐPXÐYZÐX[Ð[\Ð]Ó^Ð^Ø•uˆÜ" 4°tÓ<ˆÜ
ˆ>Ó˜aÔà—‘ Ó"×,Ñ,¨QÓ/‰Ü	ˆ^Ó	 Ô	!à—‘ Ó"‰Ü	ˆ^Ó	˜qÔ	 àˆ
Ø  Ó$ˆAØ�OŠJñ %à—’˜jÐ?¨>¸"¸#Ð+>Ó?ˆàˆA…w�!„|�t˜A•w !”|ð �}‰}˜RÓ  Õ$×(Ñ(¨u¯{©{Ð(Ó;¸aÕ?ˆØ—’   e§i¡i£kÕ 1Ñ3×:Ò:Ð_¸E¿K¹KÈÈÐ<LÐ_ÈdÐSTÍgÐ_ÐW[Ð\]ÕW^Ó_ŠØ	
ˆaŒ�1˜”6ÜÐIÈ!ÈÈHÐUVÐTWÐWXÐYÓZÐZà˜A•w•; ¨¥G¥Ð,ˆØ×4Ð4¤3 w£<°!Ñ#3ˆ	çˆ9Ü˜7 1�:¨Õ+¨sÕ2°EÓ:¼CÀÈÅÈcÕAQÐUXÕ@XÐZ_Ó<`ÐaˆFä”S˜ 6¨!¥9Õ,¨aÓ0Ó1´3´s¸7ÀVÈAÅYÕ;NÐPQÓ7RÓ3SÐSˆBà˜a�5 1Ÿ9œ9�"�Q–%¨"¨Q­%°!­)¸bÀ½eÀa¿i¼i°R¸¶UÈRÐPQÍUÐUVÍYÐWˆBà˜A”v‘! 2 a¥5¨q°A¬v©!¸2¸a½5ÐAˆBä# E¨2¨vÓ6ˆEà˜OÔ+´·
±
×0LÑ0L×0NÒ0Nô -0°¸AÀA½w¸<È!ÐRSÍWÈÐ:VÖ,WÑ(�Ñ(�g˜xÜŸ,š, x¸¿¹ÔEÈÕKÐPWÐZbÕPbÕc×jÑjÓl�Ø×*Ñ*¨3°·
±
³×0BÑ0BÀwÐQRÅ{Ð0BÓ0SÓT’ñ -Xð ‰Fä—X‘X×(Ñ(×4Ñ4°UÈMÐ4ÓwˆFä
ˆ>Ó˜aÔØ˜•ˆð €Mô 
ˆ^Ó	 Ô	!Ø˜•ˆð €Mô 
ˆ^Ó	˜qÔ	 Ø—’ÐG °°Ð!4ÐG°d¸1µgÐG¸tÀA½wÓGˆà€Mr%   c                óÀ   € V ^8„  d   QhR\         P                  R\        R\        R\        \
        ,          R\        \        ,          R\
        R\         P                  /# )r   r¾   Údivisible_factorrÀ   r~   r³   rÁ   r   )r    r!   r´   r   r   r€   )r"   s   "r#   r$   r$   “  sp   € ÷ @yñ @yÜ�<‰<ð@yäð@yô ð@yô œD•>ð	@yô
 ”3�-ð@yô ð@yô ‡\�\ñ@yr%   c                ó†  € \         P                  P                  4       '       g   Ve   \        RRRR4       \	        V \         P
                  4      '       g   \        R\        V 4       24      hV P                  ^8  d   \        RV P                   24      h\	        V\        P                  4      '       d   V^ 8:  d   \        RV 24      hV P                  R	R w  rgV^ 8”  d#   \        ^\        Wa,          4      4      V,          M^ pV^ 8”  d#   \        ^\        Wq,          4      4      V,          M^ p\        WV3W#VR7      # )
aŒ  Resize an image so that its height and width are multiples of a factor.

``out = resize_to_be_divisible(input, divisible_factor)`` resizes ``(*, H, W)`` tensors with :func:`resize` to the
nearest multiples of ``divisible_factor``, at least ``divisible_factor`` for a positive side, and returns
``(*, h, w)``; an empty side stays empty. A side halfway between two multiples rounds as Python's :func:`round`
does, to an even quotient, so with a factor of 4 both 6 and 10 become 8. ``side`` is deprecated and has no effect.
For a given size, use :func:`resize`.

Convention:
    - see the convention block of :func:`resize`
    - rounds ``height``/``width`` to the nearest multiple of ``divisible_factor`` before
      delegating to :func:`resize`; a positive side becomes at least ``divisible_factor``, and an empty side
      stays empty

Args:
    input (torch.Tensor): Input tensor to be resized.
    divisible_factor (int): The factor to which the image should be divisible.
    interpolation (str, optional): Interpolation flag. Defaults to "bilinear".
    align_corners (Optional[bool], optional):
        whether to align the corners of the input and output. Defaults to None.
    side (str, optional): Deprecated and ignored. Both sides are rounded independently to a multiple of
        ``divisible_factor``. In eager mode, any explicit non-None value emits a :class:`DeprecationWarning`.
        Defaults to None. This argument will be removed in a future release.
    antialias (bool, optional):
        If True, then image will be filtered with Gaussian before downscaling. Defaults to False.

Returns:
    torch.Tensor: The resized tensor.

Raises:
    TypeError: If ``input`` is not a tensor.
    ValueError: If ``input`` has fewer than two dimensions, or ``divisible_factor`` is not a positive integer.

See Also:
    - :func:`resize`: resize to a given size or side length.
    - :func:`rescale`: resize by a factor.

Nz%resize_to_be_divisible(..., side=...)z0.9.1z^The `side` argument has no effect. Both sides are rounded to a multiple of `divisible_factor`.r‘   rÃ   z1divisible_factor must be a positive integer. Got ©rÀ   r~   rÁ   r5   )r    r;   r<   r   r(   r!   r˜   r™   Úndimrš   ÚnumbersÚIntegralr7   rÄ   Úroundrß   )r¾   rá   rÀ   r~   r³   rÁ   r=   r>   s   &&&&&&  r#   Úresize_to_be_divisiblerè   “  s!  € ô\ �9‰9×!Ñ!×#Ò#ØÒÜ%Ø7ØØØpô	ô �eœUŸ\™\×*Ò*ÜÐGÌÈUËÀ}ÐUÓVÐVØ‡z�z�A„~ÜÐOÐPU×PZÑPZÈ|Ð\Ó]Ð]ÜÐ&¬×(8Ñ(8×9Ò9Ð=MÐQRÔ=RÜÐLÐM]ÐL^Ð_Ó`Ð`à—K‘K  Ð$�M€FØLRÐUVÌJŒS�”E˜&Õ3Ó4Ó5Ð8HÖHÐ\]€FØJOÐRSÌ)ŒC�”5˜Õ1Ó2Ó3Ð6FÖFÐYZ€EÜ�% %˜¸ÐnwÔxÐxr%   c                óâ   € V ^8„  d   QhR\         P                  R\        \        \        \        \        3,          3,          R\
        R\        \        ,          R\        R\         P                  /# )r   r¾   ÚfactorrÀ   r~   rÁ   r   )r    r!   r   r9   r   r   r   r€   )r"   s   "r#   r$   r$   Ö  ss   € ÷ Mnñ MnÜ�<‰<ðMnä”%œœu¤e˜|Õ,Ð,Õ-ðMnô ðMnô œD•>ð	Mnô
 ðMnô ‡\�\ñMnr%   c                óÊ  € \        V\        4      '       d   T;rVMVw  rV\        P                  P	                  4       '       d^   V'       gV   VR9   dO   V^ 8”  dH   V^ 8”  dA   V P
                  ^8X  d0   \        P                  P                  P                  V WV3VVRR7      # V P                  4       RR w  rx\        Wu,          4      \        W†,          4      3p	\        W	W#VR7      # )ut  Resize an image by a scale factor per side, given height first.

``out = rescale(input, factor)`` resizes ``(*, H, W)`` tensors with :func:`resize` to
``(int(H * factor_h), int(W * factor_w))``, truncating, and returns ``(*, h, w)``. ``factor`` is one ``float`` for
both sides or a pair ``(factor_h, factor_w)``, height first, unlike the ``(sx, sy)`` of :func:`scale`; a single
``int`` raises ``TypeError``. To set the output size directly, use :func:`resize`; for a stored factor,
:class:`Rescale`.

.. image:: _static/img/rescale.png

Convention:
    - ``factor`` is ``(factor_h, factor_w)`` when a pair â€” height first (contrast
      :func:`scale`, whose ``scale_factor`` is x-first)
    - delegates to :func:`resize` after converting ``factor`` to an output ``size``
    - ONNX: an export with a dynamic height or width keeps it dynamic for the ``'nearest'``,
      ``'bilinear'`` and ``'bicubic'`` modes without ``antialias``; the other modes keep the output size of
      the traced input. The exported graph computes the size in float32, which can be one pixel off eager
      when ``factor`` is not a power of two (``0.7`` at a side of 90 gives 63, eager 62)

Args:
    input: The image tensor to be scale with shape of ``(*, H, W)``.
    factor: Desired scaling factor as ``(factor_h, factor_w)`` â€” height first. If a single
        float, the value is used for both height and width (an ``int`` raises ``TypeError``).
    interpolation:  algorithm used for upsampling: ``'nearest'`` | ``'nearest-exact'`` | ``'bilinear'`` |
        ``'bicubic'`` | ``'area'``.
    align_corners: interpolation flag.
    antialias: if True, then image will be filtered with Gaussian before downscaling.
        No effect for upscaling.

Returns:
    The rescaled tensor with the shape as the specified size.

See Also:
    - :class:`Rescale`: the module form, which defaults to ``align_corners=True``.
    - :func:`resize`: the output size instead of a factor.
    - :func:`scale`: zoom the content by a factor and keep the size.

Example:
    >>> img = torch.rand(1, 3, 4, 4)
    >>> out = rescale(img, (2, 3))
    >>> print(out.shape)
    torch.Size([1, 3, 8, 12])

T)rª   r|   r~   Úrecompute_scale_factorNrã   )ÚnearestÚbilinearÚbicubicr5   )r(   r9   r    rÉ   rÊ   rä   r   rÐ   rÑ   r¿   r´   rß   )
r¾   rê   rÀ   r~   rÁ   Úfactor_vertÚfactor_horzr=   r>   r¿   s
   &&&&&     r#   Úrescalerò   Ö  sÔ   € ôf �&œ%× Ò Ø$*Ð*ˆ�kà#)Ñ ˆô 	�
‰
×$Ñ$×&Ò&ßØÐ?Ô?Ø˜!ŒOØ˜!ŒOØ�J‰J˜!ŒOô
 �x‰x×"Ñ"×.Ñ.ØØ%Ð3ØØ'Ø#'ð /ó 
ð 	
ð —J‘J“L  Ð%�M€FÜ�Õ$Ó%¤s¨5Õ+>Ó'?Ð@€DÜ�%¨]ÐclÔmÐmr%   c                   óX   a a€ ] tR tRt oRtRV3R lV 3R llltV3R lR ltRtVtV ;t	# )	r   i&  az  Resize an image to a given size, or one side to a given length (module form).

Build ``resizer = Resize(size)`` with the arguments of :func:`resize`, then ``out = resizer(input)`` resizes
``(*, H, W)`` tensors exactly as ``resize(input, size, ...)`` does. For a factor instead of a size, use
:class:`Rescale`; inside an augmentation pipeline, use :class:`~kornia.augmentation.Resize`.

Convention:
    See :doc:`Conventions & Pitfalls </get-started/conventions>` for sampling and ``align_corners``
    conventions. When resizing camera images, see
    :doc:`camera and world conventions </get-started/camera-conventions>` for matching intrinsics scaling.

    - See the convention block of :func:`resize`.

Args:
    size: Desired output size. If size is a sequence like (h, w),
        output size will be matched to this. If size is an int, the side that ``side`` names will be matched to
        this number; with the default ``side='short'``, if height > width, the image will be rescaled
        to (size * height / width, size)
    interpolation:  algorithm used for upsampling: ``'nearest'`` | ``'nearest-exact'`` | ``'bilinear'`` |
        ``'bicubic'`` | ``'area'``.
    align_corners: interpolation flag.
    side: Corresponding side if ``size`` is an integer. Can be one of ``'short'``, ``'long'``, ``'vert'``,
        or ``'horz'``.
    antialias: if True, then image will be filtered with Gaussian before downscaling.
        No effect for upscaling.

Returns:
    The resized tensor with the shape of the given size.

See Also:
    - :func:`resize`: the one-call form.
    - :class:`Rescale`: the module form of :func:`rescale`, a factor instead of a size.
    - :class:`~kornia.augmentation.Resize`: the augmentation of the same name, for augmentation pipelines.

Example:
    >>> img = torch.rand(1, 3, 4, 4)
    >>> out = Resize((6, 8))(img)
    >>> print(out.shape)
    torch.Size([1, 3, 6, 8])

c                óx   <€ V ^8„  d   QhRS[ S[S[S[S[3,          3,          RS[RS[S[,          RS[RS[RR/# )r   r¿   rÀ   r~   r³   rÁ   r   N)r   r´   r   r   r   r€   )r"   Ú__classdict__s   "€r#   r$   ÚResize.__annotate__Q  s]   ø€ ÷ )ñ )á‘C™™s¡C˜x�Ð(Õ)ð)ñ ð)ñ  ¡•~ð	)ñ
 ð)ñ ð)ð 
ñ)r%   c                ó`   <€ \         SV `  4        Wn        W n        W0n        W@n        WPn        R # ©N)ÚsuperÚ__init__r¿   rÀ   r~   r³   rÁ   )Úselfr¿   rÀ   r~   r³   rÁ   Ú	__class__s   &&&&&&€r#   rú   ÚResize.__init__Q  s+   ø€ ô 	‰ÑÔØ15Œ	Ø"/ÔØ-:ÔØŒ	Ø(Žr%   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# ©r   r¾   r   rK   )r"   rõ   s   "€r#   r$   rö   `  s#   ø€ ÷ 
ñ 
™UŸ\™\ð 
©e¯l©lñ 
r%   c           	     óˆ   € \        VV P                  V P                  V P                  V P                  V P
                  R7      # )aå  Resize the spatial dimensions of an image or feature tensor.

Args:
    input: Tensor with image-like layout ``(*, C, H, W)``, where
        ``*`` represents optional leading batch dimensions,
        :math:`C` is channels, :math:`H` is height, and :math:`W` is
        width.

Returns:
    Resized tensor produced by :func:`resize`. The output keeps the
    same leading and channel dimensions as ``input``; the height and
    width are determined by ``self.size`` and ``self.side``.
)r~   r³   rÁ   )rß   r¿   rÀ   r~   r³   rÁ   ©rû   r¾   s   &&r#   ÚforwardÚResize.forward`  s;   € ô ØØ�I‰IØ×ÑØ×,Ñ,Ø—‘Ø—n‘nô
ð 	
r%   )r~   rÁ   rÀ   r³   r¿   ©rî   Nr¶   F©
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rú   r  Ú__static_attributes__Ú__classdictcell__Ú__classcell__©rü   rõ   s   @@r#   r   r   &  s$   ù‡ € ñ(÷T)õ )÷
÷ 
ð 
r%   c                   óX   a a€ ] tR tRt oRtRV3R lV 3R llltV3R lR ltRtVtV ;t	# )	r   ix  aï  Warp an image by a rotation, a scale and a shear about a centre, then a translation (module form).

Build ``warper = Affine(angle, translation, scale_factor, shear, center)`` with at least one of the first four,
then ``out = warper(input)`` warps ``(B, C, H, W)`` images, or one ``(C, H, W)`` image, by the matrix of
:func:`get_affine_matrix2d`: a shear, a scale, a counter-clockwise rotation in degrees and a translation in pixels,
the first three about ``center`` (by default the image centre). The parameters, and ``center`` when given, share
one batch size ``P``. ``P`` and the input batch must be equal, or one of them 1, a ``(C, H, W)`` input counting
as 1: one parameter set warps every image, and ``P`` sets warp one image. For a matrix you already have, use
:func:`affine`; for one kind of warp, :class:`Rotate`, :class:`Translate`, :class:`Scale` or :class:`Shear`.

Convention:
    - ``shear`` contains angles in radians, using the negative-tangent, x-then-y convention
      of :func:`get_shear_matrix2d` about ``center`` (by default ``((W - 1) / 2, (H - 1) / 2)``).
    - Known defect: :func:`shear` and :class:`Shear` read their ``shear`` as raw factors about pixel ``(0, 0)``,
      without the negative tangent, so the same tensor shears the other way there while its values stay below
      ``pi / 2`` in magnitude (`#5661 <https://github.com/kornia/kornia/issues/5661>`_).
    - ``align_corners`` defaults to ``True``. See the convention block of :func:`affine`.

Args:
    angle: Angle in degrees for counter-clockwise rotation around the center. The tensor
        must have a shape of (B), where B is the batch size.
    translation: Amount of pixels for translation in x- and y-direction. The tensor must
        have a shape of (B, 2), where B is the batch size and the last dimension contains dx and dy.
    scale_factor: Factor for scaling. The tensor must have a shape of (B,2), where B is the
        batch size and the last dimension contains scale factors for x and y direction.
    shear: Angles in radians for shearing in x- and y-direction around the center. The
        tensor must have a shape of (B, 2), where B is the batch size and the last dimension
        contains sx and sy.
    center: Transformation center in pixels. The tensor must have a shape of (B, 2), where
        B is the batch size and the last dimension contains cx and cy. Defaults to the center of image to be
        transformed.
    mode: interpolation mode to calculate output values
      ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values
      ``'zeros'`` | ``'border'`` | ``'reflection'``.
    align_corners: interpolation flag.

Raises:
    RuntimeError: At construction, if not one of ``angle``, ``translation``, ``scale_factor``, or ``shear`` is
        set, or if their batch sizes differ.
    DeviceError: If ``angle``, ``translation``, ``scale_factor`` and ``shear`` are not all on one device.
    TypeCheckError: If they are on one device but do not all have one dtype. The ones not given are
        created on that device and in that dtype.
    ValueError: At the call, if ``center`` and the parameters have different batch sizes (construction does not
        check ``center``), or if the parameter batch and the input batch differ and neither is 1, a
        ``(C, H, W)`` input counting as 1.

Returns:
    The transformed tensor with same shape as input, except that one image warped by ``P > 1`` parameter sets
    returns ``(P, C, H, W)``.

See Also:
    - :func:`get_affine_matrix2d`: the ``(B, 3, 3)`` matrix this module warps by, whose own angle turns clockwise
      (`#4408 <https://github.com/kornia/kornia/issues/4408>`_).
    - :func:`affine`: warp by an affine matrix you already have.
    - :class:`Rotate`: a rotation alone.
    - :class:`Shear`: raw shear factors about pixel ``(0, 0)``, which shear the other way below ``pi / 2``.

Example:
    >>> img = torch.rand(1, 2, 3, 5)
    >>> angle = 90. * torch.rand(1)
    >>> out = Affine(angle)(img)
    >>> print(out.shape)
    torch.Size([1, 2, 3, 5])

c                ó  <€ V ^8„  d   QhRS[ S[P                  ,          RS[ S[P                  ,          RS[ S[P                  ,          RS[ S[P                  ,          RS[ S[P                  ,          RS[RS[RS[R	R
/	# )r   rI   r_   rª   ru   rJ   r|   r}   r~   r   N)r   r    r!   r   r€   )r"   rõ   s   "€r#   r$   ÚAffine.__annotate__¼  s’   ø€ ÷ ,+ñ ,+á™Ÿ™Õ%ð,+ñ ™eŸl™lÕ+ð,+ñ ™uŸ|™|Õ,ð	,+ñ
 ™Ÿ™Õ%ð,+ñ ™Ÿ™Õ&ð,+ñ ð,+ñ ð,+ñ ð,+ð 
ñ,+r%   c	                óü  <a€ WW43 U	u. uF  q™f   K  V	P                  4       ^ ,          NK!  	  p
p	V
'       g   Rp\        V4      hV
^ ,          o\        ;QJ d&    V3R lV
R,           4       F  '       d   K   RM	  RM! V3R lV
R,           4       4      '       g   \        RV
 24      hSV n        \        SV `  4        \        WW4.4      w  rÍVf   \        P                  ! SWÍR7      p\        V RV4       Vf   \        P                  ! S^WÍR7      p\        V R	V4       Vf   \        P                  ! S^WÍR7      p\        V R
V4       \        V RV4       \        V RV4       W`n        Wpn        W€n        R # u up	i )NzzAffine was created without any affine parameter. At least one of angle, translation, scale_factor, or shear has to be set.c              3   ó,   <"  € T F	  qS8H  x € K  	  R # 5irø   © )Ú.0ÚotherrÕ   s   & €r#   Ú	<genexpr>Ú"Affine.__init__.<locals>.<genexpr>Ð  s   øé € ÐD±O¨5˜JÖ&³Oùs   ƒ:ri   NNFTz3The batch sizes of the affine parameters mismatch: r2   rI   r_   rª   ru   rJ   )r¿   ÚRuntimeErrorÚallÚ_batch_sizerù   rú   r
   r    rr   r,   Úonesr|   r}   r~   )rû   rI   r_   rª   ru   rJ   r|   r}   r~   ÚargÚbatch_sizesÚmsgr3   r4   rÕ   rü   s   &&&&&&&&&     @€r#   rú   ÚAffine.__init__¼  sL  ù€ ð 27À\Ñ0YÓmÑ0Y¨”}�s—x‘x“z !—}�}Ñ0YˆÐmßð'ð ô ˜sÓ#Ð#à  •^ˆ
ß‹sÔD°KÀ¶OÓD�s�sŠsÔD°KÀ¶OÓD×DÒDÜÐ!TÐU`ÐTaÐbÓcÐcà%ˆÔä‰ÑÔÜ-¨uÀ<Ð.WÓX‰ˆàŠ=Ü—K’K 
°6ÔGˆEÜ" 4¨°%Ô8àÒÜŸ+š+ j°!¸FÔPˆKÜ" 4¨¸ÔDàÒÜ Ÿ:š: j°!¸FÔPˆLÜ" 4¨¸ÔFä" 4¨°%Ô8Ü" 4¨°6Ô:ØŒ	Ø(ÔØ*ÖùòC ns
   ‰E9“E9c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# rÿ   rK   )r"   rõ   s   "€r#   r$   r  ê  s'   ø€ ÷ #dñ #d™UŸ\™\ð #d©e¯l©lñ #dr%   c           	     ó€  € V P                   f   R;r#M%V P                   R,          V P                   R,          r2VP                  4       ^8X  d   VP                  ^ ,          M^pV P                  P                  ^ ,          pV P                  f&   \        WP                  4      P                  VR4      MV P                  p\        V P                  W`P                  V P                  ) W#R7      pWT^39  d   V^8w  d   \        RV RV R24      h\        WR	,          V P                  V P                  V P                  4      # )
a„  Warp the input with the affine transform configured in this module.

The transform matrix is built from this module's stored angle,
translation, scale, optional shear, and center. The resulting matrix is
passed to :func:`affine` for sampling.

Args:
    input: Image tensor with shape ``(B, C, H, W)``, where
        :math:`B` is batch size, :math:`C` is channel count,
        :math:`H` is height, and :math:`W` is width.

Returns:
    Affine-warped tensor with the input's shape, except that one image warped by ``P > 1`` parameter sets
    gives ``(P, C, H, W)``. Values sampled outside the input image are handled by ``self.padding_mode``.
N)ÚsxÚsyzAffine has z& parameter sets for an input batch of z/: the two must match, or one of them must be 1.).rf   ).ri   re   r–   )ru   rX   r7   rI   rJ   rA   r…   r   r_   rª   rš   rŠ   r|   r}   r~   )rû   r¾   r#  r$  rœ   Úparams_batchrJ   rP   s   &&      r#   r  ÚAffine.forwardê  s!  € ð  �:‰:ÒØˆNˆB�à—Z‘Z Õ'¨¯©°FÕ);�à"'§)¡)£+°Ô"2�—‘˜A–¸ˆØ—z‘z×'Ñ'¨Õ*ˆð SW×R]ÑR]ÒReÔ" 5¯*©*Ó5×<Ñ<¸\È2ÔNÐko×kvÑkvð 	ô % T×%5Ñ%5°v×?PÑ?PÐSW×S]ÑS]ÐR]ÐbdÔlˆØ q˜zÔ)¨e°q¬jÜØ˜l˜^Ð+QÐRWÐQXð Y%ð %óð ô �e KÕ0°$·)±)¸T×=NÑ=NÐPT×PbÑPbÓcÐcr%   )r  r~   r|   r}   )NNNNNrî   rr   Tr  r  s   @@r#   r   r   x  s)   ù‡ € ñA÷F,+õ ,+÷\#d÷ #dð #dr%   c                   óX   a a€ ] tR tRt oRtRV3R lV 3R llltV3R lR ltRtVtV ;t	# )	r   i  ur  Resize an image by a stored scale factor per side, given height first (module form).

Build ``rescaler = Rescale(factor)``, then ``out = rescaler(input)`` resizes ``(*, H, W)`` tensors as
:func:`rescale` does, except that ``align_corners`` defaults to ``True`` here and to ``None`` in the function. For a
size instead of a factor, use :class:`Resize`.

Convention:
    - align_corners: ``True`` by default (differs from function :func:`rescale`, whose default
      is ``None``). It applies to the ``'bilinear'`` and ``'bicubic'`` modes only. ``'nearest'``,
      ``'nearest-exact'`` and ``'area'`` ignore it, an explicit ``align_corners=True`` included, because
      ``torch.nn.functional.interpolate`` accepts no value but ``None`` for them; the function
      :func:`rescale` raises ``ValueError`` for such a call.
    - See the convention block of :func:`rescale`.

Args:
    factor: Desired scaling factor as ``(factor_h, factor_w)`` â€” height first. If a single
        float, the value is used for both height and width (an ``int`` raises ``TypeError``).
    interpolation:  algorithm used for upsampling: ``'nearest'`` | ``'nearest-exact'`` | ``'bilinear'`` |
        ``'bicubic'`` | ``'area'``.
    align_corners: interpolation flag.
    antialias: if True, then image will be filtered with Gaussian before downscaling.
        No effect for upscaling.

Returns:
    The rescaled tensor with the shape according to the given factor.

See Also:
    - :func:`rescale`: the one-call form, whose ``align_corners`` defaults to ``None``.
    - :class:`Resize`: the output size instead of a factor.
    - :class:`Scale`: zoom the content by a factor and keep the size.
    - :class:`~kornia.enhance.Rescale`: multiplies the values by a factor instead of resizing.

Example:
    >>> img = torch.rand(1, 3, 4, 4)
    >>> out = Rescale((2, 3))(img)
    >>> print(out.shape)
    torch.Size([1, 3, 8, 12])

c          
      ób   <€ V ^8„  d   QhRS[ S[S[S[S[3,          3,          RS[RS[RS[RR/# )r   rê   rÀ   r~   rÁ   r   N)r   r9   r   r   r€   )r"   rõ   s   "€r#   r$   ÚRescale.__annotate__9  sP   ø€ ÷ )ñ )á‘e™U¡5©% <Õ0Ð0Õ1ð)ñ ð)ñ ð	)ñ
 ð)ð 
ñ)r%   c                óT   <€ \         SV `  4        Wn        W n        W0n        W@n        R # rø   )rù   rú   rê   rÀ   r~   rÁ   )rû   rê   rÀ   r~   rÁ   rü   s   &&&&&€r#   rú   ÚRescale.__init__9  s&   ø€ ô 	‰ÑÔØ9?ŒØ"/ÔØ-:ÔØ(Žr%   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# rÿ   rK   )r"   rõ   s   "€r#   r$   r)  F  s'   ø€ ÷ vñ v™UŸ\™\ð v©e¯l©lñ vr%   c                ó˜   € V P                   R9   d   V P                  MRp\        WP                  V P                   W P                  R7      # )a{  Resize spatial dimensions by the stored scale factor.

Args:
    input: Tensor with shape ``(*, C, H, W)``, where ``*`` is any
        leading batch shape, :math:`C` is channels, :math:`H` is
        height, and :math:`W` is width.

Returns:
    Tensor with the same leading and channel dimensions as ``input``.
    The output height and width are computed from ``self.factor``.
N)r~   rÁ   )rÅ   rî   rï   rÆ   )rÀ   r~   rò   rê   rÁ   )rû   r¾   r~   s   && r#   r  ÚRescale.forwardF  sD   € ð #'×"4Ñ"4Ð8fÔ"fˆD×ÒÐlpð 	ô �uŸk™k¨4×+=Ñ+=È]×ftÑftÔuÐur%   )r~   rÁ   rê   rÀ   )rî   TFr  r  s   @@r#   r   r     s'   ù‡ € ñ&÷P)õ )÷v÷ vð vr%   c                   óX   a a€ ] tR tRt oRtRV3R lV 3R llltV3R lR ltRtVtV ;t	# )	r   iZ  aÛ  Rotate an image counter-clockwise by a stored angle in degrees (module form).

Build ``rotator = Rotate(angle)``, optionally with ``center``, then ``out = rotator(input)`` rotates ``(C, H, W)``
or ``(B, C, H, W)`` images as :func:`rotate` does: counter-clockwise as displayed, about the image centre by
default, at the input size. For volumes, use :func:`rotate3d`; to rotate, shift, scale and shear in one warp,
:class:`Affine`.

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

Args:
    angle: The angle through which to rotate. The tensor
      must have a shape of (B), where B is batch size.
    center: The center through which to rotate. The tensor
      must have a shape of (B, 2), where B is batch size and last
      dimension contains cx and cy.
    mode: interpolation mode to calculate output values
      ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values
      ``'zeros'`` | ``'border'`` | ``'reflection'``.
    align_corners: interpolation flag.

Returns:
    The rotated tensor with the same shape as the input.

See Also:
    - :func:`rotate`: the one-call form.
    - :class:`Affine`: a rotation with a translation, a scale and a shear in one warp.
    - :class:`~kornia.geometry.transform.Rot180`: a half turn by flipping both axes, without interpolation.

Example:
    >>> img = torch.rand(1, 3, 4, 4)
    >>> angle = torch.tensor([90.])
    >>> out = Rotate(angle)(img)
    >>> print(out.shape)
    torch.Size([1, 3, 4, 4])

c                óx   <€ V ^8„  d   QhRS[ P                  RS[S[ P                  R3,          RS[RS[RS[RR/# )r   rI   rJ   Nr|   r}   r~   r   r�   )r"   rõ   s   "€r#   r$   ÚRotate.__annotate__‚  sY   ø€ ÷ 1ñ 1á�|‰|ð1ñ ‘e—l‘l DÐ(Õ)ð1ñ ð	1ñ
 ð1ñ ð1ð 
ñ1r%   c                ó|   <€ \         SV `  4        \        V R V4       \        V RV4       W0n        W@n        WPn        R# )rI   rJ   N©rù   rú   r,   r|   r}   r~   )rû   rI   rJ   r|   r}   r~   rü   s   &&&&&&€r#   rú   ÚRotate.__init__‚  s9   ø€ ô 	‰ÑÔÜ" 4¨°%Ô8Ü" 4¨°6Ô:ØŒ	Ø!-ÔØ#0Ör%   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# rÿ   rK   )r"   rõ   s   "€r#   r$   r1  ‘  s'   ø€ ÷ hñ h™UŸ\™\ð h©e¯l©lñ hr%   c                ó„   € \        WP                  V P                  V P                  V P                  V P
                  4      # )a‰  Rotate an image batch around the configured center.

Args:
    input: Image tensor with shape ``(B, C, H, W)``, where
        :math:`B` is batch size, :math:`C` is channels, :math:`H` is
        height, and :math:`W` is width.

Returns:
    Rotated tensor with shape ``(B, C, H, W)``. The image extent is
    kept fixed; newly exposed pixels are filled according to
    ``self.padding_mode``.
)rž   rI   rJ   r|   r}   r~   r  s   &&r#   r  ÚRotate.forward‘  s0   € ô �eŸZ™Z¨¯©°d·i±iÀ×ARÑARÐTX×TfÑTfÓgÐgr%   ©r~   r|   r}   ©Nrî   rr   Tr  r  s   @@r#   r   r   Z  s'   ù‡ € ñ%÷N1õ 1÷h÷ hð hr%   c                   óX   a a€ ] tR tRt oRtRV3R lV 3R llltV3R lR ltRtVtV ;t	# )	r   i¡  aH  Shift an image by a stored translation in pixels (module form).

Build ``shifter = Translate(translation)``, then ``out = shifter(input)`` shifts ``(C, H, W)`` or ``(B, C, H, W)``
images by the ``(B, 2)`` translation ``(dx, dy)`` in pixels, as :func:`translate` does. To combine the shift with a
rotation, a scale and a shear, use :class:`Affine`.

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

Args:
    translation: tensor containing the amount of pixels to
      translate in the x and y direction. The tensor must have a shape of
      (B, 2), where B is batch size, last dimension contains dx dy.
    mode: interpolation mode to calculate output values
      ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values
      ``'zeros'`` | ``'border'`` | ``'reflection'``.
    align_corners: interpolation flag.

Returns:
    The translated tensor with the same shape as the input, except that one image shifted by ``B > 1``
    translations returns ``(B, C, H, W)``.

See Also:
    - :func:`translate`: the one-call form.
    - :class:`Affine`: a translation with a rotation, a scale and a shear in one warp.

Example:
    >>> img = torch.rand(1, 3, 4, 4)
    >>> translation = torch.tensor([[1., 0.]])
    >>> out = Translate(translation)(img)
    >>> print(out.shape)
    torch.Size([1, 3, 4, 4])

c          
      óJ   <€ V ^8„  d   QhRS[ P                  RS[RS[RS[RR/# )r   r_   r|   r}   r~   r   Nr   )r"   rõ   s   "€r#   r$   ÚTranslate.__annotate__Æ  sA   ø€ ÷ 1ñ 1á—\‘\ð1ñ ð1ñ ð	1ñ
 ð1ð 
ñ1r%   c                ób   <€ \         SV `  4        \        V R V4       W n        W0n        W@n        R# )r_   Nr3  )rû   r_   r|   r}   r~   rü   s   &&&&&€r#   rú   ÚTranslate.__init__Æ  s-   ø€ ô 	‰ÑÔÜ" 4¨¸ÔDØŒ	Ø!-ÔØ#0Ör%   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# rÿ   rK   )r"   rõ   s   "€r#   r$   r<  Ó  s'   ø€ ÷ dñ d™UŸ\™\ð d©e¯l©lñ dr%   c                ón   € \        WP                  V P                  V P                  V P                  4      # )af  Shift an image batch by the stored pixel translation.

Args:
    input: Image tensor with shape ``(B, C, H, W)``, where
        :math:`B` is batch size, :math:`C` is channels, :math:`H` is
        height, and :math:`W` is width.

Returns:
    Translated tensor with shape ``(B, C, H, W)``. Translation is
    measured in pixels along the x and y image axes.
)r¨   r_   r|   r}   r~   r  s   &&r#   r  ÚTranslate.forwardÓ  s,   € ô ˜× 0Ñ 0°$·)±)¸T×=NÑ=NÐPT×PbÑPbÓcÐcr%   r8  ©rî   rr   Tr  r  s   @@r#   r   r   ¡  s'   ù‡ € ñ"÷H1õ 1÷d÷ dð dr%   c                   óX   a a€ ] tR tRt oRtRV3R lV 3R llltV3R lR ltRtVtV ;t	# )	r   iâ  aó  Zoom an image about its centre by a stored scale factor, keeping its size (module form).

Build ``zoomer = Scale(scale_factor)``, optionally with ``center``, then ``out = zoomer(input)`` scales the content
of ``(C, H, W)`` or ``(B, C, H, W)`` images as :func:`scale` does, at the input size. To change the image size
instead, use :class:`Rescale` or :class:`Resize`.

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

Args:
    scale_factor: The scale factor apply. The tensor
      must have a shape of (B) or (B, 2), where B is batch size.
      If (B), isotropic scaling will perform.
      If (B, 2), x-y-direction specific scaling will perform.
    center: The center through which to scale. The tensor
      must have a shape of (B, 2), where B is batch size and last
      dimension contains cx and cy.
    mode: interpolation mode to calculate output values
      ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values
      ``'zeros'`` | ``'border'`` | ``'reflection'``.
    align_corners: interpolation flag.

Returns:
    The scaled tensor with the same shape as the input.

See Also:
    - :func:`scale`: the one-call form.
    - :class:`Rescale`: change the image size by a factor instead.
    - :class:`Affine`: a scale with a rotation, a translation and a shear in one warp.

Example:
    >>> img = torch.rand(1, 3, 4, 4)
    >>> scale_factor = torch.tensor([[2., 2.]])
    >>> out = Scale(scale_factor)(img)
    >>> print(out.shape)
    torch.Size([1, 3, 4, 4])

c                óx   <€ V ^8„  d   QhRS[ P                  RS[S[ P                  R3,          RS[RS[RS[RR/# )r   rª   rJ   Nr|   r}   r~   r   r�   )r"   rõ   s   "€r#   r$   ÚScale.__annotate__  sY   ø€ ÷ 1ñ 1á—l‘lð1ñ ‘e—l‘l DÐ(Õ)ð1ñ ð	1ñ
 ð1ñ ð1ð 
ñ1r%   c                ó|   <€ \         SV `  4        \        V R V4       \        V RV4       W0n        W@n        WPn        R# )rª   rJ   Nr3  )rû   rª   rJ   r|   r}   r~   rü   s   &&&&&&€r#   rú   ÚScale.__init__  s9   ø€ ô 	‰ÑÔÜ" 4¨¸ÔFÜ" 4¨°6Ô:ØŒ	Ø!-ÔØ#0Ör%   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# rÿ   rK   )r"   rõ   s   "€r#   r$   rE    s'   ø€ ÷ nñ n™UŸ\™\ð n©e¯l©lñ nr%   c                ó„   € \        WP                  V P                  V P                  V P                  V P
                  4      # )au  Scale an image batch around the configured center point.

Args:
    input: Image tensor with shape ``(B, C, H, W)``, where
        :math:`B` is batch size, :math:`C` is channels, :math:`H` is
        height, and :math:`W` is width.

Returns:
    Scaled tensor with the same shape as ``input``. The sampling grid
    is built from ``self.scale_factor`` and ``self.center``.
)rO   rª   rJ   r|   r}   r~   r  s   &&r#   r  ÚScale.forward  s2   € ô �U×-Ñ-¨t¯{©{¸D¿I¹IÀt×GXÑGXÐZ^×ZlÑZlÓmÐmr%   r8  r9  r  r  s   @@r#   r   r   â  s'   ù‡ € ñ&÷P1õ 1÷n÷ nð nr%   c                   óX   a a€ ] tR tRt oRtRV3R lV 3R llltV3R lR ltRtVtV ;t	# )	r   i)  a²  Shear an image by stored raw shear factors about pixel (0, 0) (module form).

Build ``shearer = Shear(shear)``, then ``out = shearer(input)`` shears ``(C, H, W)`` or ``(B, C, H, W)`` images by
the ``(B, 2)`` raw factors ``(shx, shy)``, as :func:`shear` does, except that ``align_corners`` defaults to
``True`` here and to ``False`` in the function. For shear angles in radians about the image centre, use
:class:`Affine`, which shears by their negative tangent, so values below ``pi / 2`` in magnitude shear the other
way there.

Convention:
    - align_corners: ``True`` by default (differs from function :func:`shear`, whose default is
      ``False``)
    - See the convention block of :func:`shear`.

Args:
    shear: tensor containing raw shear factors
      in the x and y direction about pixel (0, 0). The tensor must have a shape of
      (B, 2), where B is batch size, last dimension contains shx shy.
    mode: interpolation mode to calculate output values
      ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values
      ``'zeros'`` | ``'border'`` | ``'reflection'``.
    align_corners: interpolation flag.

Returns:
    The skewed tensor with the same shape as the input, except that one image sheared by ``B > 1`` pairs of
    factors returns ``(B, C, H, W)``.

See Also:
    - :func:`shear`: the one-call form, which defaults to ``align_corners=False``.
    - :class:`Affine`: shear angles in radians about the image centre, which shear the other way below
      ``pi / 2``.

Example:
    >>> img = torch.rand(1, 3, 4, 4)
    >>> shear_factor = torch.tensor([[0.5, 0.0]])
    >>> out = Shear(shear_factor)(img)
    >>> print(out.shape)
    torch.Size([1, 3, 4, 4])

c          
      óJ   <€ V ^8„  d   QhRS[ P                  RS[RS[RS[RR/# )r   ru   r|   r}   r~   r   Nr   )r"   rõ   s   "€r#   r$   ÚShear.__annotate__S  s9   ø€ ÷ 1ñ 1Ù—\‘\ð1Ù),ð1ÙILð1Ùgkð1à	ñ1r%   c                ób   <€ \         SV `  4        \        V R V4       W n        W0n        W@n        R# )ru   Nr3  )rû   ru   r|   r}   r~   rü   s   &&&&&€r#   rú   ÚShear.__init__S  s-   ø€ ô 	‰ÑÔÜ" 4¨°%Ô8ØŒ	Ø!-ÔØ#0Ör%   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# rÿ   rK   )r"   rõ   s   "€r#   r$   rM  \  s'   ø€ ÷ Zñ Z™UŸ\™\ð Z©e¯l©lñ Zr%   c                ón   € \        WP                   V P                  V P                  V P                  4      # )a‘  Skew an image batch with the configured x/y shear factors.

Args:
    input: Image tensor with shape ``(B, C, H, W)``, where
        :math:`B` is batch size, :math:`C` is channels, :math:`H` is
        height, and :math:`W` is width.

Returns:
    Sheared tensor with shape ``(B, C, H, W)``. The output image
    size is unchanged; pixels outside the sampled area use the
    configured padding mode.
)ru   r|   r}   r~   r  s   &&r#   r  ÚShear.forward\  s)   € ô �UŸJ™J¨¯	©	°4×3DÑ3DÀd×FXÑFXÓYÐYr%   r8  rB  r  r  s   @@r#   r   r   )  s'   ù‡ € ñ'÷R1õ 1÷Z÷ Zð Zr%   )r   r   r   r   r   r   r   rŠ   r�   rò   rß   rè   rž   r¤   rO   ru   r¨   rø   rB  )rî   rr   Fr9  )Nrî   rr   F)r¶   r  )rî   NNF)rî   NF)5r
  rå   Útypingr   r   r   r    r   Úkornia.core._compatr   Úkornia.core.checkr   Úkornia.core.opsr   r	   Úkornia.core.utilsr
   Úkornia.filtersr   Úimgwarpr   r   r   r   r   Ú__all__r,   rA   rG   rQ   r]   rn   rs   ry   rŠ   r�   rž   r¤   r¨   rO   ru   r¼   rß   rè   rò   r   r   r   r   r   r   r   r   r  r%   r#   Ú<module>r[     sA  ðñ$ó0 ß )Ñ )ã Ý å 9Ý 0ß 5Ý 3Ý *ç uÕ uò€õ*>÷T÷&^õõõ.õõ÷R÷jA÷P\[÷~`]÷FC^÷LIZ÷XJX÷Z	4÷N÷b@y÷FMnô`O
ˆR�Y‰Yô O
ôdUdˆR�Y‰Yô UdôpGvˆb�i‰iô GvôTDhˆR�Y‰Yô DhôN>d�—	‘	ô >dôBDnˆB�I‰Iô DnôN@ZˆB�I‰Iö @Zr%   