+
    åûj<$ ã                  ó  € R t ^ RIHt ^ RIHt ^ RIt^ RIHu Ht	 ^ RI
HtHt ^ RIHt ^ RIHtHtHtHtHtHtHtHtHt ^ RIHtHtHtHtHtHtH t H!t!H"t"H#t# ^ RI$H%t%H&t& ^ R	I'H(t( . R`Ot)R
 R lt*R R lt+R R lt,R R lt-R R lt.RaR R llt/R R lt0R R lt1RbR R llt2R R lt3RbR R llt4RcR  R! llt5R" R# lt6R$ R% lt7R& R' lt8R( R) lt9R* R+ lt:R, R- lt;R. R/ lt<R0 R1 lt=R2 R3 lt>R4 R5 lt?R6 R7 lt@R8 R9 ltAR: R; ltBRdR< R= lltCR> R? ltDReR@ RA lltERB RC ltFReRD RE lltGRfRF RG lltHRfRH RI lltIRJ RK ltJRgRL RM lltKRN RO ltLRP RQ ltMRR RS ltNRT RU ltORV RW ltPRhRX RY lltQRiRZ R[ lltRR\ R] ltSRjR^ R_ lltTR# )ku 	  Warp images and volumes by matrices or sampling maps, and build the matrices the warps take.

The matrix warps take channels-first images ``(B, C, H, W)`` or volumes ``(B, C, D, H, W)`` and return the size
``dsize``, ``(h, w)`` or ``(d, h, w)``. Their matrix maps **source** pixel coordinates to **destination** pixel
coordinates, with pixel centres at integers and ``x`` the column, except that :func:`homography_warp` and
:func:`homography_warp3d` take a destinationâ†’source homography, in normalized :math:`[-1, 1]` coordinates by default.
``align_corners`` defaults differ between these functions, and ``warp_affine3d``, ``warp_perspective3d`` and
``homography_warp3d`` in normalized coordinates are correct only at ``align_corners=True``
(`#4503 <https://github.com/kornia/kornia/issues/4503>`_).

Which function to use:

- An image by a pixel homography or affine matrix: :func:`warp_perspective` ``(B, 3, 3)`` or :func:`warp_affine`
  ``(B, 2, 3)``; a volume: :func:`warp_perspective3d` ``(B, 4, 4)`` or :func:`warp_affine3d` ``(B, 3, 4)``.
- An image or a volume by a destinationâ†’source homography in normalized coordinates: :func:`homography_warp`,
  :func:`homography_warp3d`.
- An image at given per-pixel source coordinates: :func:`remap`. The warped sampling grid alone, without sampling:
  :func:`warp_grid`, :func:`warp_grid3d`.
- A homography from four point pairs: :func:`get_perspective_transform`; from 3D box corners:
  :func:`get_perspective_transform3d`.
- A 2D affine matrix from parameters: rotation and scale :func:`get_rotation_matrix2d`, translation
  :func:`get_translation_matrix2d`, shear :func:`get_shear_matrix2d`, all of them :func:`get_affine_matrix2d`.
- A 3D affine matrix from parameters: rotation and scale :func:`get_projective_transform`, shear
  :func:`get_shear_matrix3d`, all of them :func:`get_affine_matrix3d`.
- The inverse of a ``(B, 2, 3)`` affine matrix: :func:`invert_affine_transform`. ``[R | t]`` from a rotation and a
  translation: :func:`projection_from_Rt`.
- To rotate, shift, scale or shear an image by parameters and keep its size, without building a matrix, use
  :func:`~kornia.geometry.transform.rotate`, :func:`~kornia.geometry.transform.translate`,
  :func:`~kornia.geometry.transform.scale` or :func:`~kornia.geometry.transform.shear`.
)Úannotations)ÚOptionalN)ÚKORNIA_CHECKÚKORNIA_CHECK_SHAPE)Úeye_like)	Ú_autocast_disabledÚ_inverse_3x3_closed_formÚ _normalize_to_float32_or_float64Ú_reconcile_under_autocastÚ_samples_half_in_float32Ú_torch_grid_sampleÚ_torch_inverse_castÚ_torch_solve_castÚis_exporting)
Úangle_to_rotation_matrixÚaxis_angle_to_rotation_matrixÚ"convert_affinematrix_to_homographyÚ$convert_affinematrix_to_homography3dÚconvert_points_from_homogeneousÚnormal_transform_pixelÚnormal_transform_pixel3dÚnormalize_homographyÚnormalize_homography3dÚnormalize_pixel_coordinates)Úcreate_meshgridÚcreate_meshgrid3d)Útransform_pointsc               ó$   € V ^8„  d   QhRRRRRR/# )é   Úsrcútorch.TensorÚ	transformÚreturnútorch.dtype© )Úformats   "Ú]C:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\geometry\transform\imgwarp.pyÚ__annotate__r'   l   s!   € ÷ ;ñ ; ð ;¸,ð ;È;ñ ;ó    c                ó¶   € VP                  4       '       g   \        RVP                   R24      h\        P                  ! V P                  VP                  4      # )aÜ  Return the sampling-grid dtype the non-empty matrix-warp pipeline would build.

``normalize_homography`` scales ``transform`` by floating factors, so an integral or boolean
matrix already fails there and must fail here too. Otherwise the base grid is created in
``src.dtype`` and combined with the normalized matrix, so the grid promotes the two: a float32
matrix against a float64 image still samples in float64, while the reverse narrows and is
rejected by ``grid_sample``.
z)Expected a floating point transform, got Ú.)Úis_floating_pointÚRuntimeErrorÚdtypeÚtorchÚpromote_types)r   r!   s   &&r&   Ú_matrix_warp_grid_dtyper0   l   sI   € ð ×&Ñ&×(Ò(ÜÐFÀyÇÁÐFWÐWXÐYÓZÐZÜ×Ò˜sŸy™y¨)¯/©/Ó:Ð:r(   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úmap_xyr    Únormalized_coordinatesÚboolr"   r#   r$   )r%   s   "r&   r'   r'   z   s!   € ÷ 0ñ 0˜lð 0ÀDð 0È[ñ 0r(   c                ó¨   € V'       g   V P                  4       '       d   V P                  # V P                  R4      R,          R,          P                  # )a[  Return the sampling-grid dtype the non-empty :func:`remap` pipeline would build.

Already-normalized maps reach ``grid_sample`` untouched. Pixel maps first go through
:func:`~kornia.geometry.conversions.normalize_pixel_coordinates`, which keeps a floating map in
its own dtype and lifts an integral or boolean one into the default floating dtype.
:Né    Nç      ð?éÿÿÿÿ)r+   r-   Úreshape)r2   r3   s   &&r&   Ú_remap_grid_dtyper:   z   s@   € ÷  ×!9Ñ!9×!;Ò!;Ø�|‰|Ðð �N‰N˜2Ó˜rÕ" SÕ(×/Ñ/Ð/r(   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r   r    Úotherr"   r4   r$   )r%   s   "r&   r'   r'   ˆ   s&   € ÷ Fñ F˜,ð F¨|ð FÀñ Fr(   c                óZ   € \        V 4      ;'       d    VP                  V P                  8H  # )a¾  Return whether a warp of ``src`` builds its sampling grid and samples in float32.

torch's CPU float16/bfloat16 ``grid_sample`` returns wrong values, NaN and up to 3.4e38 once
the source is about 128 px or larger (torch 2.9.1 and 2.14), and torch 2.5.1 has no such kernel
at all; a half-precision sampling grid is also off by more than half a pixel at 256 px in
bfloat16 (#5751). That grid error does not depend on the device: a bfloat16 ``warp_affine`` of a
256 px ``[0, 1]`` image was off by up to 0.98 on CUDA and on MPS, whose half bilinear kernels
sample a given grid as float32 does, and torch's half 3D ``affine_grid`` raises for a size-1
output axis on every device (#5814). A half warp therefore builds its grid and samples in float32
on every device and returns the input dtype, as the LAF patch extractors already do. A mismatched
``other`` (transform or map) keeps the half path, so it is rejected exactly as before. Other dtypes
are unaffected.
)r   r-   )r   r<   s   &&r&   Ú_runs_in_float32r>   ˆ   s$   € ô $ CÓ(×EÐE¨U¯[©[¸C¿I¹IÑ-EÐEr(   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r   r    Úpadding_modeÚstrr"   r$   )r%   s   "r&   r'   r'   ™   s!   € ÷ &ñ &˜\ð &¸ð &Àñ &r(   c                óš  € VR9  d   V # . p\         P                  P                  4       '       Eg   \         P                  P                  4       '       g   \	        4       '       dÓ   \        V P                  4       ^,
          ^R4       F6  pV P                  V,          pV^ V^V^,           ,          ,          .,          pK8  	  \         P                  P                  4       '       g=   \        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       d   V # \        P                  ! W4      # ^V P                  R,          9  g   V P                  4       ^ 8X  d   V # \        V P                  4       ^,
          ^R4       F+  pV^ \        V P                  V,          ^8H  4      .,          pK-  	  \        P                  ! W4      # )a×  Give each one-pixel spatial axis of ``src`` a zero pixel, for sampling by a matrix with ``align_corners=True``.

``grid_sample`` reads the position ``(g + 1) / 2 * (size - 1)`` there, so every sample along a one-pixel axis lands
on its pixel, and ``'zeros'`` and ``'fill'`` never apply (#6433). A zero pixel behind it gives the axis an extent,
and leaves its pixel at coordinate 0, so a pixel matrix needs no shift: the only pixel is then the first of two,
sampled by the arithmetic of any longer axis, with the same tie for ``mode="nearest"``. :func:`_fill_and_warp` pads
its mask the same way. ``'border'`` and ``'reflection'`` need nothing: outside the axis they read that same pixel,
which is what landing on it gives, so ``src`` comes back as it is.

An axis longer than one pixel is untouched, and ``src`` itself comes back when every axis is, in eager and scripted
calls, in ``torch.compile``, which recompiles for the other side of the test, and in the export of a static shape.
Eager, this costs about 0.5 us of a warp's 140 us or more (x86 CPU, 16 px). A trace or a program exported with
dynamic axes always holds the pad instead, by 0 for a longer axis, which keeps the values and adds one copy of the
image, because a test of a size known only at run time would freeze the side a trace saw, and be a guard of an
exported program that rejects the other side. So do ``torch.export`` with ``strict=True``, and ``torch.compile``
before torch 2.12, where :func:`is_exporting` also holds.
c              3  ó^   "  € T F#  p\        V4      \        J ;'       d    V^ 8H  x € K%  	  R# 5i)r6   N)ÚtypeÚint)Ú.0Úamounts   & r&   Ú	<genexpr>Ú&_pad_one_pixel_axes.<locals>.<genexpr>·   s.   é € Ð;rÑnqÐdj¼DÀ»LÌCÐ<O×<_Ð<_ÐTZÐ^_ÑT_Ô<_Ónqùs   ‚-Ÿ-FT:r   NN)ÚzerosÚfillr8   )r.   ÚjitÚis_scriptingÚ
is_tracingr   ÚrangeÚdimÚshapeÚcompilerÚis_dynamo_compilingÚallÚFÚpadÚnumelrE   )r   r@   rV   ÚaxisÚsizes   &&   r&   Ú_pad_one_pixel_axesrZ   ™   sB  € ð$ Ð,Ô,Øˆ
Ø€CÜ�9‰9×!Ñ!×#Ó#¬¯©×)=Ñ)=×)?Ò)?Ä<Ç>Â>Ü˜#Ÿ'™'›) a�-¨¨BÖ/ˆDð
 —9‘9˜T•?ˆDØ�A�t˜q T¨A¥X�Õ/Ð0Õ0ŠCñ 0ô �~‰~×1Ñ1×3Ò3¿»Ñ;rÑnqÓ;r¿¿ºÑ;rÑnqÓ;r×8rÒ8rØˆJÜ�uŠu�S‹Ðà�—	‘	˜"•Ô §¡£°Ô!1Øˆ
Ü�c—g‘g“i !•m Q¨Ö+ˆØ�”3�s—y‘y •¨!Ñ+Ó,Ð-Õ-Šñ ,ä�5Š5�‹?Ðr(   c               ó    € V ^8„  d   QhRRRR/# ©r   Úmatrixr    r"   r$   )r%   s   "r&   r'   r'   Â   s   € ÷ >ñ > <ð >°Lñ >r(   c                óÌ  € V P                  4       P                  4       pVP                  RRR7      pVP                  V^ 8H  \	        R4      4      P                  RRR7      p\        P                  ! V\        P                  ! V4      4      P                  V4      pV^ 8„  \        P                  ! V4      ,          p\        P                  ! WT\        P                  ! V4      4      # )a  Return the detached projective scale of ``matrix``: the value closest to 1 in its nonzero-magnitude range.

A homography and any nonzero multiple of it describe the same map, yet
:func:`kornia.geometry.convert_points_from_homogeneous` leaves a point with ``|w| <= eps``
undivided using an *absolute* ``eps``. Feeding that routine a grid built from an arbitrarily
scaled matrix therefore changes the sampled pixels instead of the warp. Dividing by this scale
first puts every equivalent matrix in the same numeric range. Choosing between the largest and
smallest nonzero magnitude, rather than just dividing by the largest, keeps a unit diagonal from
being shrunk toward zero by large translations. The scale is a projective gauge, so detaching it
leaves the warp's derivative unchanged.
T©rP   ÚkeepdimÚinf©éþÿÿÿr8   )ÚdetachÚabsÚamaxÚmasked_fillÚfloatÚaminr.   ÚminimumÚ	ones_likeÚ	clamp_minÚisfiniteÚwhere)r]   Ú	magnitudeÚlargestÚsmallestÚscaleÚusables   &     r&   Ú_unit_projective_scalert   Â   s¬   € ð —‘“×#Ñ#Ó%€IØ�n‰n °4ˆnÓ8€GØ×$Ñ$ Y°!¡^´U¸5³\ÓB×GÑGÈHÐ^bÐGÓc€HÜ�MŠM˜'¤5§?¢?°7Ó#;Ó<×FÑFÀxÓP€Eð �a‰iœ5Ÿ>š>¨%Ó0Õ0€FÜ�;Š;�v¤e§o¢o°eÓ&<Ó=Ð=r(   c               óH   € V ^8„  d   QhRRRRRRRRRRR	R
RRRRRRRR
RRRR/# )r   r   r    r!   Údsizeútuple[int, int]ÚmoderA   r@   Úalign_cornersr4   Ú
grid_dtyper#   Ú
fill_valueúOptional[torch.Tensor]Útransform_batch_broadcastÚ
allow_fillÚoperandr"   r$   )r%   s   "r&   r'   r'   Ø   sœ   € ÷ W\ñ W\Ø	ðW\àðW\ð ðW\ð ð	W\ð
 ðW\ð ðW\ð ðW\ð 'ðW\ð  #ðW\ð ðW\ð ðW\ð ñW\r(   c                óL  € V P                   VP                   8w  d*   \        RV
 RV P                    RVP                    R24      hV P                  4       '       g   \        RV P                   R24      hW`P                  8w  d*   \        RV
 RV P                   RVP                   R24      hV P                  VP                  8w  d   VP                  V P                  4      pV P                  ^ ,          pVP                  ^ ,          pVR8H  ;'       g    VR8H  ;'       d    V^8„  pV^8X  d   V'       d   TpWË8w  d'   \        RV
 R	V RVP                  ^ ,           R24      h\        V^4      p\        V P                  ^,          ^4      pVP                  R4      R
,          P                  4       R,          pVP                  ^^^^4      P                  V^^^4      pV P                  R4      R
,          P                  4       R,          pVP                  ^^^^4      P                  Wï^^4      pVR8X  dm   V	'       de   Vf-   \        P                  ! WðP                   V P                  R7      p\        VVVVVW°P                  ^,          V^ ,          V^,          .R7      pM\        VVWSVR7      pVP                  R4      R
,          P                  4       R,          pVP                  ^^^^4      P                  W°P                  ^,          V^ ,          V^,          4      # )u³  Return an empty warp while retaining normal grid-sample validation and autograd links.

``operand`` names the second tensor in the error messages. ``remap`` has no ``transform``
parameter â€” it delegates here with its stacked maps â€” so it must not be told about one.

``transform_batch_broadcast`` names the caller's singleton-batch rule, so the empty
destination broadcasts and rejects exactly as its non-empty path does:
``"none"`` requires equal batches (``warp_perspective``), ``"src_when_larger"`` expands a
singleton transform batch only to a source batch above one (``warp_affine``), and ``"src"``
expands it to the source batch unconditionally, a zero batch included (``remap``).
zExpected src and z on the same device, got ú and r*   ú#Expected a floating point src, got z with the same dtype, got r   Úsrc_when_largerz with the same batch size, got ºNé   Nç        rK   ©Údevicer-   )ry   rx   r{   Ú	out_shape©ry   rx   r@   r8   )rˆ   r,   r+   ÚNotImplementedErrorr-   ÚtorQ   Úmaxr9   ÚsumÚexpandr.   rJ   Ú_fill_and_warpr   )r   r!   rv   rx   r@   ry   rz   r{   r}   r~   r   Ú	src_batchÚtransform_batchÚbroadcasts_singletonÚsample_batchÚsample_channelsÚ	grid_zeroÚgridÚsrc_zeroÚ
sample_srcÚsampledÚout_zeros   &&&&&&&&&&&           r&   Ú_empty_warp_output_2drœ   Ø   sî  € ð0 ‡z�z�Y×%Ñ%Ô%ÜÐ.¨w¨iÐ7PÐQT×Q[ÑQ[ÐP\Ð\aÐbk×brÑbrÐasÐstÐuÓvÐvð × Ñ ×"Ò"Ü!Ð$GÈÏ	É	À{ÐRSÐ"TÓUÐUð —Y‘YÔÜÐ.¨w¨iÐ7QÐRU×R[ÑR[ÐQ\Ð\aÐbk×bqÑbqÐarÐrsÐtÓuÐuØ
‡y�y�I—O‘OÔ#Ø—L‘L §¡Ó+ˆ	ð —	‘	˜!•€IØ—o‘o aÕ(€OØ4¸Ñ=÷ ð Ø!Ð%6Ñ6×HÐH¸9Àq¹=ð ð ˜!Ô× 4Ø#ˆØÔ#ÜØ ˜yÐ(GÈ	À{ÐRWÐXa×XgÑXgÐhiÕXjÐWkÐklÐmó
ð 	
ô �y !Ó$€LÜ˜#Ÿ)™) A�,¨Ó*€OØ×!Ñ! "Ó% bÕ)×-Ñ-Ó/°#Õ5€IØ×Ñ˜Q  1 aÓ(×/Ñ/°¸aÀÀAÓF€Dà�{‰{˜2‹˜rÕ"×&Ñ&Ó(¨3Õ.€HØ×!Ñ! ! Q¨¨1Ó-×4Ñ4°\ÐTUÐWXÓY€Jà�vÔ§*ØÒÜŸš _¿Z¹ZÈsÏyÉyÔYˆJÜ ØØØ'ØØ!Ø §)¡)¨A¥,°°aµ¸%À½(ÐCô
‰ô %Ø˜¨MÐS_ô
ˆð �‰˜rÓ" 2Õ&×*Ñ*Ó,¨sÕ2€HØ×Ñ˜A˜q ! QÓ'×.Ñ.¨y¿)¹)ÀA½,ÈÈaÍÐRWÐXYÕRZÓ[Ð[r(   c               ó4   € V ^8„  d   QhRRRRRRRRRRR	R
RR/# )r   r   r    r!   rv   útuple[int, int, int]rx   rA   r@   ry   r4   r"   r$   )r%   s   "r&   r'   r'   2  sW   € ÷ sñ sØ	ðsàðsð  ðsð ð	sð
 ðsð ðsð ñsr(   c                óø  € V P                   VP                   8w  d'   \        RV P                    RVP                    R24      hV P                  4       '       g   \        RV P                   R24      hV P                  VP                  8w  d'   \        RV P                   RVP                   R24      hVP                  R	4      R,          P                  4       R,          pVP                  ^^^^^4      P                  VP                  ^ ,          V^ ,          V^,          V^,          ^4      pT pV P                  R
,          ^ 8X  g1   V P                  R,          ^ 8X  g   V P                  R	,          ^ 8X  dx   V P                  R	4      R,          P                  4       R,          p	V	P                  ^^^^^4      P                  V P                  ^ ,          V P                  ^,          ^^^4      p\        W‡WSVR7      # )zRReturn an empty volume warp with normal grid-sample validation and autograd links.z3Expected src and transform on the same device, got r�   r*   r‚   z4Expected src and transform with the same dtype, got r„   r†   rŠ   r8   éýÿÿÿrc   )
rˆ   r,   r+   r‹   r-   r9   rŽ   r�   rQ   r   )
r   r!   rv   rx   r@   ry   r–   r—   r™   r˜   s
   &&&&&&    r&   Ú_empty_warp_output_3dr¡   2  s·  € ð ‡z�z�Y×%Ñ%Ô%ÜÐPÐQT×Q[ÑQ[ÐP\Ð\aÐbk×brÑbrÐasÐstÐuÓvÐvð × Ñ ×"Ò"Ü!Ð$GÈÏ	É	À{ÐRSÐ"TÓUÐUØ
‡y�y�I—O‘OÔ#ÜÐQÐRU×R[ÑR[ÐQ\Ð\aÐbk×bqÑbqÐarÐrsÐtÓuÐuØ×!Ñ! "Ó% bÕ)×-Ñ-Ó/°#Õ5€IØ×Ñ˜Q  1 a¨Ó+×2Ñ2°9·?±?À1Õ3EÀuÈQÅxÐQVÐWXÕQYÐ[`ÐabÕ[cÐefÓg€Dà€JØ
‡y�y�…}˜Ô˜SŸY™Y r�]¨aÔ/°3·9±9¸Rµ=ÀAÔ3EØ—;‘;˜r“? 2Õ&×*Ñ*Ó,¨sÕ2ˆØ×%Ñ% a¨¨A¨q°!Ó4×;Ñ;¸C¿I¹IÀa½LÈ#Ï)É)ÐTUÍ,ÐXYÐ[\Ð^_Ó`ˆ
Ü˜j¸mÐeqÔrÐrr(   c          
     ó,   € V ^8„  d   QhRRRRRRRRRR/# ©	r   r   r    ÚMrv   rw   ry   r4   r"   r$   )r%   s   "r&   r'   r'   M  s4   € ÷ ')ñ ')Ø	ð')Ø&ð')Ø/>ð')ØOSð')àñ')r(   c           	     ó8  € V P                  4       w  rErgVw  r‰VP                  4       '       d   V\        V4      ,          p\        WV3W‰3VR7      p
\	        V
4      p\        W‰RV P                  V P                  VR7      p\        P                  P                  4       '       d%   \        VR,          VP                  WHV	^4      4      # VR,          VR,          ríTpVR,          V,          VR	,          V,          ,           VR
,          ,           pVR,          V,          VR,          V,          ,           VR,          ,           V,          pVR,          V,          VR,          V,          ,           VR,          ,           V,          p\        P                  ! VV.RR7      # )z_Build the ``(B, h, w, 2)`` sampling grid of :func:`warp_perspective` from its pixel homography.©ry   T©r3   rˆ   r-   ry   ©rP   )ºNNNNN©.r6   ©.r…   )r©   r   r6   NN)r©   r   r…   NN)r©   r   r   NN©r©   r6   r6   NN©r©   r6   r…   NN©r©   r6   r   NN©r©   r…   r6   NN©r©   r…   r…   NN©r©   r…   r   NNr8   )rY   r+   rt   r   r   r   rˆ   r-   r.   rL   rN   r   r�   Ústack)r   r¤   rv   ry   ÚBÚ_ÚHÚWÚh_outÚw_outÚdst_norm_trans_src_normÚsrc_norm_trans_dst_normr—   Úgx0Úgy0ÚmÚdenomÚgxÚgys   &&&&               r&   Ú_warp_perspective_gridrÁ   M  sq  € ð —‘“�J€Aˆ!Ø�L€Eð
 	×Ñ×ÒØÔ& qÓ)Õ)ˆä,@Ø	ˆqˆ6�E�>°ô-Ðô 7Ð7NÓOÐô Ø¨T¸#¿*¹*ÈCÏIÉIÐerô€Dô ‡y�y×Ñ×ÒäÐ 7¸Õ FÈÏÉÐTUÐ^cÐefÓHgÓhÐhð �F�|˜T &�\ˆØ€AØÐ!Õ" SÕ(¨1Ð-@Õ+AÀCÕ+GÕGÈ!ÐL_ÕJ`Õ`€EØ
ÐÕ
  3Õ
&¨Ð+>Õ)?À#Õ)EÕ
EÈÐJ]ÕH^Õ
^ÐbgÕ	g€BØ
ÐÕ
  3Õ
&¨Ð+>Õ)?À#Õ)EÕ
EÈÐJ]ÕH^Õ
^ÐbgÕ	g€BÜ�;Š;˜˜B�x RÔ(Ð(r(   c               ó8   € V ^8„  d   QhRRRRRRRRRRR	R
RRRR/# ©r   r   r    r¤   rv   rw   rx   rA   r@   ry   r4   r{   r|   r"   r$   )r%   s   "r&   r'   r'   w  sb   € ÷ Añ AØ	ðAàðAð ðAð ð	Að
 ðAð ðAð 'ðAð ñAr(   c                ór  € \        V \        P                  4      '       g   \        R\	        V 4       24      h\        V\        P                  4      '       g   \        R\	        V4       24      h\        V P                  4      ^8X  g   \        RV P                   24      h\        VP                  4      ^8X  d   VP                  RR R8X  g   \        RVP                   24      hVw  rxV^ 8  g   V^ 8  d   \        RV R24      hV^ 8X  g   V^ 8X  d   \        WW#WE\        W4      V4      # V P                  p	\        W4      '       d    V P                  4       VP                  4       r\        P                  P                  4       '       g   \        W4      w  rV'       d   \!        W4      MT p
\        P                  P                  4       '       d   \#        W¡Wx3V4      pM>\%        V P&                  P                  4      ;_uu_ 4        \#        W¡Wx3V4      pRRR4       VR8X  da   Vf?   \        P(                  ! V P                  ^,          V P&                  V P                  R	7      p\+        V XWSVR
7      P-                  V	4      # \/        V
XWSVR7      P-                  V	4      #   + '       g   i     L•; i)uC  Warp an image by a sourceâ†’destination homography in pixel coordinates.

``out = warp_perspective(src, M, dsize)`` takes images ``(B, C, H, W)`` and one ``(B, 3, 3)`` homography per image
that maps **source** pixels to **destination** pixels, and returns the ``(B, C, h, w)`` destination images for
``dsize = (h, w)``. Pixel centres are integers, so an identity ``M`` with a smaller ``dsize`` returns the top-left
``dsize`` window of the image, not a resized image. This is the warp for the homographies that
:func:`get_perspective_transform`, :func:`~kornia.geometry.homography.find_homography_dlt` and
:class:`~kornia.geometry.ransac.RANSAC` return; for a destinationâ†’source homography in normalized :math:`[-1, 1]`
coordinates, use :func:`homography_warp`, and for a ``(B, 2, 3)`` affine matrix, :func:`warp_affine`.

Each output pixel ``(x, y)`` samples the source at the inverse of ``M`` applied to it:

.. math::
    \text{dst} (x, y) = \text{src} \left(
    \frac{M^{-1}_{11} x + M^{-1}_{12} y + M^{-1}_{13}}{M^{-1}_{31} x + M^{-1}_{32} y + M^{-1}_{33}} ,
    \frac{M^{-1}_{21} x + M^{-1}_{22} y + M^{-1}_{23}}{M^{-1}_{31} x + M^{-1}_{32} y + M^{-1}_{33}}
    \right )

Convention:
    See :doc:`Conventions & Pitfalls </get-started/conventions>` for transform direction, pixel centres,
    normalized coordinates and ``align_corners`` sampling rules.

    - ``M`` is the sourceâ†’destination **pixel** homography ``(B, 3, 3)``
      (contrast :func:`homography_warp`, which by default consumes destinationâ†’source normalized)
    - ``M`` has the batch of ``src``: a ``(1, 3, 3)`` ``M`` is not shared by a larger batch, as it is in
      :func:`warp_affine`
    - a nonzero scalar multiple of ``M`` describes the same warp; uniformly small or large
      nonzero entries are rescaled toward unit magnitude before the coordinate change and inversion
    - a one-pixel source axis is sampled like a longer one, so positions outside it get ``padding_mode``. Under
      ``align_corners=True``, where ``grid_sample`` alone would land them all on that pixel, ``'zeros'`` and
      ``'fill'`` read it as the first of two pixels, the second holding the padding
      (`#6433 <https://github.com/kornia/kornia/issues/6433>`_)
    - ``src`` sets the dtype: a float32 ``M`` with a float64 ``src`` samples in float64, and a float64 ``M`` with a
      float32 ``src`` raises ``RuntimeError``
    - a caller's autocast region does not change the matrix arithmetic or the sampling grid, outside TorchScript
      (in the region, a ``src`` and ``M`` that mix float32 and half dtypes run in float32)
    - a zero output dimension returns an autograd-connected empty tensor;
      negative output dimensions raise ``ValueError``

Args:
    src: input image with shape ``(B, C, H, W)``.
    M: transformation matrix with shape ``(B, 3, 3)``.
    dsize: size of the output image (height, width).
    mode: interpolation mode to calculate output values ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values ``'zeros'`` | ``'border'`` | ``'reflection'``
        | ``'fill'``.
    align_corners: interpolation flag.
    fill_value: torch.Tensor of shape ``(C)`` or ``(1)`` that fills the padding area, or any shape that
        broadcasts to the output ``(B, C, h, w)`` without changing it, such as a per-sample ``(B, C, 1, 1)``
        fill. Defaults to zeros.

Returns:
    the warped input image ``(B, C, h, w)``, spatial sizes given by ``dsize``.

See Also:
    - :func:`homography_warp`: a destinationâ†’source homography, normalized to :math:`[-1, 1]` by default.
    - :func:`warp_perspective3d`: the same warp for ``(B, C, D, H, W)`` volumes by ``(B, 4, 4)`` homographies.
    - :func:`warp_affine`: a ``(B, 2, 3)`` affine matrix instead, where a single ``(1, 2, 3)`` one serves a batch.
    - :func:`get_perspective_transform`: the homography that maps four source points onto four destination points.
    - :func:`remap`: sample at given per-pixel source coordinates instead of by a matrix.
    - :func:`crop_by_transform_mat`: dispatches to this warp or :func:`warp_affine` by matrix shape, casting the
      matrix to the image dtype and broadcasting a batch-1 matrix.
    - :func:`~kornia.geometry.conversions.normalize_homography`: ``M`` in normalized :math:`[-1, 1]` coordinates,
      the conversion this warp applies before sampling.

Example:
   >>> img = torch.rand(1, 4, 5, 6)
   >>> H = torch.eye(3)[None]
   >>> out = warp_perspective(img, H, (4, 2), align_corners=True)
   >>> print(out.shape)
   torch.Size([1, 4, 4, 2])

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

ú*Input src type is not a torch.Tensor. Got ú(Input M type is not a torch.Tensor. Got ú.Input src must be a BxCxHxW torch.Tensor. Got Nz*Input M must be a Bx3x3 torch.Tensor. Got ú&Output size must be non-negative. Got r*   rK   r‡   ©ry   rx   r{   rŠ   rc   ©é   rË   )Ú
isinstancer.   ÚTensorÚ	TypeErrorrD   ÚlenrQ   Ú
ValueErrorrœ   r0   r-   r>   rh   rL   rM   r
   rZ   rÁ   r   rˆ   rJ   r�   rŒ   r   )r   r¤   rv   rx   r@   ry   r{   r·   r¸   Ú	out_dtyperš   r—   s   &&&&&&&     r&   Úwarp_perspectiverÒ   w  s+  € ôj �cœ5Ÿ<™<×(Ò(ÜÐDÄTÈ#ÃYÀKÐPÓQÐQä�aœŸ™×&Ò&ÜÐBÄ4ÈÃ7À)ÐLÓMÐMäˆs�y‰y‹>˜QÔÜÐIÈ#Ï)É)ÈÐUÓVÐVä�—‘‹L˜AÔ !§'¡'¨"¨# ,°&Ô"8ÜÐEÀaÇgÁgÀYÐOÓPÐPà�L€EØˆq„y�E˜A”IÜÐAÀ%ÀÈÐJÓKÐKØ�„z�U˜a”ZÜ$Ø�E Ô>UÐVYÓ>]Ð_ió
ð 	
ð —	‘	€IÜ˜×ÒØ—‘“˜aŸg™g›iˆQÜ�9‰9×!Ñ!×#Ò#Ü*¨3Ó2‰ˆß8EÔ! #Ô4È3€Gô ‡y�y×Ñ×ÒÜ% g°5°.À-ÓP‰ä §
¡
§¡×0Õ0Ü)¨'°u°nÀmÓTˆD÷ 1ð �vÔð ÒÜŸš S§Y¡Y¨q¥\¸#¿*¹*ÈCÏIÉIÔVˆJÜ˜c 4°}Ð\fÔg×jÑjÐktÓuÐuÜ˜g t¸=ÐbnÔo×rÑrØóð ÷ 1×0ús   È
J&Ê&J6	c          
     ó,   € V ^8„  d   QhRRRRRRRRRR/# r£   r$   )r%   s   "r&   r'   r'   û  s1   € ÷ ,)ñ ,)˜<ð ,)¨Lð ,)Àð ,)Ðaeð ,)Ðjvñ ,)r(   c                óF  € V P                  4       w  rErgVP                  ^ ,          p\        V4      p	\        W–V3W#R7      p
\	        V
4      p\
        P                  P                  4       '       d2   \        P                  ! VR,          W…V^ ,          V^,          .VR7      # Vw  rÍV'       dÆ   V^8X  d.   \
        P                  ! ^V P                  V P                  R7      M-\
        P                  ! RRWÐP                  V P                  R7      pV^8X  d.   \
        P                  ! ^V P                  V P                  R7      M-\
        P                  ! RRWÀP                  V P                  R7      pM”\
        P                  ! RRV,          ,           RRV,          ,
          WÐP                  V P                  R7      p\
        P                  ! RRV,          ,           RRV,          ,
          WÀP                  V P                  R7      p\
        P                  ! WþRR7      w  ppTpVR	,          V,          VR
,          V,          ,           VR,          ,           pVR,          V,          VR,          V,          ,           VR,          ,           p\
        P                  ! VV.RR7      # )z_Build the ``(B_M, h, w, 2)`` sampling grid of :func:`warp_affine` from its pixel affine matrix.r¦   r‡   r7   Úij)Úindexingr¨   ©r©   ºNr   Nr©   g      ð¿r¬   r­   r®   r¯   r°   r±   r8   )rY   rQ   r   r   r   r.   rL   rN   rU   Úaffine_gridrJ   rˆ   r-   ÚlinspaceÚmeshgridr²   )r   r¤   rv   ry   r´   ÚCrµ   r¶   ÚB_MÚM_3x3r¹   rº   r·   r¸   ÚxsÚysÚbase_yÚbase_xr½   r¿   rÀ   s   &&&&                 r&   Ú_warp_affine_gridrã   û  s  € à—‘“�J€Aˆ!Ø
�'‰'�!�*€Cä<¸QÓ?€EÜ,@ÀÈAÈÐPUÔ,sÐô 7Ð7NÓOÐô ‡y�y×Ñ×Òä�}Š}Ø# HÕ-°¸¸a½À%ÈÅ(Ð/KÐ[hô
ð 	
ð �L€Eßð ˜Œzô �KŠK˜ #§*¡*°C·I±IÕ>ä—’  c¨5¿¹È3Ï9É9ÔUð 	ð ˜Œzô �KŠK˜ #§*¡*°C·I±IÕ>ä—’  c¨5¿¹È3Ï9É9ÔUñ 	ô �^Š^˜D 3¨¥;Õ.°°c¸EµkÕ0AÀ5×Q[ÑQ[Ðcf×clÑclÔmˆÜ�^Š^˜D 3¨¥;Õ.°°c¸EµkÕ0AÀ5×Q[ÑQ[Ðcf×clÑclÔmˆÜ—^’^ B°TÔ:�N€FˆFØ€AØ	
ÐÕ	 &Õ	(¨1Ð-@Õ+AÀFÕ+JÕ	JÈQÐObÕMcÕ	c€BØ	
ÐÕ	 &Õ	(¨1Ð-@Õ+AÀFÕ+JÕ	JÈQÐObÕMcÕ	c€BÜ�;Š;˜˜B�x RÔ(Ð(r(   c               ó8   € V ^8„  d   QhRRRRRRRRRRR	R
RRRR/# rÃ   r$   )r%   s   "r&   r'   r'   *  sb   € ÷ Jñ JØ	ðJàðJð ðJð ð	Jð
 ðJð ðJð 'ðJð ñJr(   c                óB  € \        V \        P                  4      '       g   \        R\	        V 4       24      h\        V\        P                  4      '       g   \        R\	        V4       24      h\        V P                  4      ^8X  g   \        RV P                   24      h\        VP                  4      ^8X  d   VP                  RR R8X  g   \        RVP                   24      hV P                  ^ ,          pVP                  ^ ,          pV^ ,          ^ 8  g   V^,          ^ 8  d   \        RV R24      hV^ ,          ^ 8X  g   V^,          ^ 8X  d   \        V VVVVV\        W4      VRR	7	      # V P                  p	\        W4      '       d    V P                  4       VP                  4       r\        P                  P                  4       '       g   \        W4      w  rV'       d   \!        W4      MT p
\        P                  P                  4       '       d   \#        W¡W%4      pM<\%        V P&                  P                  4      ;_uu_ 4        \#        W¡W%4      pRRR4       \        P                  P)                  4       '       dc   \        P*                  ! \        P,                  ! V 4      ^ ,          \        P,                  ! V4      ^ ,          4      pXP/                  VRRR4      pM"V^8X  d   V^8”  d   XP/                  VRRR4      pVR
8X  da   Vf?   \        P0                  ! V P                  ^,          V P&                  V P                  R7      p\3        V XWSVR7      P5                  V	4      # \7        V
XWSVR7      P5                  V	4      #   + '       g   i     EL>; i)uí  Warp an image by a sourceâ†’destination affine matrix in pixel coordinates.

``out = warp_affine(src, M, dsize)`` takes images ``(B, C, H, W)`` and ``(B, 2, 3)`` affine matrices that map
**source** pixels to **destination** pixels, and returns the ``(B, C, h, w)`` destination images for
``dsize = (h, w)``. A single ``(1, 2, 3)`` matrix serves every image of a non-empty batch. Build ``M`` with
:func:`get_rotation_matrix2d`, or take the top two rows ``M[:, :2]`` of the ``(B, 3, 3)`` matrix of
:func:`get_affine_matrix2d`; :func:`invert_affine_transform` gives the matrix that warps back. To keep the input
size, use :func:`affine`, or pass an angle, a shift or a scale instead of a matrix to :func:`rotate`,
:func:`translate` or :func:`scale`; for a ``(B, 3, 3)`` homography, use :func:`warp_perspective`.

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

Each output pixel ``(x, y)`` samples the source at:

.. math::
    \text{dst}(x, y) = \text{src} \left( M^{-1}_{11} x + M^{-1}_{12} y + M^{-1}_{13} ,
    M^{-1}_{21} x + M^{-1}_{22} y + M^{-1}_{23} \right )

where :math:`M^{-1}` is the inverse of the :math:`3 \times 3` homogeneous extension of ``M``.

Convention:
    See :doc:`Conventions & Pitfalls </get-started/conventions>` for transform direction, pixel centres,
    normalized coordinates and ``align_corners`` sampling rules.

    - ``M`` is the sourceâ†’destination **pixel** affine matrix ``(B, 2, 3)``
    - a one-pixel source axis is sampled like a longer one, so positions outside it get ``padding_mode``. Under
      ``align_corners=True``, where ``grid_sample`` alone would land them all on that pixel, ``'zeros'`` and
      ``'fill'`` read it as the first of two pixels, the second holding the padding
      (`#6433 <https://github.com/kornia/kornia/issues/6433>`_)
    - ``src`` sets the dtype: a float32 ``M`` with a float64 ``src`` samples in float64, and a float64 ``M`` with a
      float32 ``src`` raises ``RuntimeError``
    - a caller's autocast region does not change the matrix arithmetic or the sampling grid, outside TorchScript
      (in the region, a ``src`` and ``M`` that mix float32 and half dtypes run in float32)
    - a zero output dimension returns an autograd-connected empty tensor;
      negative output dimensions raise ``ValueError``

Args:
    src: input torch.Tensor of shape ``(B, C, H, W)``.
    M: affine transformation of shape ``(B, 2, 3)``, or ``(1, 2, 3)`` for the whole batch.
    dsize: size of the output image (height, width).
    mode: interpolation mode to calculate output values ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values ``'zeros'`` | ``'border'`` | ``'reflection'``
        | ``'fill'``.
    align_corners : mode for grid_generation.
    fill_value: torch.Tensor of shape ``(C)`` or ``(1)`` that fills the padding area, or any shape that
        broadcasts to the output ``(B, C, h, w)`` without changing it, such as a per-sample ``(B, C, 1, 1)``
        fill. Defaults to zeros.

Returns:
    the warped torch.Tensor with shape ``(B, C, h, w)``, spatial sizes given by ``dsize``.

See Also:
    - :func:`warp_perspective`: a ``(B, 3, 3)`` homography per image, for perspective warps.
    - :func:`warp_affine3d`: the same warp for ``(B, C, D, H, W)`` volumes by ``(B, 3, 4)`` matrices.
    - :func:`affine`: keeps the input size and also takes an unbatched ``(C, H, W)`` image.
    - :func:`invert_affine_transform`: the destinationâ†’source matrix, to warp back.
    - :func:`get_affine_matrix2d`: a ``(B, 3, 3)`` matrix from translation, rotation, scale and shear; pass its
      ``M[:, :2]``.
    - :func:`crop_by_transform_mat`: calls this warp for a ``(B, 2, 3)`` matrix after casting it to the image dtype,
      and :func:`warp_perspective` for a ``(B, 3, 3)`` one.

Example:
   >>> img = torch.rand(1, 4, 5, 6)
   >>> A = torch.eye(2, 3)[None]
   >>> out = warp_affine(img, A, (4, 2), align_corners=True)
   >>> print(out.shape)
   torch.Size([1, 4, 4, 2])

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

rÅ   rÆ   rÇ   Nz*Input M must be a Bx2x3 torch.Tensor. Got rÈ   r*   rƒ   )r}   rK   r‡   rÉ   rŠ   rc   ©r   rË   r8   )rÌ   r.   rÍ   rÎ   rD   rÏ   rQ   rÐ   rœ   r0   r-   r>   rh   rL   rM   r
   rZ   rã   r   rˆ   rN   ÚmaximumÚ_shape_as_tensorr�   rJ   r�   rŒ   r   )r   r¤   rv   rx   r@   ry   r{   r³   rÝ   rÑ   rš   r—   Úbatchs   &&&&&&&      r&   Úwarp_affinerê   *  sÐ  € ôb �cœ5Ÿ<™<×(Ò(ÜÐDÄTÈ#ÃYÀKÐPÓQÐQä�aœŸ™×&Ò&ÜÐBÄ4ÈÃ7À)ÐLÓMÐMäˆs�y‰y‹>˜QÔÜÐIÈ#Ï)É)ÈÐUÓVÐVä�—‘‹L˜AÔ !§'¡'¨"¨# ,°&Ô"8ÜÐEÀaÇgÁgÀYÐOÓPÐPà�	‰	�!�€AØ
�'‰'�!�*€CØˆQ…x�!„|�u˜Q•x !”|ÜÐAÀ%ÀÈÐJÓKÐKØˆQ…x�1„}˜˜a� AœÜ$ØØØØØØÜ# CÓ+ØØ&7ô

ð 
	
ð —	‘	€IÜ˜×ÒØ—‘“˜aŸg™g›iˆQÜ�9‰9×!Ñ!×#Ò#Ü*¨3Ó2‰ˆß8EÔ! #Ô4È3€Gô ‡y�y×Ñ×ÒÜ  ¨UÓB‰ä §
¡
§¡×0Õ0Ü$ W°ÓFˆD÷ 1ô ‡y�y×Ñ×Òô —’œe×4Ò4°SÓ9¸!Õ<¼e×>TÒ>TÐUVÓ>WÐXYÕ>ZÓ[ˆØ�{‰{˜5 " b¨"Ó-‰Ø	�Œ�a˜!”eØ�{‰{˜1˜b " bÓ)ˆà�vÔØÒÜŸš S§Y¡Y¨q¥\¸#¿*¹*ÈCÏIÉIÔVˆJÜ˜c 4°}Ð\fÔg×jÑjÐktÓuÐuä˜g t¸=ÐbnÔo×rÑrØóð ÷! 1×0Ð0ús   ÉNÎN	c               ó4   € V ^8„  d   QhRRRRRRRRRRR	R
RR/# )r   r   r    r—   rx   rA   ry   r4   r{   r‰   zOptional[list[int]]r"   r$   )r%   s   "r&   r'   r'   ·  s`   € ÷ @xñ @xØ	ð@xà
ð@xð ð@xð ð	@xð
 ð@xð #ð@xð ñ@xr(   c           	     ó$  € VRJpVfK   V P                   ^ ,          V P                   ^,          VP                   ^,          VP                   ^,          .p\        VP                   4      p\        V4      ^8X  d   ^V^ ,          ^^.p\        V4      ^8*  p\        ^\	        \        V4      ^4      ^,           4       F,  p	Wy) ,          ^8w  g   K  Wy) ,          WY) ,          8w  g   K*  RpK.  	  V'       g0   \        R\        VP                   4       RV RV^,           R24      hV'       d    VP                  4       P                  ^4      p\        P                  ! V 4      p
VP                  V
4      pV'       d    V'       g   \        V R4      \        V
R4      r VP                  ^ 8X  d   VP                  ^^^^4      pM%VP                  ^8X  d   VP                  ^R	^^4      p^\        W¡W2RR7      ,
          pW´,          p\        WW2RR7      V,           # )
aÅ  Warp a mask of torch.ones, then multiply with fill_value and add to default warp.

Args:
    src: input torch.Tensor of shape ``(B, C, H, W)``.
    grid: grid torch.Tensor from `transform_points`. With ``align_corners=True`` it addresses ``src`` as
        :func:`_pad_one_pixel_axes` returns it, which is padded here.
    mode: interpolation mode to calculate output values ``'bilinear'`` | ``'nearest'``.
    align_corners: interpolation flag.
    fill_value: torch.Tensor of shape ``(C)`` or ``(1)`` that fills the padding area, or any shape that
        broadcasts to the output ``(B, C, H, W)`` without changing it, such as ``(B, C, 1, 1)``.
    out_shape: the output shape ``fill_value`` is checked against, when ``src`` and ``grid`` stand in for an
        empty destination; the fill is then reduced to one value. Defaults to the shape sampled from ``src``
        and ``grid``.

Returns:
    the warped and filled torch.Tensor with shape ``(B, C, H, W)``.
NFzfill_value of shape z1 does not broadcast to the warped image of shape z6 without changing it; use one value, one per channel (z3), or a shape such as (B, C, 1, 1) or (B, C, H, W).rJ   rŠ   r8   )rQ   ÚlistrÏ   rO   ÚminrÐ   rŽ   r9   r.   rk   rŒ   rZ   ÚndimÚviewr   )r   r—   rx   ry   r{   r‰   Ústand_inÚ
fill_shapeÚfitsÚiÚ	ones_maskÚinv_ones_maskÚinv_color_masks   &&&&&&       r&   r�   r�   ·  s×  € ð2  Ð$€HØÒØ—Y‘Y˜q•\ 3§9¡9¨Q¥<°·±¸AµÀÇ
Á
È1ÅÐNˆ	ô �j×&Ñ&Ó'€JÜ
ˆ:ƒ˜!ÔØ˜ A�¨¨1Ð-ˆ
Üˆz‹?˜aÑ€DÜ�1”cœ#˜j›/¨1Ó-°Õ1Ö2ˆØ�b�>˜QÖ :¨b¥>°Y¸rµ]Ö#BØŠDñ 3÷ ÜØ"¤4¨
×(8Ñ(8Ó#9Ð":Ð:kØˆkÐOÐPYÐZ[ÕP\È~ð ^,ð,ó
ð 	
÷
 ð  —^‘^Ó%×-Ñ-¨aÓ0ˆ
Ü—’ Ó$€IØ—‘˜yÓ)€JßŸXä,¨S°'Ó:Ô<OÐPYÐ[bÓ<cˆYà‡�˜!ÔØ—_‘_ Q¨¨1¨aÓ0‰
Ø	�‰˜AÔ	Ø—_‘_ Q¨¨A¨qÓ1ˆ
àÔ*Ø }Ègôõ €Mð #Õ/€Nä˜c°}Ð^eÔfÐiwÕwÐwr(   c               ó    € V ^8„  d   QhRRRR/# ©r   Úsrc_homo_dstr    r"   ÚNoner$   )r%   s   "r&   r'   r'   ú  s   € ÷ 
Cñ 
C¨,ð 
C¸4ñ 
Cr(   c                óx   € RpV P                  4       ^8X  d   \        V . ROVR7       R# \        V . ROVR7       R# )zßRaise unless ``src_homo_dst`` is ``(B, 3, 3)`` or ``(B, 1, 3, 3)``.

A single ``(3, 3)`` matrix is refused: its first dimension would be read as the batch, so the grid would come
back with a batch of 3 instead of one grid.
zksrc_homo_dst must be (B, 3, 3) or (B, 1, 3, 3); a single (3, 3) homography needs a leading batch dimension.©ÚmsgN)r³   Ú1Ú3r   )r³   r   r   ©rP   r   ©rú   rþ   s   & r&   Ú_check_homography_shaper  ú  ó4   € ð x€CØ×ÑÓ˜QÔÜ˜<Ò)=À3×Gä˜<ª¸c×Br(   c               ó    € V ^8„  d   QhRRRR/# rù   r$   )r%   s   "r&   r'   r'     s   € ÷ 
Cñ 
C¨Lð 
C¸Tñ 
Cr(   c                óx   € RpV P                  4       ^8X  d   \        V . ROVR7       R# \        V . ROVR7       R# )zßRaise unless ``src_homo_dst`` is ``(B, 4, 4)`` or ``(B, 1, 4, 4)``.

A single ``(4, 4)`` matrix is refused: its first dimension would be read as the batch, so the grid would come
back with a batch of 4 instead of one grid.
zksrc_homo_dst must be (B, 4, 4) or (B, 1, 4, 4); a single (4, 4) homography needs a leading batch dimension.rý   N)r³   rÿ   Ú4r  )r³   r  r  r  r  s   & r&   Ú_check_homography_shape3dr    r  r(   c               ó$   € V ^8„  d   QhRRRRRR/# ©r   r—   r    rú   r"   r$   )r%   s   "r&   r'   r'     s&   € ÷ C3ñ C3�Lð C3°ð C3Àñ C3r(   c                ó²  € \        V . RORR7       \        V4       VP                  ^ 4      pV P                  4       w  r4rSV P                  VRRR4      p \	        VP
                  4      ^8X  d   VP                  V^^^4      pVP                  4       '       d   V\        V4      ,          p\        P                  P                  4       '       d   \        WP                  V4      4      pMJ\        VP                  P                   4      ;_uu_ 4        \        WP                  V4      4      pRRR4       XP                  W$V^4      #   + '       g   i     L#; i)u]
  Warp a grid of 2D points by homographies, returning the coordinates without sampling an image.

``warped = warp_grid(grid, src_homo_dst)`` applies the homographies ``src_homo_dst`` to every ``(x, y)`` point of
``grid`` and returns the ``(N, H, W, 2)`` points after the homogeneous division, in the dtype of ``src_homo_dst``.
It does not normalize: the points stay in the coordinates that ``grid`` and the homography share, so a normalized
grid from :func:`~kornia.geometry.grid.create_meshgrid` and a normalized homography give positions that
:func:`torch.nn.functional.grid_sample` reads directly. To warp an image, use :func:`homography_warp`, which builds
such a grid, warps it with this function and samples the image.

Convention:
    - ``grid`` coordinates: ``(x, y)`` (last dim), shape ``(1, H, W, 2)`` or ``(N, H, W, 2)``
    - ``src_homo_dst`` is the destinationâ†’source homography ``(1, 3, 3)``,
      ``(N, 3, 3)`` or ``(N, 1, 3, 3)``
    - only the ``(1, H, W, 2)`` grid broadcasts over homography batches; a batched grid
      requires a matching batch of ``N`` homographies
    - ``src_homo_dst`` is divided by a detached scale toward unit magnitude before the
      homogeneous division, as in :func:`warp_perspective`, so a nonzero scalar multiple of it
      returns the same grid, except at grid points whose homogeneous coordinate is within
      ``1e-8`` of zero after that rescaling: those are left undivided, as
      :func:`~kornia.geometry.conversions.convert_points_from_homogeneous` does for points at
      infinity
    - a caller's autocast region does not change the grid, outside TorchScript

Args:
    grid: Unwrapped grid of the shape ``(1, H, W, 2)``, or ``(N, H, W, 2)`` with a
      matching batch of ``N`` homographies.
    src_homo_dst: Homography or homographies (stacked) to
      transform all points in the grid. Shape of the homography
      has to be ``(1, 3, 3)``, ``(N, 3, 3)`` or ``(N, 1, 3, 3)``.

Returns:
    the transformed grid of shape ``(N, H, W, 2)``.

Raises:
    ShapeError: If ``grid`` is not ``(B, H, W, 2)``, or ``src_homo_dst`` is not ``(B, 3, 3)`` or
        ``(B, 1, 3, 3)``. A single ``(3, 3)`` homography needs a leading batch dimension.

See Also:
    - :func:`warp_grid3d`: the same for a 3D ``(x, y, z)`` grid and ``(N, 4, 4)`` homographies.
    - :func:`homography_warp`: builds the grid, warps it with this function and samples the image.
    - :func:`~kornia.geometry.grid.create_meshgrid`: the ``(1, H, W, 2)`` grid to pass in, in pixels or normalized.
    - :func:`~kornia.geometry.linalg.transform_points`: transform any ``(B, N, 2)`` point set by ``(B, 3, 3)``
      matrices.

z*grid must be (1, H, W, 2) or (N, H, W, 2).rý   N)r³   rµ   r¶   Ú2r8   )r   r  rY   r�   rÏ   rQ   rð   r+   rt   r.   rL   rM   r   rŒ   r   rˆ   rD   )r—   rú   Ú
batch_sizer´   ÚheightÚwidthÚflows   &&     r&   Ú	warp_gridr    s  € ô\ �tÒ1Ð7cÕdÜ˜LÔ)Ø"×'Ñ'¨Ó*€JØŸ)™)›+Ñ€Aˆuà�;‰;�z 2 r¨2Ó.€DÜ
ˆ<×ÑÓ !Ô#Ø#×(Ñ(¨°Q¸¸1Ó=ˆð ×%Ñ%×'Ò'Ø#Ô&<¸\Ó&JÕJˆô
 ‡y�y×Ñ×ÒÜ-¨l¿G¹GÀLÓ<QÓR‰ä × 3Ñ 3× 8Ñ 8×9Õ9Ü# L·'±'¸,Ó2GÓHˆD÷ :à�9‰9�Z¨°Ó2Ð2÷ :×9ús   ÄEÅE	c               ó    € V ^8„  d   QhRRRR/# )r   rú   r    r"   r#   r$   )r%   s   "r&   r'   r'   Z  s   € ÷ 	ñ 	¨ð 	¸+ñ 	r(   c                ó˜   € V P                   \        P                  \        P                  39   d   \        P                  # V P                   # )aÃ  Return the dtype a pixel-coordinate sampling grid is warped and normalized in: float32 for a half homography.

Pixel coordinates reach the image size, where float16 rounds them to half pixels from 512 and to whole pixels from
1024, and bfloat16 already from 64 and 128. The grid is therefore warped and normalized in float32, and only the
normalized result, whose values lie near ``[-1, 1]``, returns to the homography's dtype. Other dtypes are kept.
)r-   r.   Úfloat16Úbfloat16Úfloat32)rú   s   &r&   Ú_pixel_grid_work_dtyper  Z  s5   € ð ×ÑœeŸm™m¬U¯^©^Ð<Ô<Ü�}‰}ÐØ×ÑÐr(   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   rú   r    r  rE   r  r"   r$   )r%   s   "r&   r'   r'   f  s(   € ÷ 3ñ 3 <ð 3¸ð 3ÀSð 3È\ñ 3r(   c                óŠ  € \        V 4       \        V 4      p\        WRV P                  VR7      pV P	                  V4      pV\        V4      ,          pVP                  V P                  ^ ,          ^^^^4      pVR,          VR,          ,          VR,          VR,          ,          ,           VR,          ,           p\        V4      # )aœ  Warp the ``(height, width)`` grid of destination pixels by ``src_homo_dst`` into source pixel coordinates.

The grid is built and warped in :func:`_pixel_grid_work_dtype`, whatever the default dtype, with the projective
gauge and homogeneous division of :func:`warp_grid`. The homography is applied as a sum of elementwise column
products rather than a matrix product: a caller's autocast region would run a matrix product in half precision,
also in a scripted call, which cannot leave it, and round the pixel coordinates of a 640 px wide grid to whole
pixels in bfloat16. Autocast leaves elementwise products alone, so eager and scripted calls compute the same grid.
F©r3   rˆ   r-   ).r„   rª   ).:r…   NNr«   ©.r   )	r  r  r   rˆ   rŒ   rt   r9   rQ   r   )rú   r  r  Ú
work_dtyper—   r]   Úwarpeds   &&&    r&   Ú_warp_pixel_gridr  f  s¥   € ô ˜LÔ)Ü'¨Ó5€JÜ˜6ÀÈ|×ObÑObÐjtÔu€DØ�_‰_˜ZÓ(€FØÔ,¨VÓ4Õ4€Fà�^‰^˜L×.Ñ.¨qÕ1°1°a¸¸AÓ>€FØ�'�]˜V F�^Õ+¨d°7­m¸fÀV½nÕ.LÕLÈvÐV\Í~Õ]€FÜ*¨6Ó2Ð2r(   c          
     ó,   € V ^8„  d   QhRRRRRRRRRR/# )	r   r—   r    r  rE   r  ry   r4   r"   r$   )r%   s   "r&   r'   r'   z  s1   € ÷ 	!ñ 	! |ð 	!¸Sð 	!Èð 	!Ð]að 	!Ðfrñ 	!r(   c                ó  € \        WV P                  V P                  VR7      ^ ,          p\        P                  ! VR,          VR,          34      p\        P                  ! VR,          VR,          34      pW,          V,           # )aS  Map a ``(N, H, W, 2)`` grid of source pixel coordinates to the ``[-1, 1]`` coordinates ``grid_sample`` reads.

``height`` and ``width`` are the source's. The map is :func:`~kornia.geometry.conversions.normal_transform_pixel`
under ``align_corners``, the one :func:`warp_perspective` conjugates its pixel homography with, applied per axis.
)rˆ   r-   ry   ©r6   r6   ©r…   r…   )r6   r   )r…   r   )r   rˆ   r-   r.   r²   )r—   r  r  ry   Únormrr   Úoffsets   &&&&   r&   Ú_normalize_warped_pixel_gridr%  z  sf   € ô " &¸¿¹È4Ï:É:ÐerÔsÐtuÕv€DÜ�KŠK˜˜d� T¨$¥ZÐ0Ó1€EÜ�[Š[˜$˜t�* d¨4¥jÐ1Ó2€FØ�<˜&Õ Ð r(   c               ó$   € V ^8„  d   QhRRRRRR/# r
  r$   )r%   s   "r&   r'   r'   †  s&   € ÷ A:ñ A:�lð A:°,ð A:À<ñ A:r(   c                ó¶  € \        V . RORR7       \        V4       VP                  ^ 4      pV P                  4       w  r4rVpV P                  VRRRR4      p \	        VP
                  4      ^8X  d   VP                  V^^^4      pVP                  4       '       d   V\        V4      ,          p\        P                  P                  4       '       d   \        WP                  V4      4      pMJ\        VP                  P                   4      ;_uu_ 4        \        WP                  V4      4      pRRR4       XP                  W$WV^4      #   + '       g   i     L#; i)u 
  Warp a grid of 3D points by 4x4 homographies, returning the coordinates without sampling a volume.

``warped = warp_grid3d(grid, src_homo_dst)`` applies the homographies ``src_homo_dst`` to every ``(x, y, z)`` point
of ``grid`` and returns the ``(N, D, H, W, 3)`` points after the homogeneous division, in the dtype of
``src_homo_dst``. It does not normalize or reorder: the last axis must already be ``(x, y, z)``, the order the
homography and :func:`torch.nn.functional.grid_sample` read, whereas
:func:`~kornia.geometry.grid.create_meshgrid3d` returns ``(d, x, y)``. To warp a volume, use
:func:`homography_warp3d`, which builds and reorders the grid, warps it with this function and samples the volume.

Convention:
    - ``grid`` coordinates: ``(x, y, z)`` (last dim), shape ``(1, D, H, W, 3)`` or
      ``(N, D, H, W, 3)``
    - ``src_homo_dst`` is the destinationâ†’source homography ``(1, 4, 4)``,
      ``(N, 4, 4)`` or ``(N, 1, 4, 4)``
    - only the ``(1, D, H, W, 3)`` grid broadcasts over homography batches; a batched
      grid requires a matching batch of ``N`` homographies
    - ``src_homo_dst`` is divided by a detached scale toward unit magnitude before the
      homogeneous division, as in :func:`warp_perspective`, so a nonzero scalar multiple of it
      returns the same grid, except at grid points whose homogeneous coordinate is within
      ``1e-8`` of zero after that rescaling: those are left undivided, as
      :func:`~kornia.geometry.conversions.convert_points_from_homogeneous` does for points at
      infinity
    - a caller's autocast region does not change the grid, outside TorchScript

Args:
    grid: Unwrapped grid of the shape ``(1, D, H, W, 3)``, or ``(N, D, H, W, 3)``
      with a matching batch of ``N`` homographies.
    src_homo_dst: Homography or homographies (stacked) to
      transform all points in the grid. Shape of the homography
      has to be ``(1, 4, 4)``, ``(N, 4, 4)`` or ``(N, 1, 4, 4)``.

Returns:
    the transformed grid of shape ``(N, D, H, W, 3)``.

Raises:
    ShapeError: If ``grid`` is not ``(B, D, H, W, 3)``, or ``src_homo_dst`` is not ``(B, 4, 4)`` or
        ``(B, 1, 4, 4)``. A single ``(4, 4)`` homography needs a leading batch dimension.

See Also:
    - :func:`warp_grid`: the same for a 2D ``(x, y)`` grid and ``(N, 3, 3)`` homographies.
    - :func:`homography_warp3d`: builds and reorders the grid, warps it with this function and samples the volume.
    - :func:`~kornia.geometry.grid.create_meshgrid3d`: a grid in ``(d, x, y)`` order, to reorder before passing it
      in.

z0grid must be (1, D, H, W, 3) or (N, D, H, W, 3).rý   N)r³   ÚDrµ   r¶   r   r8   )r   r  rY   r�   rÏ   rQ   rð   r+   rt   r.   rL   rM   r   rŒ   r   rˆ   rD   )r—   rú   r  r´   Údepthr  r  r  s   &&      r&   Úwarp_grid3dr*  †  s  € ô\ �tÒ6Ð<nÕoÜ˜lÔ+Ø"×'Ñ'¨Ó*€JØ!%§¡£Ñ€Aˆf˜Qà�;‰;�z 2 r¨2¨rÓ2€DÜ
ˆ<×ÑÓ !Ô#Ø#×(Ñ(¨°Q¸¸1Ó=ˆà×%Ñ%×'Ò'Ø#Ô&<¸\Ó&JÕJˆô ‡y�y×Ñ×ÒÜ-¨l¿G¹GÀLÓ<QÓR‰ä × 3Ñ 3× 8Ñ 8×9Õ9Ü# L·'±'¸,Ó2GÓHˆD÷ :à�9‰9�Z¨°qÓ9Ð9÷ :×9ús   ÄEÅE	c          
     ó,   € V ^8„  d   QhRRRRRRRRRR/# )r   rú   r    r)  rE   r  r  r"   r$   )r%   s   "r&   r'   r'   Ê  s1   € ÷ 3ñ 3 \ð 3¸#ð 3Àsð 3ÐSVð 3Ð[gñ 3r(   c           	     óÊ  € \        V 4       \        V 4      p\        WVRV P                  VR7      pV P	                  V4      pV\        V4      ,          pVP                  V P                  ^ ,          ^^^^^4      pVR,          VR,          VR,          r˜pWvR,          ,          W†R,          ,          ,           W–R,          ,          ,           VR	,          ,           p
\        V
4      # )
a  Warp the ``(depth, height, width)`` grid of destination voxels by ``src_homo_dst`` into source voxels.

The 3-D counterpart of :func:`_warp_pixel_grid`: the grid is built and warped in :func:`_pixel_grid_work_dtype`,
whatever the default dtype, with the projective gauge and homogeneous division of :func:`warp_grid3d`, as a sum of
elementwise column products that a caller's autocast region leaves alone, scripted or not. The result is
``(N, D, H, W, 3)`` in the ``(x, y, z)`` order the homography and ``grid_sample`` read.
Fr  ©.ºr…   r   N©.ºr   rË   N©.ºr6   r…   Nrª   r«   r  ©.rË   )	r  r  r   rˆ   rŒ   rt   r9   rQ   r   )rú   r)  r  r  r  r—   r]   ÚxÚyÚzr  s   &&&&       r&   Ú_warp_pixel_grid3dr7  Ê  sÅ   € ô ˜lÔ+Ü'¨Ó5€JÜØ�u°UÀ<×CVÑCVÐ^hô€Dð �_‰_˜ZÓ(€FØÔ,¨VÓ4Õ4€Fà�^‰^˜L×.Ñ.¨qÕ1°1°a¸¸A¸qÓA€Fà�8�n˜d 8�n¨d°8­nˆ!€AØ˜•Õ !¨V¥nÕ"4Õ4°qÀ&½>Õ7IÕIÈFÐSYÍNÕZ€FÜ*¨6Ó2Ð2r(   c               ó0   € V ^8„  d   QhRRRRRRRRRRR	R/# )
r   r—   r    r)  rE   r  r  ry   r4   r"   r$   )r%   s   "r&   r'   r'   á  s<   € ÷ $ñ $Ø
ð$Ø"ð$Ø,/ð$Ø8;ð$ØLPð$àñ$r(   c                óJ  € V'       d•   \        WW0P                  V P                  R7      ^ ,          p\        P                  ! VR,          VR,          VR,          34      p\        P                  ! VR,          VR,          VR	,          34      pW,          V,           # RV R
,          ,          R,           V,          R,
          pRV R,          ,          R,           V,          R,
          p	RV R,          ,          R,           V,          R,
          p
\        P
                  ! W‰V
3R4      # )aª  Map a ``(N, D, H, W, 3)`` grid of ``(x, y, z)`` source voxels to the ``[-1, 1]`` coordinates of ``grid_sample``.

``depth``, ``height`` and ``width`` are the source's. With ``align_corners=True`` the map is
:func:`~kornia.geometry.conversions.normal_transform_pixel3d`, the one :func:`warp_perspective3d` conjugates its
voxel homography with, applied per axis. With ``False`` it is the half-voxel map ``(2v + 1) / size - 1``.
r‡   g       @r7   r!  r"  )r   r   )r6   rË   )r…   rË   ræ   r1  r-  r/  r8   )r   rˆ   r-   r.   r²   Úcat)r—   r)  r  r  ry   r#  rr   r$  r4  r5  r6  s   &&&&&      r&   Ú_normalize_warped_pixel_grid3dr;  á  sã   € ÷ Ü'¨°uÇ[Á[ÐX\×XbÑXbÔcÐdeÕfˆÜ—’˜T $�Z¨¨d­°T¸$µZÐ@ÓAˆÜ—’˜d 4�j¨$¨t­*°d¸4µjÐAÓBˆØ�|˜fÕ$Ð$ð 
ˆt�H�~Õ	 Õ	# uÕ,¨sÕ2€AØ	ˆt�H�~Õ	 Õ	# vÕ-°Õ3€AØ	ˆt�H�~Õ	 Õ	# uÕ,¨sÕ2€AÜ�9Š9�a˜A�Y Ó#Ð#r(   c               ó    € V ^8„  d   QhRRRR/# )r   Úpointsr    r"   r$   )r%   s   "r&   r'   r'   þ  s   € ÷ ,3ñ ,3 ð ,3°,ñ ,3r(   c                ó€  € V R,          pV R,          pV R,          pV R,          pV R,          pV R,          pV R,          pV R	,          pW5,
          p	Wu,
          p
W,
          V,           V,
          pWF,
          pW†,
          pW$,
          V,           V,
          pW�,          WÊ,          ,
          pW½,          Wê,          ,
          V,          pWž,          WË,          ,
          V,          pW1,
          VV,          ,           pWq,
          VV,          ,           pTpWB,
          VV,          ,           pW‚,
          VV,          ,           pTp\         P                  ! V4      p\         P                  ! VVV.R
R7      p\         P                  ! VVV.R
R7      p\         P                  ! VVV.R
R7      p\         P                  ! VVV.RR7      # )a±  Closed-form perspective matrix mapping the unit square to a quadrilateral.

Maps the canonical unit-square corners ``[(0,0), (1,0), (1,1), (0,1)]`` to the
four points in ``points`` (in the same corner order). Implemented via Heckbert's
direct formulation (no linear solve) so it lowers cleanly to ONNX.

Args:
    points: ``(B, 4, 2)`` tensor of quadrilateral vertices.

Returns:
    ``(B, 3, 3)`` perspective transformation matrix.
r¨   ).r6   r6   ).r6   r…   ).r…   r6   ).r…   r…   ).r   r6   ).r   r…   ).rË   r6   ).rË   r…   r8   rc   )r.   rk   r²   )r=  Úx0Úy0Úx1Úy1Úx2Úy2Úx3Úy3Údx1Údx2ÚsxÚdy1Údy2Úsyr¾   Úa31Úa32Úa11Úa12Úa13Úa21Úa22Úa23ÚoneÚrow0Úrow1Úrow2s   &                           r&   Ú_unit_square_to_quadrY  þ  sv  € ð 
�	Õ	€BØ	�	Õ	€BØ	�	Õ	€BØ	�	Õ	€BØ	�	Õ	€BØ	�	Õ	€BØ	�	Õ	€BØ	�	Õ	€Bà
�'€CØ
�'€CØ	��2�˜Õ	€BØ
�'€CØ
�'€CØ	��2�˜Õ	€Bà�I˜�	Õ!€EØ�8�b•hÕ %Õ
'€CØ�8�c•hÕ %Õ
'€CØ
�'�C˜"•HÕ
€CØ
�'�C˜"•HÕ
€CØ
€CØ
�'�C˜"•HÕ
€CØ
�'�C˜"•HÕ
€CØ
€Cä
�/Š/˜"Ó
€Cä�;Š;˜˜S #�¨BÔ/€DÜ�;Š;˜˜S #�¨BÔ/€DÜ�;Š;˜˜S #�¨BÔ/€DÜ�;Š;˜˜d DÐ)¨rÔ2Ð2r(   c               ó$   € V ^8„  d   QhRRRRRR/# ©r   Ú
points_srcr    Ú
points_dstr"   r$   )r%   s   "r&   r'   r'   -  s#   € ÷ (ñ (°|ð (ÐQ]ð (Ðbnñ (r(   c                ó  € V P                   p\        V4      p\        V P                  V4      4      p\        VP                  V4      4      pV\	        V4      ,          pV\
        P                  8X  d   RpM#V\
        P                  8X  d   RpM\        R4      pVR,          pWh,          P                  4       V8  P                  RRR7      P                  RRR7      p	VP                  4       p
V
P                  R	RR7      pV
P                  V
^ 8H  \        R4      4      P                  R	RR7      pVP                  4       VP                  4       ,          pV\
        P                  ! W˜V4      ,          pVP                  V4      # )
u/  Perspective transform via two unit-square (Heckbert) decompositions.

Computes ``H = H_d @ inv(H_s)`` where ``H_s`` maps the unit square to
``points_src`` and ``H_d`` maps it to ``points_dst``, so ``H`` maps
``points_src`` onto ``points_dst`` directly. Uses only arithmetic and a
closed-form 3x3 inverse â€” no ``torch.linalg.solve`` â€” so it needs no
LAPACK/cusolver backend (runs on the Jetson wheel) and traces cleanly for
ONNX. The result is normalized to ``H[2, 2] == 1`` to match the DLT
convention whenever that form is finite in the input dtype; otherwise (an
``H[2, 2]`` that is exactly zero, or a float16 form beyond 65504) it is
divided by the geometric mean of its largest and smallest nonzero magnitudes
instead. Computed in float32/float64 for numerical stability, then cast back
to the input dtype.
g     þï@g     ðïGra   Tr_   ).r0  r0  r8   rc   rb   )r-   r	   rY  rŒ   r   r.   r  r  rh   re   rT   rf   rg   ri   Úsqrtrn   )r\  r]  r-   r  Úh_sÚh_dr!   ÚoverflowÚh22ró   ro   rp   rq   rr   s   &&            r&   Ú&_get_perspective_transform_closed_formrd  -  s?  € ð ×Ñ€EÜ1°%Ó8€JÜ
˜zŸ}™}¨ZÓ8Ó
9€CÜ
˜zŸ}™}¨ZÓ8Ó
9€CØÔ.¨sÓ3Õ3€Ið ”—‘ÔØ‰Ø	”%—.‘.Ô	 Ø(‰ä˜“<ˆØ
�MÕ
"€CØ�_×!Ñ!Ó# hÑ.×3Ñ3¸ÀDÐ3ÓI×MÑMÐRTÐ^bÐMÓc€DØ—‘“€IØ�n‰n °4ˆnÓ8€GØ×$Ñ$ Y°!¡^´U¸5³\ÓB×GÑGÈHÐ^bÐGÓc€HØ�L‰L‹N˜XŸ]™]›_Õ,€EØœEŸKšK¨°5Ó9Õ9€IØ�<‰<˜ÓÐr(   c               ó$   € V ^8„  d   QhRRRRRR/# r[  r$   )r%   s   "r&   r'   r'   X  s,   € ÷ \Nñ \N¨,ð \NÀLð \NÐUañ \Nr(   c                óŒ  € \        V . RO4       \        V. RO4       \        V P                  VP                  8H  R4       \        V P                  VP                  8H  R4       V P	                  4       '       gN   \
        P                  ! ^ V P                  R7      P                  pV P                  V4      VP                  V4      r\
        P                  P                  4       '       d   \        W4      # \        V P                  P                  4      ;_uu_ 4        \        W4      uuRRR4       #   + '       g   i     R# ; i)u&  Compute the homography that maps four source points exactly onto four destination points.

``M = get_perspective_transform(points_src, points_dst)`` takes two ``(B, 4, 2)`` sets of ``(x, y)`` points,
matched by index, and returns the ``(B, 3, 3)`` homography, scaled to ``M[2, 2] = 1`` where it can be, that maps
each source point onto its destination point: the sourceâ†’destination pixel homography that
:func:`warp_perspective` takes. It solves the four-point system in closed form, by Heckbert's
square-to-quadrilateral mappings, rather than with the
`DLT <https://www.cs.cmu.edu/~16385/s17/Slides/10.2_2D_Alignment__DLT.pdf>`_, whose exact solution it equals, so it
needs no linear solver. For more than four or noisy correspondences, use
:func:`~kornia.geometry.homography.find_homography_dlt` or :class:`~kornia.geometry.ransac.RANSAC`.

The matrix maps each source point onto its destination point, up to the projective scale:

.. math::

    \begin{bmatrix}
    x^{'} \\
    y^{'} \\
    1 \\
    \end{bmatrix}
    =
    \begin{bmatrix}
    h_1 & h_2 & h_3 \\
    h_4 & h_5 & h_6 \\
    h_7 & h_8 & h_9 \\
    \end{bmatrix}
    \cdot
    \begin{bmatrix}
    x \\
    y \\
    1 \\
    \end{bmatrix}

Convention:
    - points: ``(x, y)``, pixel centers, origin at top-left; shape ``(B, 4, 2)``
    - a degenerate quadrilateral, such as one with three collinear points or two equal ones, does not raise: a
      degenerate source returns a non-finite matrix, a degenerate destination a non-finite or a singular one
    - ``M`` is scaled to ``M[2, 2] = 1`` wherever that form is finite in the output dtype. Where it is not,
      because the computed bottom-right entry is exactly zero, as for some homographies that send source pixel
      ``(0, 0)`` to infinity although neither quadrilateral is degenerate, or because the form overflows the dtype,
      such as a float16 one with entries beyond ``65504``, ``M`` is divided instead by the geometric mean of its
      largest and smallest nonzero magnitudes, which keeps both in range where the dtype can hold their ratio.
      When the true bottom-right entry is zero but rounding leaves a small residue, ``M[2, 2] = 1`` holds and the
      other entries are large, about the inverse of that residue; the matrix still maps the points.
      :func:`~kornia.geometry.homography.find_homography_dlt` returns the same map at another scale
    - float16 and bfloat16 points are solved in float32, and the result is cast back to their dtype
    - integer or boolean points give a matrix in the default floating dtype; floating points keep theirs
    - a caller's autocast region does not change the result, outside TorchScript

Args:
    points_src: coordinates of quadrangle vertices in the source image with shape ``(B, 4, 2)``.
    points_dst: coordinates of the corresponding quadrangle vertices in
        the destination image with shape ``(B, 4, 2)``.

Returns:
    the perspective transformation with shape ``(B, 3, 3)``.

See Also:
    - :func:`warp_perspective`: warp an image by the returned homography.
    - :func:`get_perspective_transform3d`: the 3D counterpart, a ``(B, 4, 4)`` homography from box corners.
    - :func:`~kornia.geometry.homography.find_homography_dlt`: a least-squares homography from any number of
      weighted point pairs.
    - :class:`~kornia.geometry.ransac.RANSAC`: a homography that is robust to wrong correspondences.

Example:
    >>> x1 = torch.tensor([[[0., 0.], [1., 0.], [1., 1.], [0., 1.]]])
    >>> x2 = torch.tensor([[[1., 0.], [0., 0.], [0., 1.], [1., 1.]]])
    >>> x2_trans_x1 = get_perspective_transform(x1, x2)

z4Source data shape must match Destination data shape.z2Source data type must match Destination data type.©rˆ   N)r³   r  r  )r   r   rQ   r-   r+   r.   Úemptyrˆ   rŒ   rL   rM   rd  r   rD   )r\  r]  r  s   && r&   Úget_perspective_transformri  X  så   € ôN �z¢?Ô3Ü�z¢?Ô3Ü�×!Ñ! Z×%5Ñ%5Ñ5Ð7mÔnÜ�×!Ñ! Z×%5Ñ%5Ñ5Ð7kÔlð
 ×'Ñ'×)Ò)Ü—[’[ ¨:×+<Ñ+<Ô=×CÑCˆ
Ø!+§¡¨zÓ!:¸J¿M¹MÈ*Ó<U�Jô ‡y�y×Ñ×ÒÜ5°jÓMÐMÜ	˜J×-Ñ-×2Ñ2×	3Õ	3Ü5°jÓM÷ 
4×	3×	3Ó	3ús   ÄD2Ä2E	c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   Úcenterr    Úanglerr   r"   r$   )r%   s   "r&   r'   r'   ¸  s/   € ÷ rñ r ,ð r°|ð rÈLð rÐ]iñ r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      ^8X  d   V P                  ^,          ^8X  g   \        RV P                   24      h\        VP                  4      ^8X  g   \        RVP                   24      h\        VP                  4      ^8X  d   VP                  ^,          ^8X  g   \        RVP                   24      hV P                  ^ ,          VP                  ^ ,          u;8X  d   VP                  ^ ,          8X  g5   M \        RV P                   RVP                   R	VP                   24      hV P                  VP                  u;8X  d   VP                  8X  g6   M \        R
V P                   RVP                   R	VP                   R24      hV P                  VP                  u;8X  d   VP                  8X  g6   M \        RV P                   RVP                   R	VP                   R24      h\        ^V 4      pWR&   \        ^V 4      pV ) VR&   \        ^V 4      pVR;;,          VR,          ,          uu&   VR;;,          VR,          ,          uu&   \        ^V 4      p\        V4      VR&   \        V P                  P                  4      ;_uu_ 4        W6,          V,          V,          pRRR4       XR,          #   + '       g   i     L; i)u¶
  Compute the 2D affine matrix that scales and rotates counter-clockwise, in degrees, about a centre.

``M = get_rotation_matrix2d(center, angle, scale)`` takes centres ``(B, 2)`` as ``(x, y)`` pixels, angles ``(B,)``
in degrees and scale factors ``(B, 2)`` for ``x`` and ``y``, and returns the ``(B, 2, 3)`` sourceâ†’destination pixel
matrix that scales and then rotates about ``center``, which stays fixed. A positive angle turns counter-clockwise as
displayed, with ``y`` pointing down. Pass ``M`` to :func:`warp_affine`; to add a translation and a shear in one
``(B, 3, 3)`` matrix, use :func:`get_affine_matrix2d`, and to rotate an image directly, :func:`rotate`.

With equal scale factors ``scale``, the matrix is:

.. math::
    \begin{bmatrix}
        \alpha & \beta & (1 - \alpha) \cdot \text{x}
        - \beta \cdot \text{y} \\
        -\beta & \alpha & \beta \cdot \text{x}
        + (1 - \alpha) \cdot \text{y}
    \end{bmatrix}

where

.. math::
    \alpha = \text{scale} \cdot \cos(\text{angle}) \\
    \beta = \text{scale} \cdot \sin(\text{angle})

With two different factors, the left 2x2 block is the rotation times ``diag(scale[:, 0], scale[:, 1])``. A caller's
autocast region does not change the result.

Convention:
    - ``center`` is ``(x, y)`` in pixels, origin at top-left
    - positive ``angle`` rotates counter-clockwise as displayed (y-down image axes)
    - returns ``(B, 2, 3)`` affine matrix in pixel coordinates

Args:
    center: center of the rotation in the source image with shape ``(B, 2)``.
    angle: rotation angle in degrees. Positive values mean
        counter-clockwise rotation (the coordinate origin is assumed to
        be the top-left corner) with shape ``(B)``.
    scale: scale factor for x, y scaling with shape ``(B, 2)``.

Returns:
    the affine matrix of 2D rotation with shape ``(B, 2, 3)``.

Raises:
    TypeError: If any input is not a tensor.
    ValueError: If input shapes are invalid, or batch sizes, devices or dtypes do not match.

See Also:
    - :func:`get_affine_matrix2d`: also translates and shears, returns ``(B, 3, 3)``, and turns clockwise for a
      positive angle (`#4408 <https://github.com/kornia/kornia/issues/4408>`_).
    - :func:`rotate`: rotate an image about its centre without building the matrix.
    - :func:`get_projective_transform`: the 3D rotation and scale, by an axis-angle vector.
    - :func:`~kornia.geometry.conversions.angle_to_rotation_matrix`: the 2x2 rotation matrix of an angle alone.

Example:
    >>> center = torch.zeros(1, 2)
    >>> scale = torch.ones((1, 2))
    >>> angle = 45. * torch.ones(1)
    >>> get_rotation_matrix2d(center, angle, scale)
    tensor([[[ 0.7071,  0.7071,  0.0000],
             [-0.7071,  0.7071,  0.0000]]])

z-Input center type is not a torch.Tensor. Got z,Input angle type is not a torch.Tensor. Got z,Input scale type is not a torch.Tensor. Got z-Input center must be a Bx2 torch.Tensor. Got z*Input angle must be a B torch.Tensor. Got z,Input scale must be a Bx2 torch.Tensor. Got z7Inputs must have same batch size dimension. Got center z, angle z and scale z)Inputs must have same device. Got center r*   z(Inputs must have same dtype. Got center N)r©   rØ   r   )r©   r6   r6   )r©   r6   )r©   r…   r…   )r©   r…   )r©   rØ   rØ   r×   )rÌ   r.   rÍ   rÎ   rD   rÏ   rQ   rÐ   rˆ   r-   r   r   r   )rk  rl  rr   Úshift_mÚshift_m_invÚscale_mÚrotat_mÚaffine_ms   &&&     r&   Úget_rotation_matrix2drs  ¸  sÓ  € ô~ �fœeŸl™l×+Ò+ÜÐGÌÈVËÀ~ÐVÓWÐWä�eœUŸ\™\×*Ò*ÜÐFÄtÈEÃ{ÀmÐTÓUÐUä�eœUŸ\™\×*Ò*ÜÐFÄtÈEÃ{ÀmÐTÓUÐUä�—‘Ó Ô" v§|¡|°A¥¸!Ô';ÜÐHÈÏÉÈÐWÓXÐXäˆu�{‰{Ó˜qÔ ÜÐEÀeÇkÁkÀ]ÐSÓTÐTä�—‘Ó Ô! e§k¡k°!¥n¸Ô&9ÜÐGÈÏÉÀ}ÐUÓVÐVà�L‰L˜�O˜uŸ{™{¨1�~Ö?°·±¸QµÖ?ÜØEÀfÇlÁlÀ^ÐS[Ð\a×\gÑ\gÐ[hÐhsØ�{‰{ˆmðó
ð 	
ð
 �M‰M˜UŸ\™\Ö9¨U¯\©\Ö9ÜØ7¸¿¹°ÀhÈuÏ|É|ÈnÐ\gÐhm×htÑhtÐguÐuvÐwó
ð 	
ð �L‰L˜EŸK™KÖ6¨5¯;©;Ö6ÜØ6°v·|±|°nÀHÈUÏ[É[ÈMÐYdÐej×epÑepÐdqÐqrÐsó
ð 	
ô �q˜&Ó!€GØˆHÑä˜1˜fÓ%€KØ#˜G€K�Ñä�q˜&Ó!€GØˆG×˜˜d�Õ#ÓØˆG×˜˜d�Õ#Óä�q˜&Ó!€GÜ1°%Ó8€GˆIÑô 
˜FŸM™M×.Ñ.×	/Õ	/ØÕ$ wÕ.°Õ<ˆ÷ 
0à�HÕÐ÷ 
0×	/ús   ÍM5Í5N	c               ó8   € V ^8„  d   QhRRRRRRRRRRRR	R
RRR/# )r   Úimager    Úmap_xÚmap_yrx   rA   r@   ry   zOptional[bool]r3   r4   r"   r$   )r%   s   "r&   r'   r'   -  sb   € ÷ kñ kØðkàðkð ðkð ð	kð
 ðkð "ðkð !ðkð ñkr(   c                ó–  € \        V . RO4       \        V. RO4       \        V. RO4       V P                  w  rxrš\        P                  ! W.R4      pVf   RpVP                  R	,          ^ 8X  g   VP                  R
,          ^ 8X  dC   \	        V VVP                  R	,          VP                  R
,          3VVV\        W¶4      RRRR7
      # V P                  p\        W4      '       d    V P                  4       VP                  4       r°V'       g   \        W¹V
4      pVP                  VRRR4      p\        WW4VR7      P                  V4      # )aÊ  Sample an image at per-pixel source coordinates given as an x map and a y map.

``out = remap(image, map_x, map_y)`` takes images ``(B, C, H, W)`` and two ``(B, h, w)`` maps that hold, for every
output pixel, the source column ``x`` and row ``y`` to sample, and returns ``(B, C, h, w)``. The maps are absolute
pixel coordinates, not displacements, so the identity maps are the two channels of
:func:`~kornia.geometry.grid.create_meshgrid` with ``normalized_coordinates=False``; with
``normalized_coordinates=True`` they are the :math:`[-1, 1]` coordinates of
:func:`torch.nn.functional.grid_sample`. Maps of batch 1 serve every image. With pixel maps, pass
``align_corners=True``: the default resamples even an identity map. For a warp given by a matrix, use
:func:`warp_affine` or :func:`warp_perspective`.

.. image:: _static/img/remap.png

.. math::
    \text{dst}(x, y) = \text{src}(map_x(x, y), map_y(x, y))

Convention:
    - align_corners: ``None`` by default, resolved to ``False`` internally
    - pixel maps are normalized with the ``align_corners=True`` convention whatever flag
      reaches ``grid_sample``, so at ``False``/``None`` even an identity map resamples the image;
      pass ``align_corners=True`` (`#4504 <https://github.com/kornia/kornia/issues/4504>`_)
    - the output spatial size comes from the maps; a zero map axis returns an
      autograd-connected empty output, including when the matching source axis is empty

Args:
    image: the torch.Tensor to remap with shape ``(B, C, H, W)``.
      Where C is the number of channels.
    map_x: the source x coordinate (column) to sample for each output pixel, with shape ``(B, h, w)`` or
      ``(1, h, w)``; in pixels unless ``normalized_coordinates=True``.
    map_y: the source y coordinate (row) to sample for each output pixel, with the shape of ``map_x``.
    mode: interpolation mode to calculate output values
      ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values
      ``'zeros'`` | ``'border'`` | ``'reflection'``.
    align_corners: mode for grid_generation.
    normalized_coordinates: whether the input coordinates are
       normalized in the range of [-1, 1].

Returns:
    the sampled images ``(B, C, h, w)``, with the spatial size of the maps.

See Also:
    - :func:`warp_perspective`: warp by a ``(B, 3, 3)`` pixel homography instead of maps.
    - :func:`warp_grid`: the positions a homography gives, as a grid whose two channels are maps.
    - :func:`~kornia.geometry.grid.create_meshgrid`: the identity maps, to offset or transform.
    - :func:`warp_image_tps`: a smooth warp from thin-plate-spline control points.

Example:
    >>> import torch
    >>> from kornia.geometry import create_meshgrid
    >>> grid = create_meshgrid(2, 2, False)  # 1x2x2x2
    >>> grid += 1  # apply offset in both directions
    >>> input = torch.ones(1, 1, 2, 2)
    >>> remap(input, grid[..., 0], grid[..., 1], align_corners=True)   # 1x1x2x2
    tensor([[[[1., 0.],
              [0., 0.]]]])

Fr   Úmap)r}   r~   r   ©rx   r@   ry   )r³   rÜ   rµ   r¶   )r³   rµ   r¶   r8   r    rc   )r   rQ   r.   r²   rœ   r:   r-   r>   rh   r   r�   r   rŒ   )ru  rv  rw  rx   r@   ry   r3   r  r´   r  r  r2   rÑ   s   &&&&&&&      r&   Úremapr{  -  s-  € ôF �uÒ2Ô3Ü�ušoÔ.Ü�ušoÔ.à#(§;¡;Ñ €J�6ô !Ÿ;š;¨ ~°rÓ:€Fð ÒØˆà‡|�|�BÕ˜1Ô §¡¨RÕ 0°AÔ 5Ü$ØØØ�\‰\˜"Õ˜vŸ|™|¨BÕ/Ð0ØØØÜ˜fÓ=Ø&+ØØô
ð 	
ð —‘€IÜ˜×&Ò&ØŸ™› v§|¡|£~ˆv÷ "Ü,¨V¸UÓCˆð �]‰]˜: r¨2¨rÓ2€Fô ˜e°$ÐanÔo×rÑrØóð r(   c               ó    € V ^8„  d   QhRRRR/# r\   r$   )r%   s   "r&   r'   r'   ›  s   € ÷ .#ñ .# Lð .#°\ñ .#r(   c                ó:  € \        V \        P                  4      '       g   \        R\	        V 4       24      h\        V P                  4      ^8X  d   V P                  RR R8X  g   \        RV P                   24      h\        V 4      p\        V4      pVR,          # )u¾  Invert 2D affine matrices of shape ``(B, 2, 3)``.

``M_inv = invert_affine_transform(M)`` returns, for each ``(B, 2, 3)`` affine matrix, the ``(B, 2, 3)`` inverse of
its 3x3 extension with the last row ``(0, 0, 1)``, in the dtype of ``M``. It is pure matrix inversion, so the
result keeps the input's coordinates, pixel or normalized: the inverse of a sourceâ†’destination matrix maps
destination to source, and warps a :func:`warp_affine` result back. For ``(B, 3, 3)`` homographies, use
:func:`torch.linalg.inv`.

The input is the matrix:

.. math::
    \begin{bmatrix}
        a_{11} & a_{12} & b_{1} \\
        a_{21} & a_{22} & b_{2} \\
    \end{bmatrix}

Convention:
    - ``matrix`` is a ``(B, 2, 3)`` affine transform in any coordinate convention
      (pixel or normalized) â€” pure matrix inversion; the result stays in the input's convention
    - in eager mode a singular matrix raises ``torch.linalg.LinAlgError``

Args:
    matrix: original affine transform. The torch.Tensor must be
      in the shape of ``(B, 2, 3)``.

Return:
    the reverse affine transform with shape ``(B, 2, 3)``.

See Also:
    - :func:`warp_affine`: warp an image by a matrix or by its inverse.
    - :func:`get_affine_matrix2d`: a ``(B, 3, 3)`` affine matrix from translation, rotation, scale and shear;
      pass its ``M[:, :2]``.
    - :func:`~kornia.geometry.conversions.convert_affinematrix_to_homography`: the ``(B, 3, 3)`` extension, to
      compose with homographies.

z-Input matrix type is not a torch.Tensor. Got Nz/Input matrix must be a Bx2x3 torch.Tensor. Got rc   ræ   ).rØ   ºNrË   N)
rÌ   r.   rÍ   rÎ   rD   rÏ   rQ   rÐ   r   r   )r]   Ú
matrix_tmpÚ
matrix_invs   &  r&   Úinvert_affine_transformr�  ›  s†   € ôJ �fœeŸl™l×+Ò+ÜÐGÌÈVËÀ~ÐVÓWÐWä�—‘Ó Ô" v§|¡|°B°CÐ'8¸FÔ'BÜÐJÈ6Ï<É<È.ÐYÓZÐZäAÀ&ÓI€JÜ2°:Ó>€Jà�kÕ"Ð"r(   c               ó4   € V ^8„  d   QhRRRRRRRRRRRRR	R/# )
r   Útranslationsr    rk  rr   rl  rI  r|   rL  r"   r$   )r%   s   "r&   r'   r'   Ì  sN   € ÷ ?ñ ?Øð?àð?ð ð?ð ð	?ð
 	ð?ð 	ð?ð ñ?r(   c                óª  € \        W) V4      pVR;;,          V ,          uu&   \        V4      p\        ;QJ d    R WE3 4       F  '       g   K   RM	  RM! R WE3 4       4      '       dV   \        WqWE4      w  rqrE\	        VP
                  P                  4      ;_uu_ 4        \        WV4      pWx,          pRRR4       V# V#   + '       g   i     T# ; i)u
  Compose a 2D affine matrix from a translation, clockwise rotation, scale and shear about a centre.

``M = get_affine_matrix2d(translations, center, scale, angle, sx, sy)`` takes ``(B, 2)`` translations
``(dx, dy)``, centres ``(x, y)`` and scale factors for ``x`` and ``y``, ``(B,)`` angles in degrees and optional
``(B,)`` shear angles ``sx`` and ``sy`` in radians, and returns the ``(B, 3, 3)`` sourceâ†’destination pixel matrix
that shears, scales, rotates and then translates, the first three about ``center``. A positive ``angle`` turns
**clockwise** as displayed, unlike :func:`get_rotation_matrix2d`, :func:`rotate` and :class:`Affine`
(`#4408 <https://github.com/kornia/kornia/issues/4408>`_). Pass ``M[:, :2]`` to :func:`warp_affine` or ``M`` to
:func:`warp_perspective`.

Convention:
    - ``center`` is ``(x, y)`` in pixels, origin at top-left
    - positive ``angle`` rotates **clockwise** as displayed â€” this function negates ``angle``
      before delegating to :func:`get_rotation_matrix2d`, whose convention is CCW-positive
    - ``sx`` and ``sy`` are angles in radians, using :func:`get_shear_matrix2d`'s
      negative-tangent, x-then-y shear about ``center``, applied before rotation, scale and translation
    - returns ``(B, 3, 3)`` affine matrix in pixel coordinates
    - a caller's autocast region does not change the result
      (there, mixed float32 and half ``center`` and shears run in float32)

Args:
    translations: torch.Tensor containing the translation vector with shape ``(B, 2)``.
    center: torch.Tensor containing the center vector with shape ``(B, 2)``.
    scale: torch.Tensor containing the scale factor with shape ``(B, 2)``.
    angle: torch.Tensor of angles in degrees ``(B)``.
    sx: torch.Tensor containing the shear angle in radians in the x-direction with shape ``(B)``.
    sy: torch.Tensor containing the shear angle in radians in the y-direction with shape ``(B)``.

Returns:
    the affine transformation matrix ``(B, 3, 3)``.

See Also:
    - :func:`get_rotation_matrix2d`: rotation and scale only, ``(B, 2, 3)``, counter-clockwise for a positive
      angle.
    - :func:`get_affine_matrix3d`: the 3D composition, ``(B, 4, 4)``, whose positive ``z`` angle turns
      counter-clockwise on screen.
    - :class:`Affine`: warp an image by these parameters in one module, counter-clockwise for a positive angle.
    - :func:`get_shear_matrix2d`: the shear part alone.
    - :func:`~kornia.geometry.solvers.find_affine`: an affine matrix fitted to point correspondences instead of
      built from parameters.

c              3  ó(   "  € T F  qR Jx € K
  	  R # 5i©Nr$   ©rF   Úss   & r&   rH   Ú&get_affine_matrix2d.<locals>.<genexpr>  s   é € Ð
+¡(˜Q�D�=£(ùó   ‚TFNr  )rs  r   Úanyr
   r   rˆ   rD   Úget_shear_matrix2d)	rƒ  rk  rr   rl  rI  rL  r!   Útransform_hÚ	shear_mats	   &&&&&&   r&   Úget_affine_matrix2dr�  Ì  s²   € ôd 4°F¸FÀEÓJ€IØˆf×˜Õ%Óô 5°YÓ?€Kç
ƒsÑ
+ 2¡(Ó
+‡s‡s‚sÑ
+ 2¡(Ó
+×+Ò+ä&?ÀÐUWÓ&\Ñ#ˆ˜RÜ §¡× 2Ñ 2×3Õ3Ü*¨6°rÓ:ˆIØ%Õ1ˆK÷ 4ð Ðˆ;Ð÷	 4Ö3ð Ðús   Â CÃC	c               ó    € V ^8„  d   QhRRRR/# )r   rƒ  r    r"   r$   )r%   s   "r&   r'   r'     s   € ÷  9ñ  9¨<ð  9¸Lñ  9r(   c                óˆ   € \        V RR.RR7       \        ^V 4      R,          pVR;;,          V ,          uu&   \        V4      # )aÊ  Compute the 3x3 matrix of a 2D translation in pixels.

``M = get_translation_matrix2d(translations)`` takes ``(B, 2)`` shifts ``(dx, dy)`` in pixels and returns the
``(B, 3, 3)`` matrix that moves every point by them, a positive ``dx`` to the right and a positive ``dy`` down.
Pass ``M[:, :2]`` to :func:`warp_affine` or ``M`` to :func:`warp_perspective`; to shift an image directly, use
:func:`translate`.

Convention:
    - ``translations`` is ``(dx, dy)`` in pixels; returns ``(B, 3, 3)`` affine matrix in pixel coordinates

Args:
    translations: torch.Tensor containing the translation vector with shape ``(B, 2)``.

Returns:
    the affine transformation matrix ``(B, 3, 3)``.

Raises:
    ShapeError: If ``translations`` is not ``(B, 2)``. A single translation needs shape ``(1, 2)``.

See Also:
    - :func:`translate`: shift an image without building the matrix.
    - :func:`get_affine_matrix2d`: a translation composed with a rotation, a scale and a shear.

r³   r  zOtranslations must be (B, 2); a single (2,) translation needs a batch dimension.rý   r×   r  )r   r   r   )rƒ  r!   s   & r&   Úget_translation_matrix2dr’    sH   € ô2 Ø�s˜C�jÐ&wõô ' q¨,Ó7¸ÕA€IØˆf×˜Õ%Óô .¨iÓ8Ð8r(   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   rk  r    rI  r|   rL  r"   r$   )r%   s   "r&   r'   r'   1  s2   € ÷ B9ñ B9ØðB9Ø4ðB9ØAWðB9àñB9r(   c                óÈ  € Vf=   \         P                  ! V P                  ^ 4      V P                  V P                  R7      MTpVf=   \         P                  ! V P                  ^ 4      V P                  V P                  R7      MTp\         P
                  ! V ^RR7      w  r4VP                  R4      VP                  R4      rC\         P                  ! V4      p\         P                  ! V4      p\         P                  ! V4      p\         P                  ! Wu) WT,          V) WuV,          ,           WcWT,          ,
          ,          .RR7      P                  R^^4      p\        V4      # )uŒ  Compute the 3x3 matrix of a 2D shear given as two angles in radians about a centre.

``M = get_shear_matrix2d(center, sx, sy)`` takes ``(B, 2)`` centres ``(x, y)`` in pixels and optional ``(B,)``
shear angles ``sx`` and ``sy`` in radians (zero when omitted), and returns the ``(B, 3, 3)`` sourceâ†’destination
pixel matrix that shears along ``x`` by ``-tan(sx)`` and then along ``y`` by ``-tan(sy)``, both about ``center``.
:class:`Affine` and :func:`get_affine_matrix2d` read shear angles this way; :func:`shear` and :class:`Shear` take
raw factors about pixel ``(0, 0)`` instead, which shear the other way for the same values below ``pi / 2`` in
magnitude (`#5661 <https://github.com/kornia/kornia/issues/5661>`_).

.. math::
    \begin{bmatrix}
        1 & b \\
        a & ab + 1 \\
    \end{bmatrix}

Here :math:`a = -\tan(sy)` and :math:`b = -\tan(sx)`.

Convention:
    - ``center`` is ``(x, y)`` in pixels, origin at top-left
    - ``sx`` and ``sy`` are angles in radians; about ``center = (cx, cy)``, the forward mapping is
      ``x_out = x - tan(sx) * (y - cy)``, then ``y_out = y - tan(sy) * (x_out - cx)``.
      Pixel x increases rightward and y downward. This differs from :func:`shear`'s raw factors.
    - returns ``(B, 3, 3)`` affine matrix in pixel coordinates

Args:
    center: shearing center coordinates of (x, y).
    sx: shearing angle along x axis in radians.
    sy: shearing angle along y axis in radians

Returns:
    the shear matrix with shape ``(B, 3, 3)``, to be passed to the affine transformation.

See Also:
    - :func:`get_shear_matrix3d`: the 3D shear from up to six angles, ``(B, 4, 4)``.
    - :func:`shear`: shear an image by raw factors about pixel ``(0, 0)``, which shear the other way below
      ``pi / 2``.
    - :func:`get_affine_matrix2d`: this shear composed with a rotation, a scale and a translation.

Examples:
    >>> rng = torch.manual_seed(0)
    >>> sx = torch.randn(1)
    >>> sx
    tensor([1.5410])
    >>> center = torch.tensor([[0., 0.]])  # Bx2
    >>> get_shear_matrix2d(center, sx=sx)
    tensor([[[  1.0000, -33.5468,   0.0000],
             [ -0.0000,   1.0000,   0.0000],
             [  0.0000,   0.0000,   1.0000]]])

r‡   r¨   r8   )r.   rJ   rY   rˆ   r-   Úsplitrð   Útanrk   r²   r   )	rk  rI  rL  r4  r5  Úsx_tanÚsy_tanÚones_tensorrŽ  s	   &&&      r&   rŒ  rŒ  1  s  € ðj SUÒR\Œ�Š�V—[‘[ “^¨F¯M©MÀÇÁÕ	NÐbd€BØRTÒR\Œ�Š�V—[‘[ “^¨F¯M©MÀÇÁÕ	NÐbd€Bä�;Š;�v˜q bÔ)�D€AØ�6‰6�"‹:�q—v‘v˜b“z€qä�YŠY�r‹]€FÜ�YŠY�r‹]€FÜ—/’/ "Ó%€KÜ—’Ø	�g˜v�z¨F¨7°KÈ6Å/Õ4QÐSYÐagÕakÕ]kÕSlÐmÐsuôç
�dˆ2ˆq�!ƒnð ô .¨iÓ8Ð8r(   c               óD   € V ^8„  d   QhRRRRRRRRRRRRR	RR
RRRRRRR/# )r   rƒ  r    rk  rr   ÚanglesÚsxyr|   ÚsxzÚsyxÚsyzÚszxÚszyr"   r$   )r%   s   "r&   r'   r'   v  sƒ   € ÷ Nñ NØðNàðNð ðNð ð	Nð
 
 ðNð 
 ðNð 
 ðNð 
 ðNð 
 ðNð 
 ðNð ñNr(   c
                ó¾  € \        W) V4      p
V
R;;,          V ,          uu&   \        V
4      p\        ;QJ d    R WEWgW‰3 4       F  '       g   K   RM	  RM! R WEWgW‰3 4       4      '       d\   \        W±WEWgW‰4      w  r±rErgr‰\	        VP
                  P                  4      ;_uu_ 4        \        WWVWxV	4      pW¼,          pRRR4       V# V#   + '       g   i     T# ; i)uR  Compose a 3D affine matrix from a translation, axis-angle rotation, scale and shears about a centre.

``M = get_affine_matrix3d(translations, center, scale, angles)`` takes ``(B, 3)`` translations ``(dx, dy, dz)``,
centres ``(x, y, z)`` in pixels, per-axis scale factors and axis-angle vectors in degrees, plus up to six optional
``(B,)`` shear angles in radians, and returns the ``(B, 4, 4)`` sourceâ†’destination pixel matrix that shears, scales,
rotates and then translates, the first three about ``center``. The angles are negated before
:func:`get_projective_transform`, so they turn the other way from that function and :func:`rotate3d`: a positive
rotation about ``z`` turns counter-clockwise on screen, as :func:`rotate` does and :func:`get_affine_matrix2d`
does not (`#4408 <https://github.com/kornia/kornia/issues/4408>`_). Pass ``M[:, :3]`` to :func:`warp_affine3d`
or ``M`` to :func:`warp_perspective3d`.

Convention:
    - ``center`` is ``(x, y, z)`` in pixels, origin at the top-left of the first depth
      slice (``z = 0``)
    - ``angles`` are negated before delegating to :func:`get_projective_transform`, whose own
      rotation convention follows the right-hand rule (see
      :func:`kornia.geometry.conversions.axis_angle_to_rotation_matrix`)
    - returns ``(B, 4, 4)`` affine matrix in pixel coordinates
    - a caller's autocast region does not change the result
      (there, mixed float32 and half ``center`` and shears run in float32)

Args:
    translations: torch.Tensor containing the translation vector (dx,dy,dz) with shape ``(B, 3)``.
    center: torch.Tensor containing the center vector (x,y,z) with shape ``(B, 3)``.
    scale: per-axis scale factors ``(sx, sy, sz)`` with shape ``(B, 3)``, or ``(1, 3)`` or ``(3,)`` shared
        across the batch. A ``(3,)`` tensor always means per-axis factors, including when ``B = 3``.
        Use ``(B, 1)`` for one isotropic factor per sample, or ``(1,)`` for one factor shared across all samples
        and axes. Per-sample isotropic factors must have shape ``(B, 1)``, not ``(B,)``.
    angles: axis angle vector containing the rotation angles in degrees in the form
        of (rx, ry, rz) with shape ``(B, 3)``. Internally it calls Rodrigues to compute
        the rotation matrix from axis-angle.
    sxy: the shear angle ``sxy`` of :func:`get_shear_matrix3d`, in radians, with shape ``(B)``.
    sxz: the shear angle ``sxz`` of :func:`get_shear_matrix3d`, in radians, with shape ``(B)``.
    syx: the shear angle ``syx`` of :func:`get_shear_matrix3d`, in radians, with shape ``(B)``.
    syz: the shear angle ``syz`` of :func:`get_shear_matrix3d`, in radians, with shape ``(B)``.
    szx: the shear angle ``szx`` of :func:`get_shear_matrix3d`, in radians, with shape ``(B)``.
    szy: the shear angle ``szy`` of :func:`get_shear_matrix3d`, in radians, with shape ``(B)``.

Returns:
    the 3d affine transformation matrix ``(B, 4, 4)``.

Raises:
    ShapeError: If ``scale`` is not ``(B, 3)``, ``(B, 1)``, ``(1, 3)``, ``(3,)`` or ``(1,)``;
        see :func:`get_projective_transform`.

See Also:
    - :func:`get_affine_matrix2d`: the 2D composition, whose positive angle turns clockwise on screen.
    - :func:`get_projective_transform`: rotation and scale only, ``(B, 3, 4)``, with the angles as given.
    - :func:`get_shear_matrix3d`: the shear part alone.
    - :func:`warp_affine3d`: warp a volume by ``M[:, :3]``.

c              3  ó(   "  € T F  qR Jx € K
  	  R # 5ir†  r$   r‡  s   & r&   rH   Ú&get_affine_matrix3d.<locals>.<genexpr>»  s   é € Ð
AÑ"@˜Q�D�=Ó"@ùrŠ  TFNr3  )Úget_projective_transformr   r‹  r
   r   rˆ   rD   Úget_shear_matrix3d)rƒ  rk  rr   r›  rœ  r�  rž  rŸ  r   r¡  r!   r�  rŽ  s   &&&&&&&&&&   r&   Úget_affine_matrix3dr§  v  sÌ   € ô@ 7°v¸wÈÓN€IØˆf×˜Õ%Óô 7°yÓA€Kß
ƒsÑ
A 3¨S°sÑ"@Ó
A‡s‡s‚sÑ
A 3¨S°sÑ"@Ó
A×AÒAä<UØ ¨3°Só=
Ñ9ˆ˜S s°ô   §¡× 2Ñ 2×3Õ3Ü*¨6¸À#ÈCÓPˆIØ%Õ1ˆK÷ 4ð Ðˆ;Ð÷	 4Ö3ð Ðús   Â(CÃC	c               ó8   € V ^8„  d   QhRRRRRRRRRRRRR	RR
R/# )r   rk  r    rœ  r|   r�  rž  rŸ  r   r¡  r"   r$   )r%   s   "r&   r'   r'   Ç  sb   € ÷ e;ñ e;Øðe;à	ðe;ð 
 ðe;ð 
 ð	e;ð
 
 ðe;ð 
 ðe;ð 
 ðe;ð ñe;r(   c                ó–  € Vf=   \         P                  ! V P                  ^ 4      V P                  V P                  R7      MTpVf=   \         P                  ! V P                  ^ 4      V P                  V P                  R7      MTpVf=   \         P                  ! V P                  ^ 4      V P                  V P                  R7      MTpVf=   \         P                  ! V P                  ^ 4      V P                  V P                  R7      MTpVf=   \         P                  ! V P                  ^ 4      V P                  V P                  R7      MTpVf=   \         P                  ! V P                  ^ 4      V P                  V P                  R7      MTp\         P
                  ! V ^RR7      w  rxp	VP                  R4      VP                  R4      V	P                  R4      r˜p\         P                  ! V4      p
\         P                  ! V4      p\         P                  ! V4      p\         P                  ! V4      p\         P                  ! V4      p\         P                  ! V4      pV
) V) V) V) V) V) 3w  r«rÍrï\        W«WÍWï4      w	  pppppppppVVV,          VV,          ,           VV	,          ,           ,
          pVVV,          VV,          ,           VV	,          ,           ,
          pV	VV,          VV,          ,           VV	,          ,           ,
          p\         P                  ! VVVVVVVVVVVV.R4      P                  R^^4      p\        V4      # )u—  Compute the 4x4 matrix of a 3D shear given as up to six angles in radians about a centre.

``M = get_shear_matrix3d(center, sxy, sxz, syx, syz, szx, szy)`` takes ``(B, 3)`` centres ``(x, y, z)`` in pixels
and optional ``(B,)`` shear angles in radians (zero when omitted), and returns the ``(B, 4, 4)`` sourceâ†’destination
pixel matrix below, whose translation keeps ``center`` fixed. With :math:`S_{ab} = -\tan(s_{ab})`, the angle ``sab``
on its own adds :math:`S_{ab}` times coordinate ``a`` to coordinate ``b``. ``sxy`` and ``sxz`` form one shear,
``syx`` and ``syz`` a second and ``szx`` and ``szy`` a third, and the linear part is the product of the three in
that order, so a point is sheared by ``szx`` and ``szy`` first and by ``sxy`` and ``sxz`` last.

.. math::
    \begin{bmatrix}
        1 & o & r & x - (x + oy + rz) \\
        m & p & s & y - (mx + py + sz) \\
        n & q & t & z - (nx + qy + tz) \\
        0 & 0 & 0 & 1  \\
    \end{bmatrix}
    Where:
    m = S_{xy}
    n = S_{xz}
    o = S_{yx}
    p = S_{xy}S_{yx} + 1
    q = S_{xz}S_{yx} + S_{yz}
    r = S_{zx} + S_{yx}S_{zy}
    s = S_{xy}S_{zx} + (S_{xy}S_{yx} + 1)S_{zy}
    t = S_{xz}S_{zx} + (S_{xz}S_{yx} + S_{yz})S_{zy} + 1

Here :math:`S_{ab} = -\tan(s_{ab})`, and :math:`(x, y, z)` is ``center``.

Convention:
    - ``center`` is ``(x, y, z)`` in pixels, origin at the top-left of the first depth
      slice (``z = 0``); it is a fixed point of the returned matrix for every combination of shears
    - returns ``(B, 4, 4)`` affine matrix in pixel coordinates

Args:
    center: shearing center coordinates of (x, y, z), with shape ``(B, 3)``.
    sxy: shearing angle in radians that adds :math:`S_{xy} x` to ``y``.
    sxz: shearing angle in radians that adds :math:`S_{xz} x` to ``z``.
    syx: shearing angle in radians that adds :math:`S_{yx} y` to ``x``.
    syz: shearing angle in radians that adds :math:`S_{yz} y` to ``z``.
    szx: shearing angle in radians that adds :math:`S_{zx} z` to ``x``.
    szy: shearing angle in radians that adds :math:`S_{zy} z` to ``y``.

Returns:
    the shear matrix with shape ``(B, 4, 4)``, to be passed to the affine transformation.

See Also:
    - :func:`get_shear_matrix2d`: the 2D shear from two angles, ``(B, 3, 3)``.
    - :func:`get_affine_matrix3d`: this shear composed with a rotation, a scale and a translation.
    - :func:`warp_perspective3d`: warp a volume by the returned matrix.

Examples:
    >>> rng = torch.manual_seed(0)
    >>> sxy, sxz, syx, syz = torch.randn(4, 1)
    >>> sxy, sxz, syx, syz
    (tensor([1.5410]), tensor([-0.2934]), tensor([-2.1788]), tensor([0.5684]))
    >>> center = torch.tensor([[0., 0., 0.]])  # Bx3
    >>> get_shear_matrix3d(center, sxy=sxy, sxz=sxz, syx=syx, syz=syz)
    tensor([[[  1.0000,  -1.4369,   0.0000,   0.0000],
             [-33.5468,  49.2039,   0.0000,   0.0000],
             [  0.3022,  -1.0729,   1.0000,   0.0000],
             [  0.0000,   0.0000,   0.0000,   1.0000]]])

r‡   r¨   r8   )r.   rJ   rY   rˆ   r-   r•  rð   r–  Ú_compute_shear_matrix_3dr²   r   )rk  rœ  r�  rž  rŸ  r   r¡  r4  r5  r6  Úsxy_tanÚsxz_tanÚsyx_tanÚsyz_tanÚszx_tanÚszy_tanÚm00Úm10Úm20Úm01Úm11Úm21Úm02Úm12Úm22Úm03Úm13Úm23rŽ  s   &&&&&&&                      r&   r¦  r¦  Ç  s‡  € ðP TWÒS^Œ%�+Š+�f—k‘k !“n¨V¯]©]À&Ç,Á,Õ
OÐdg€CØSVÒS^Œ%�+Š+�f—k‘k !“n¨V¯]©]À&Ç,Á,Õ
OÐdg€CØSVÒS^Œ%�+Š+�f—k‘k !“n¨V¯]©]À&Ç,Á,Õ
OÐdg€CØSVÒS^Œ%�+Š+�f—k‘k !“n¨V¯]©]À&Ç,Á,Õ
OÐdg€CØSVÒS^Œ%�+Š+�f—k‘k !“n¨V¯]©]À&Ç,Á,Õ
OÐdg€CØSVÒS^Œ%�+Š+�f—k‘k !“n¨V¯]©]À&Ç,Á,Õ
OÐdg€Cä�kŠk˜& !¨Ô,�G€Aˆ!Ø�f‰f�R‹j˜!Ÿ&™& ›* a§f¡f¨R£jˆ!€Aä�iŠi˜‹n€GÜ�iŠi˜‹n€GÜ�iŠi˜‹n€GÜ�iŠi˜‹n€GÜ�iŠi˜‹n€GÜ�iŠi˜‹n€Gð =D¸8ÀgÀXÐPWÈxÐZaÐYaÐdkÐckÐnuÐmuÐ;uÑ8€G�g¨Ü2JØ˜'¨Gó3Ñ/€Cˆˆc�3˜˜S # s¨Cð
 ˆs�Q�w˜˜q�Õ  3¨¥7Õ*Õ
+€CØ
ˆs�Q�w˜˜q�Õ  3¨¥7Õ*Õ
+€CØ
ˆs�Q�w˜˜q�Õ  3¨¥7Õ*Õ
+€Cä—’˜S # s¨C°°c¸3ÀÀSÈ#ÈsÐTWÐXÐZ\Ó]×bÑbÐceÐghÐjkÓl€IÜ/°	Ó:Ð:r(   c               ó4   € V ^8„  d   QhRRRRRRRRRRRRRR	/# )
r   r«  r    r¬  r­  r®  r¯  r°  r"   ztuple[torch.Tensor, ...]r$   )r%   s   "r&   r'   r'   /  sN   € ÷ 7ñ 7Øð7àð7ð ð7ð ð	7ð
 ð7ð ð7ð ñ7r(   c           	     ó  € \         P                  ! V 4      pY`Tr˜pY V,          V,           W,          V,           rËp
W%,          V,           pW,          W[,          ,           pW,          W\,          ,           V,           pWxWšW¼WÞV3	# r†  )r.   rk   )r«  r¬  r­  r®  r¯  r°  r™  r±  r²  r³  r´  rµ  r¶  r·  r¸  r¹  s   &&&&&&          r&   rª  rª  /  sx   € ô —/’/ 'Ó*€Kà¨'ˆc€CØ wÕ.°Õ<¸gÕ>OÐRYÕ>Yˆc€CØ
Õ
˜gÕ
%€CØ
Õ
˜g�mÕ
+€CØ
Õ
˜g�mÕ
+¨kÕ
9€CØ�S˜s¨°3Ð6Ð6r(   c               ó4   € V ^8„  d   QhRRRRRRRRRRR	R
RR/# )r   r   r    r¤   rv   rž   ÚflagsrA   r@   ry   r4   r"   r$   )r%   s   "r&   r'   r'   A  sW   € ÷ dñ dØ	ðdàðdð  ðdð ð	dð
 ðdð ðdð ñdr(   c                ó€  € \        V P                  4      ^8w  d   \        V P                  4      h\        VP                  4      ^8X  d   VP                  RR R8X  g   \        VP                  4      h\        V4      ^8w  d   \        V4      hV P                  4       w  rgr‰p
V^ ,          ^ 8  g   V^,          ^ 8  g   V^,          ^ 8  d   \	        RV R24      hV^ 8X  g+   V^ ,          ^ 8X  g   V^,          ^ 8X  g   V^,          ^ 8X  d   \        WW#WE4      # V P                  p\        W4      '       d    V P                  4       VP                  4       r\        W4      w  rV'       d   \        W4      p V P                  RR w  r‰p
W‰V
3pTp\        V P                  P                  4      ;_uu_ 4        \        V4      p\        WìV4      p\!        V4      pVR	,          pWg.\#        V4      Op\$        P&                  ! VVVR7      pRRR4       \)        V XWSVR7      P+                  V4      #   + '       g   i     L.; i)
u  Warp a volume by a sourceâ†’destination 3x4 affine matrix in voxel coordinates.

``out = warp_affine3d(src, M, dsize)`` takes volumes ``(B, C, D, H, W)`` and one ``(B, 3, 4)`` affine matrix per
volume that maps **source** voxels ``(x, y, z)`` to **destination** voxels, and returns the ``(B, C, d, h, w)``
destination volumes for ``dsize = (d, h, w)``; ``flags`` is the interpolation mode. Keep the default
``align_corners=True``: at ``False`` the matrix is normalized for corner-aligned voxels while ``grid_sample`` reads
half-voxel ones, 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 a ``(B, 4, 4)`` homography, use
:func:`warp_perspective3d`; for images, :func:`warp_affine`; to keep the input size, :func:`affine3d`.

.. warning::
    This API signature it is experimental and might suffer some changes in the future.

Convention:
    - align_corners: ``True`` by default
    - padding_mode: ``'zeros'`` by default
    - ``M`` has the batch of ``src``: one matrix is not shared by a larger batch
    - under ``align_corners=True``, a one-voxel source axis is sampled like a longer one, so positions outside it
      get ``padding_mode``: ``'zeros'`` reads it as the first of two voxels, the second holding the padding
      (`#6433 <https://github.com/kornia/kornia/issues/6433>`_)
    - a caller's autocast region does not change the matrix arithmetic or the sampling grid
      (there, a ``src`` and ``M`` that mix float32 and half dtypes run in float32)
    - an empty batch returns shape ``(0, C, d, h, w)`` with gradients connected to both inputs
      even when a source spatial dimension is zero
    - a zero output dimension returns an autograd-connected empty tensor;
      negative output dimensions raise ``ValueError``
    - a nonempty batch requires positive source spatial dimensions for a nonempty output

Args:
    src : input torch.Tensor of shape ``(B, C, D, H, W)``.
    M: affine transformation matrix of shape ``(B, 3, 4)``.
    dsize: size of the output image (depth, height, width).
    flags: interpolation mode to calculate output values
      ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values
      ``'zeros'`` | ``'border'`` | ``'reflection'``.
    align_corners : mode for grid_generation.

Returns:
    torch.Tensor: the warped 3d torch.tensor with shape ``(B, C, d, h, w)``, spatial sizes
    given by ``dsize``.

See Also:
    - :func:`warp_affine`: the 2D warp of images by ``(B, 2, 3)`` matrices.
    - :func:`warp_perspective3d`: a ``(B, 4, 4)`` homography; its default ``align_corners=False`` resamples even an
      identity.
    - :func:`affine3d`: keeps the input size and accepts an unbatched ``(C, D, H, W)`` volume.
    - :func:`get_projective_transform`: the ``(B, 3, 4)`` matrix of a rotation and a scale about a centre.
    - :func:`crop_by_transform_mat3d`: calls this warp with the top three rows of a ``(B, 3, 4)`` or ``(B, 4, 4)``
      matrix, and broadcasts a batch-1 matrix.

NrÈ   r*   r¦   rŠ   rc   )rË   é   r    )r©   r~  )rÏ   rQ   ÚAssertionErrorrY   rÐ   r¡   r-   r>   rh   r
   rZ   r   rˆ   rD   r   r   r   rí   rU   rÙ   r   rŒ   )r   r¤   rv   rÀ  r@   ry   r³   rÜ   r(  rµ   r¶   rÑ   Úsize_srcÚsize_outÚM_4x4r¹   rº   ÚP_normÚ	dsize_outr—   s   &&&&&&              r&   Úwarp_affine3drÉ  A  sã  € ôx ˆ3�9‰9ƒ~˜ÔÜ˜SŸY™YÓ'Ð'Ü�—‘‹L˜AÔ !§'¡'¨"¨# ,°&Ô"8Ü˜QŸW™WÓ%Ð%Ü
ˆ5ƒz�Q„Ü˜UÓ#Ð#Ø—H‘H“J�M€Aˆ!�ØˆQ…x�!„|�u˜Q•x !”| u¨Q¥x°!¤|ÜÐAÀ%ÀÈÐJÓKÐKð 	ˆA„v��q•˜Q” %¨¥(¨a¤-°5¸µ8¸q´=Ü$ S¨U¸<ÓWÐWØ—	‘	€IÜ˜×ÒØ—‘“˜aŸg™g›iˆQÜ& sÓ.�F€CßÜ! #Ó4ˆØ—)‘)˜B˜C�.‰ˆˆaà&'¨A Y€HØ%*€Hô 
˜CŸJ™JŸO™O×	,Õ	,Ü4°QÓ7ˆô 1GÀuÐX`Ó0aÐä"5Ð6MÓ"NÐØ6°uÕ=ˆð !"Ð6¤t¨H£~Ð6ˆ	Ü�}Š}˜V Y¸mÔLˆ÷ 
-ô ˜c 4°}Ð_kÔl×oÑoØóð ÷ 
-×	,ús   Æ4AH-È-H=	c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úrmatr    Útvecr"   r$   )r%   s   "r&   r'   r'   ¨  s!   € ÷ 'ñ '˜\ð '°ð 'À,ñ 'r(   c                ó>  € \        V P                  4      ^8¼  d   V P                  RR R8X  g   \        V P                  4      h\        VP                  4      ^8¼  d   VP                  RR R8X  g   \        VP                  4      h\        P                  ! W.R4      # )a7  Stack rotations and translations into ``[R | t]`` matrices of shape ``(*, 3, 4)``.

``P = projection_from_Rt(rmat, tvec)`` concatenates rotations ``(*, 3, 3)`` and translations ``(*, 3, 1)`` with the
same leading dimensions into the ``(*, 3, 4)`` matrices :math:`P = [R | t]`. It applies no intrinsics: for a camera
projection matrix :math:`K [R | t]`, use :func:`~kornia.geometry.epipolar.projection_from_KRt`, and for a 4x4
pose, :func:`~kornia.geometry.conversions.Rt_to_matrix4x4`.

.. warning::
    This API signature it is experimental and might suffer some changes in the future.

Convention:
    - returns the concatenation :math:`[R | t]` with shape ``(*, 3, 4)``

Args:
   rmat: the rotation matrix with shape ``(*, 3, 3)``.
   tvec: the translation vector with shape ``(*, 3, 1)``.

Returns:
   the projection matrix with shape ``(*, 3, 4)``.

See Also:
    - :func:`~kornia.geometry.epipolar.projection_from_KRt`: also multiplies by the camera intrinsics ``K``.
    - :func:`~kornia.geometry.conversions.Rt_to_matrix4x4`: the homogeneous ``(B, 4, 4)`` pose instead.

Nrc   rÊ   )rË   r…   r8   )rÏ   rQ   rÃ  r.   r:  )rË  rÌ  s   &&r&   Úprojection_from_RtrÎ  ¨  sw   € ô4 �—
‘
‹O˜qÔ  T§Z¡Z°° _¸Ô%>Ü˜TŸZ™ZÓ(Ð(Ü�—
‘
‹O˜qÔ  T§Z¡Z°° _¸Ô%>Ü˜TŸZ™ZÓ(Ð(ä�9Š9�d�\ 2Ó&Ð&r(   c               ó    € V ^8„  d   QhRRRR/# )r   Úscalesr    r"   rû   r$   )r%   s   "r&   r'   r'   Ê  s   € ÷ 8ñ 8 ð 8°$ñ 8r(   c                óF  € RpV P                  4       ^8X  d;   V P                  ^ ,          ^8X  d   \        V R.VR7       R# \        V R.VR7       R# V P                  4       ^8X  d+   V P                  ^,          ^8X  d   \        V RR.VR7       R# \        V RR.VR7       R# )a  Validate batched scale factors or shared ``(3,)`` per-axis and ``(1,)`` isotropic factors.

A ``(3,)`` tensor means ``(sx, sy, sz)`` shared by every sample, including at ``B = 3``. Per-sample isotropic
factors go in a column, ``(B, 1)``; other 1-D lengths are unsupported.
zœscale must be (B, 3) or (1, 3) per-axis, (B, 1) isotropic, (3,) shared per-axis or (1,) shared isotropic factors; reshape per-sample factors (B,) to (B, 1).r   rý   rÿ   r³   N)rP   rQ   r   )rÐ  rþ   s   & r&   Ú_check_scale_shape3drÒ  Ê  s…   € ð	>ð ð ‡z�zƒ|�qÔØ�<‰<˜�?˜aÔÜ˜v¨ u°#×6ä˜v¨ u°#×6Ø	�‰‹˜Ô	˜vŸ|™|¨A�°!Ô3Ü˜6 C¨ :°3×7ä˜6 C¨ :°3×7r(   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   rk  r    r›  rÐ  r"   r$   )r%   s   "r&   r'   r'   ß  s0   € ÷ W ñ W  \ð W ¸<ð W ÐQ]ð W Ðbnñ W r(   c                óB  € \        V P                  4      ^8X  d   V P                  R,          ^8X  g   \        V P                  4      h\        VP                  4      ^8X  d   VP                  R,          ^8X  g   \        VP                  4      hV P                  VP                  8w  d!   \        V P                  VP                  4      hV P                  VP                  8w  d!   \        V P                  VP                  4      h\        V4       \        V P                  P                  4      ;_uu_ 4        VP                  \        P                  \        P                  39   p\        P                  ! V'       d   VP                  4       MT4      p\        V4      pV'       d   VP                  VP                  4      p\        ^V4      pWbP!                  ^R7      ,          pWVP                  V4      ,          p\        ^VRR7      pVR;;,          V ,          uu&   VP#                  4       p\%        VRR7      p\'        V\        P(                  ! V 4      R,          4      p	\+        V	4      p	Wy,          V,          p	RRR4       X	R	,          #   + '       g   i     L; i)
u>  Compute the 3x4 affine matrix of a 3D scaling and axis-angle rotation about a centre.

``P = get_projective_transform(center, angles, scales)`` takes ``(B, 3)`` centres ``(x, y, z)`` in pixels,
axis-angle vectors ``(rx, ry, rz)`` in degrees and per-axis scale factors, and returns the ``(B, 3, 4)``
sourceâ†’destination pixel matrix that scales and then rotates about ``center``, as :func:`warp_affine3d` takes. The
rotation is Rodrigues' formula on ``angles`` converted to radians and follows the right-hand rule, so a
positive rotation about ``z`` turns clockwise on screen, the opposite of :func:`get_rotation_matrix2d`. The matrix
is affine, not projective; to add a translation and shears, use :func:`get_affine_matrix3d`, whose angles turn
the other way (`#4408 <https://github.com/kornia/kornia/issues/4408>`_).

.. warning::
    This API signature it is experimental and might suffer some changes in the future.

Convention:
    - ``center`` is ``(x, y, z)`` in pixels, origin at the top-left of the first depth
      slice (``z = 0``)
    - rotation follows the right-hand rule (see
      :func:`kornia.geometry.conversions.axis_angle_to_rotation_matrix`); a positive rotation
      about +z is **clockwise on screen** (y-down image axes) â€” opposite of :func:`get_rotation_matrix2d`
    - returns the projection matrix ``(B, 3, 4)`` in pixel coordinates
    - a caller's autocast region does not change the result
    - ``float16`` and ``bfloat16`` angles are converted and rotated in ``float32``, and the rotation is rounded
      once to the input dtype

Args:
    center: center of the rotation (x,y,z) in the source with shape ``(B, 3)``.
    angles: axis angle vector containing the rotation angles in degrees in the form
        of (rx, ry, rz) with shape ``(B, 3)``. Internally it calls Rodrigues to compute
        the rotation matrix from axis-angle.
    scales: per-axis scale factors ``(sx, sy, sz)`` with shape ``(B, 3)``, or ``(1, 3)`` or ``(3,)`` shared
        across the batch. A ``(3,)`` tensor always means per-axis factors, including when ``B = 3``.
        Use ``(B, 1)`` for one isotropic factor per sample, or ``(1,)`` for one factor shared across all samples
        and axes. Per-sample isotropic factors must have shape ``(B, 1)``, not ``(B,)``.

Returns:
    the projection matrix of 3D rotation with shape ``(B, 3, 4)``.

Raises:
    ShapeError: If ``scales`` is not ``(B, 3)``, ``(B, 1)``, ``(1, 3)``, ``(3,)`` or ``(1,)``.

See Also:
    - :func:`get_rotation_matrix2d`: the 2D rotation and scale, counter-clockwise on screen.
    - :func:`get_affine_matrix3d`: adds a translation and shears, and negates the angles.
    - :func:`rotate3d`: rotate a volume about its centre by such an axis-angle vector.
    - :func:`~kornia.geometry.conversions.axis_angle_to_rotation_matrix`: the 3x3 rotation of an axis-angle vector
      in radians.

r¨   F)Úshared_memory)Úcheck_errorsNr8   ).r~  r8   ).N).r~  r©   )rÏ   rQ   rÃ  rˆ   r-   rÒ  r   rD   r.   r  r  Údeg2radrh   r   rŒ   r   Ú	unsqueezeÚcloner   rÎ  Ú
zeros_liker   )
rk  r›  rÐ  ÚhalfÚaxis_angle_radrË  Úscaling_matrixÚfrom_origin_matÚto_origin_matÚproj_mats
   &&&       r&   r¥  r¥  ß  sä  € ôb �—‘Ó Ô" v§|¡|°BÕ'7¸1Ô'<Ü˜VŸ\™\Ó*Ð*Ü�—‘Ó Ô" v§|¡|°BÕ'7¸1Ô'<Ü˜VŸ\™\Ó*Ð*Ø‡}�}˜Ÿ™Ô%Ü˜VŸ]™]¨F¯M©MÓ:Ð:Ø‡|�|�v—|‘|Ô#Ü˜VŸ\™\¨6¯<©<Ó8Ð8Ü˜Ô ô 
˜FŸM™M×.Ñ.×	/Õ	/ð �|‰|¤§¡¬u¯~©~Ð>Ñ>ˆÜ',§}¢}Çt°V·\±\´^ÐQWÓ'XˆÜ:¸>ÓJˆßØ—7‘7˜6Ÿ<™<Ó(ˆDÜ'/°°4Ó'8ˆØ'×*:Ñ*:¸qÐ*:Ó*AÕAˆØ×'Ñ'¨Ó-Õ-ˆô # 1 d¸%Ô@ˆØ˜×$¨Õ.Ó$à'×-Ñ-Ó/ˆä+¨OÈ%ÔPˆô & d¬E×,<Ò,<¸VÓ,DÀYÕ,OÓPˆô 8¸ÓAˆØ"Õ-°Õ=ˆ÷3 
0ð6 �JÕÐ÷7 
0×	/ús   Ä7EJÊJ	c               ó$   € V ^8„  d   QhRRRRRR/# )r   r   r    Údstr"   r$   )r%   s   "r&   r'   r'   9  s&   € ÷ _ñ _ \ð _¸ð _Èñ _r(   c                óf  € \        V \        P                  4      '       g   \        R\	        V 4       24      h\        V\        P                  4      '       g   \        R\	        V4       24      hV P
                  RR R8X  g   \        RV P
                   24      hV P
                  VP
                  8X  g   \        RVP
                   24      hV P
                  ^ ,          VP
                  ^ ,          8X  g&   \        RV P
                   RVP
                   24      hV P                  VP                  8X  d   V P                  VP                  8X  gA   \        RV P                   RVP                   R	V P                   RVP                   R
2	4      hV P                  4       '       gN   \        P                  ! ^ V P                  R7      P                  pV P                  V4      VP                  V4      r. pR F�  pVP                  \        V RV3,          VRV3,          R4      4       VP                  \        V RV3,          VRV3,          R4      4       VP                  \        V RV3,          VRV3,          R4      4       K�  	  \        P                  ! V^4      p\        P                  ! VR,          VR,          VR,          VR,          VR,          VR,          VR,          VR,          VR,          VR,          VR,          VR,          VR ,          VR!,          VR",          .^4      p\!        WV4      pV P
                  ^ ,          p\        P                  ! V^V P                  V P                  R7      p	VR#,          V	R$&   V	R&,          P#                  ^4       V	P%                  R%^^4      # )'u'  Compute the 3D homography that maps five source box corners exactly onto destination ones.

``M = get_perspective_transform3d(src, dst)`` takes two ``(B, 8, 3)`` sets of ``(x, y, z)`` box corners in
:func:`~kornia.geometry.bbox.bbox_generator3d` order and returns the ``(B, 4, 4)`` homography, with
``M[3, 3] = 1``, that maps corners 0, 1, 2, 5 and 7 of ``src`` onto those of ``dst``: the sourceâ†’destination voxel
homography that :func:`warp_perspective3d` takes. The other three corners map onto theirs only when all eight pairs
are related by one homography. For 2D points, use :func:`get_perspective_transform`.

The function calculates the matrix of a perspective transform so that:

.. math::

    \begin{bmatrix}
    t_{i}x_{i}^{'} \\
    t_{i}y_{i}^{'} \\
    t_{i}z_{i}^{'} \\
    t_{i} \\
    \end{bmatrix}
    =
    \textbf{map_matrix} \cdot
    \begin{bmatrix}
    x_{i} \\
    y_{i} \\
    z_{i} \\
    1 \\
    \end{bmatrix}

where

.. math::
    dst(i) = (x_{i}^{'},y_{i}^{'},z_{i}^{'}), src(i) = (x_{i}, y_{i}, z_{i}), i = 0,1,2,5,7

Concrete math is as below:

.. math::

    \[ u_i =\frac{c_{00} * x_i + c_{01} * y_i + c_{02} * z_i + c_{03}}
        {c_{30} * x_i + c_{31} * y_i + c_{32} * z_i + c_{33}} \]
    \[ v_i =\frac{c_{10} * x_i + c_{11} * y_i + c_{12} * z_i + c_{13}}
        {c_{30} * x_i + c_{31} * y_i + c_{32} * z_i + c_{33}} \]
    \[ w_i =\frac{c_{20} * x_i + c_{21} * y_i + c_{22} * z_i + c_{23}}
        {c_{30} * x_i + c_{31} * y_i + c_{32} * z_i + c_{33}} \]

.. math::

    \begin{pmatrix}
    x_0 & y_0 & z_0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -x_0*u_0 & -y_0*u_0 & -z_0 * u_0 \\
    x_1 & y_1 & z_1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -x_1*u_1 & -y_1*u_1 & -z_1 * u_1 \\
    x_2 & y_2 & z_2 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -x_2*u_2 & -y_2*u_2 & -z_2 * u_2 \\
    x_5 & y_5 & z_5 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -x_5*u_5 & -y_5*u_5 & -z_5 * u_5 \\
    x_7 & y_7 & z_7 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -x_7*u_7 & -y_7*u_7 & -z_7 * u_7 \\
    0 & 0 & 0 & 0 & x_0 & y_0 & z_0 & 1 & 0 & 0 & 0 & 0 & -x_0*v_0 & -y_0*v_0 & -z_0 * v_0 \\
    0 & 0 & 0 & 0 & x_1 & y_1 & z_1 & 1 & 0 & 0 & 0 & 0 & -x_1*v_1 & -y_1*v_1 & -z_1 * v_1 \\
    0 & 0 & 0 & 0 & x_2 & y_2 & z_2 & 1 & 0 & 0 & 0 & 0 & -x_2*v_2 & -y_2*v_2 & -z_2 * v_2 \\
    0 & 0 & 0 & 0 & x_5 & y_5 & z_5 & 1 & 0 & 0 & 0 & 0 & -x_5*v_5 & -y_5*v_5 & -z_5 * v_5 \\
    0 & 0 & 0 & 0 & x_7 & y_7 & z_7 & 1 & 0 & 0 & 0 & 0 & -x_7*v_7 & -y_7*v_7 & -z_7 * v_7 \\
    0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & x_0 & y_0 & z_0 & 1 & -x_0*w_0 & -y_0*w_0 & -z_0 * w_0 \\
    0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & x_1 & y_1 & z_1 & 1 & -x_1*w_1 & -y_1*w_1 & -z_1 * w_1 \\
    0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & x_2 & y_2 & z_2 & 1 & -x_2*w_2 & -y_2*w_2 & -z_2 * w_2 \\
    0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & x_5 & y_5 & z_5 & 1 & -x_5*w_5 & -y_5*w_5 & -z_5 * w_5 \\
    0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & x_7 & y_7 & z_7 & 1 & -x_7*w_7 & -y_7*w_7 & -z_7 * w_7 \\
    \end{pmatrix}

Convention:
    - points: ``(x, y, z)``, pixel centers, origin at the top-left of the first depth slice; shape ``(B, 8, 3)``
    - the 15 unknowns are solved exactly from points 0, 1, 2, 5 and 7, the corners ``000``, ``100``, ``110``,
      ``101`` and ``011`` in :func:`~kornia.geometry.bbox.bbox_generator3d` order; points 3, 4 and 6 are not
      used, so they map onto their ``dst`` only when all eight pairs are related by one homography
    - returns the sourceâ†’destination **pixel** homography ``(B, 4, 4)``
    - integer or boolean points give a matrix in the default floating dtype; floating points keep theirs

Args:
    src: coordinates of the box corners in the source volume with shape ``(B, 8, 3)``.
    dst: coordinates of the corresponding box corners in
        the destination volume with shape ``(B, 8, 3)``.

Returns:
    the perspective transformation with shape ``(B, 4, 4)``.

See Also:
    - :func:`get_perspective_transform`: the 2D homography from four point pairs.
    - :func:`warp_perspective3d`: warp a volume by the returned homography.
    - :func:`~kornia.geometry.bbox.bbox_generator3d`: box corners in the order this function reads them.

z&Input type is not a torch.Tensor. Got Nz)Inputs must be a Bx8x3 torch.Tensor. Got z%Inputs must have the same shape. Got z3Inputs must have same batch size dimension. Expect z	 but got z5Expect `src` and `dst` to be in the same device (Got z, z) with the same dtype (Got z).rg  r©   r4  r5  r6  r‡   rc   )é   rË   )r6   r…   r   é   é   )r©   r2  r6   )r©   r2  r…   )r©   r2  r   )r©   r.  r6   )r©   r.  r…   )r©   r.  r   )r©   r0  r6   )r©   r0  r…   )r©   r0  r   )r©   ºrå  é   Nr6   )r©   rç  r…   )r©   rç  r   )r©   ºræ  rä  Nr6   )r©   ré  r…   )r©   ré  r   rª   ).:Né   Nr8   ).r8   )rÌ   r.   rÍ   rÎ   rD   rQ   rÐ   rˆ   r-   rÃ  r+   rh  rŒ   ÚappendÚ_build_perspective_param3dr²   r   Úfill_rð   )
r   râ  r  Úprô   ÚAÚbÚXr  r¤   s
   &&        r&   Úget_perspective_transform3drò  9  s  € ôl �cœEŸL™L×*Ò*ÜÐ@ÄÀcÃÀÐLÓMÐMä�cœEŸL™L×*Ò*ÜÐ@ÄÀcÃÀÐLÓMÐMà�9‰9�R�Sˆ>˜VÔ#ÜÐDÀSÇYÁYÀKÐPÓQÐQà�9‰9˜Ÿ	™	Ô!ÜÐ@ÀÇÁÀÐLÓMÐMà�I‰I�a�L˜CŸI™I a�LÔ(ÜÐNÈsÏyÉyÈkÐYbÐcf×clÑclÐbmÐnÓoÐoà�J‰J˜#Ÿ*™*Ô$¨¯©°c·i±iÔ)?ÜØCÀCÇIÁIÀ;ÈbÐQT×QZÑQZÐP[ð \(Ø(+¯	©	 {°"°S·Y±Y°K¸rðCó
ð 	
ð × Ñ ×"Ò"Ü—[’[ ¨3¯:©:Ô6×<Ñ<ˆ
Ø—6‘6˜*Ó% s§v¡v¨jÓ'9ˆSð 	€Aó ˆØ	�‰Ô+¨C°°1°­I°s¸1¸a¸4µyÀ#ÓFÔGØ	�‰Ô+¨C°°1°­I°s¸1¸a¸4µyÀ#ÓFÔGØ	�‰Ô+¨C°°1°­I°s¸1¸a¸4µyÀ#ÓFÖGñ ô 	�Š�A�qÓ€Aô 	�Šà�	�NØ�	�NØ�	�NØ�	�NØ�	�NØ�	�NØ�	�NØ�	�NØ�	�Nð �	�NØ�	�NØ�	�Nà�	�NØ�	�NØ�	�Nð%	
ð( 	
ó+	€Aô2 (¨Ó-€Að —i‘i •l€JÜ�Š�J ¨3¯:©:¸S¿Y¹YÔG€AØ�F•)€A€h�KØ€g…J×Ñ�QÔà�6‰6�"�a˜ÓÐr(   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   rî  r    ÚqrX   rA   r"   r$   )r%   s   "r&   r'   r'   Û  s4   € ÷ F[ñ F[ ,ð F[°<ð F[Àsð F[È|ñ F[r(   c                ó¬  € \         P                  ! V 4      R,          p\         P                  ! V 4      R,          pVR8X  d~   \         P                  ! V R,          V R,          V R	,          VVVVVVVVVV R,          ) VR,          ,          V R,          ) VR,          ,          V R	,          ) VR,          ,          .^4      # VR8X  d~   \         P                  ! VVVVV R,          V R,          V R	,          VVVVVV R,          ) VR,          ,          V R,          ) VR,          ,          V R	,          ) VR,          ,          .^4      # VR8X  d~   \         P                  ! VVVVVVVVV R,          V R,          V R	,          VV R,          ) VR	,          ,          V R,          ) VR	,          ,          V R	,          ) VR	,          ,          .^4      # \	        RV R24      h)
.r4  r5  r6  zperspective params for axis `z` is not implemented.r1  )r©   r2  )r©   r.  )r©   r0  )r.   rk   rÚ  r:  r‹   )rî  rô  rX   r™  Úzeros_tensors   &&&  r&   rì  rì  Û  sÞ  € Ü—/’/ !Ó$ XÕ.€KÜ×#Ò# AÓ& xÕ0€Làˆs„{Ü�yŠyà�&•	Ø�&•	Ø�&•	ØØØØØØØØØØ�6•�
˜Q˜v�YÕ&Ø�6•�
˜Q˜v�YÕ&Ø�6•�
˜Q˜v�YÕ&ðð" ó%
ð 	
ð* ˆs„{Ü�yŠyàØØØØ�&•	Ø�&•	Ø�&•	ØØØØØØ�6•�
˜Q˜v�YÕ&Ø�6•�
˜Q˜v�YÕ&Ø�6•�
˜Q˜v�YÕ&ðð" ó%
ð 	
ð* ˆs„{Ü�yŠyàØØØØØØØØ�&•	Ø�&•	Ø�&•	ØØ�6•�
˜Q˜v�YÕ&Ø�6•�
˜Q˜v�YÕ&Ø�6•�
˜Q˜v�YÕ&ðð" ó%
ð 	
ô* Ð =¸d¸VÐCXÐYÓ
ZÐZr(   c               ó4   € V ^8„  d   QhRRRRRRRRRRR	R
RR/# )r   r   r    r¤   rv   rž   rÀ  rA   Úborder_modery   r4   r"   r$   )r%   s   "r&   r'   r'   $	  s`   € ÷ \mñ \mØ	ð\màð\mð  ð\mð ð	\mð
 ð\mð ð\mð ñ\m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  g   \        RV P                   24      h\        VP                  4      ^8X  d   VP                  RR R	8X  d
   VR,          p\        VP                  4      ^8X  d   VP                  RR R	8X  g   \        RVP                   24      hV^ ,          ^ 8  g   V^,          ^ 8  g   V^,          ^ 8  d   \        RV R24      hV^ ,          ^ 8X  g   V^,          ^ 8X  g   V^,          ^ 8X  d   \        WW#WE4      # V P                  p\        W4      '       d    V P                  4       VP                  4       r\        P                  P                  4       '       g   \        W4      w  rV'       d   \        W4      p V P                  R
R w  rxp	\!        WWxV	3W#WE4      P#                  V4      # )u:  Warp a volume by a sourceâ†’destination 4x4 homography in voxel coordinates.

``out = warp_perspective3d(src, M, dsize)`` takes volumes ``(B, C, D, H, W)`` and one ``(B, 4, 4)`` homography per
volume that maps **source** voxels ``(x, y, z)`` to **destination** voxels, and returns the ``(B, C, d, h, w)``
destination volumes for ``dsize = (d, h, w)``; ``flags`` is the interpolation mode and ``border_mode`` the padding
mode. Pass ``align_corners=True``: at the default ``False`` the sampling grid is corner-aligned while
``grid_sample`` reads half-voxel coordinates, so even an identity ``M`` resamples the volume
(`#4503 <https://github.com/kornia/kornia/issues/4503>`_). For images, use :func:`warp_perspective`; for a
``(B, 3, 4)`` affine matrix, :func:`warp_affine3d`.

Each output voxel samples the source at:

.. math::
    \text{dst}(x, y, z) = \text{src}\left( \pi\left( M^{-1} \cdot (x, y, z, 1)^{T} \right) \right)

where :math:`\pi` divides by the fourth (homogeneous) coordinate.

Convention:
    - ``M`` is the sourceâ†’destination **pixel** homography ``(B, 4, 4)``, with the batch of ``src``; an
      unbatched ``(4, 4)`` ``M`` is accepted for a single volume
    - align_corners: ``False`` by default (differs from the 2D :func:`warp_perspective`,
      whose default is ``True``)
    - border_mode: ``'zeros'`` by default
    - under ``align_corners=True``, a one-voxel source axis is sampled like a longer one, so positions outside it
      get ``border_mode``: ``'zeros'`` reads it as the first of two voxels, the second holding the padding
      (`#6433 <https://github.com/kornia/kornia/issues/6433>`_)
    - a caller's autocast region does not change the matrix arithmetic or the sampling grid, outside TorchScript
      (in the region, a ``src`` and ``M`` that mix float32 and half dtypes run in float32)
    - a zero output dimension returns an autograd-connected empty tensor;
      negative output dimensions raise ``ValueError``

Args:
    src: input image with shape ``(B, C, D, H, W)``.
    M: transformation matrix with shape ``(B, 4, 4)``.
    dsize: size of the output image (depth, height, width).
    flags: interpolation mode to calculate output values
      ``'bilinear'`` | ``'nearest'``.
    border_mode: padding mode for outside grid values
      ``'zeros'`` | ``'border'`` | ``'reflection'``.
    align_corners: interpolation flag.

Returns:
    the warped input image ``(B, C, d, h, w)``, spatial sizes given by ``dsize``.

See Also:
    - :func:`warp_perspective`: the 2D warp of images by ``(B, 3, 3)`` homographies.
    - :func:`warp_affine3d`: a ``(B, 3, 4)`` affine matrix, correct at its default ``align_corners=True``.
    - :func:`homography_warp3d`: a destinationâ†’source homography, in normalized coordinates by default.
    - :func:`get_perspective_transform3d`: the homography that maps box corners onto box corners.

rÅ   rÆ   z0Input src must be a BxCxDxHxW torch.Tensor. Got Nz*Input M must be a Bx4x4 torch.Tensor. Got rÈ   r*   rc   )rÂ  rÂ  r    )rÌ   r.   rÍ   rÎ   rD   rÏ   rQ   rÐ   r¡   r-   r>   rh   rL   rM   r
   rZ   Ú_transform_warp_impl3drŒ   )
r   r¤   rv   rÀ  rø  ry   rÑ   ÚdÚhÚws
   &&&&&&    r&   Úwarp_perspective3drþ  $	  sË  € ôv �cœ5Ÿ<™<×(Ò(ÜÐDÄTÈ#ÃYÀKÐPÓQÐQä�aœŸ™×&Ò&ÜÐBÄ4ÈÃ7À)ÐLÓMÐMäˆs�y‰y‹>˜QÔÜÐKÈCÏIÉIÈ;ÐWÓXÐXô
 ˆ1�7‰7ƒ|�qÔ˜QŸW™W R S˜\¨VÔ3Øˆd�Gˆä�—‘‹L˜AÔ !§'¡'¨"¨# ,°&Ô"8ÜÐEÀaÇgÁgÀYÐOÓPÐPàˆQ…x�!„|�u˜Q•x !”| u¨Q¥x°!¤|ÜÐAÀ%ÀÈÐJÓKÐKØˆQ…x�1„}˜˜a� Aœ¨¨q­°Q¬Ü$ S¨U¸;ÓVÐVØ—	‘	€IÜ˜×ÒØ—‘“˜aŸg™g›iˆQÜ�9‰9×!Ñ!×#Ò#Ü*¨3Ó2‰ˆçÜ! #Ó3ˆð �i‰i˜˜ˆn�G€Aˆ!Ü! #¨1°¨)°UÀ;Ó^×aÑaÐbkÓlÐlr(   c               ó<   € V ^8„  d   QhRRRRRRRRRRR	R
RR
RR
RR/	# )r   Ú	patch_srcr    rú   rv   rw   rx   rA   r@   ry   r4   r3   Únormalized_homographyr"   r$   )r%   s   "r&   r'   r'   ƒ	  sm   € ÷ Eñ EØðEàðEð ðEð ð	Eð
 ðEð ðEð !ðEð  ðEð ñEr(   c           	     ód  € V^ ,          ^ 8  g   V^,          ^ 8  d   \        RV R24      hVP                  V P                  8X  g'   \        RV P                   RVP                   R24      hV'       Ed/   \        P                  P                  4       '       g   \        W4      w  rV P                  p\        W4      '       d    V P                  4       VP                  4       rVw  ršV'       d2   \        V	V
RV P                  V P                  VR7      p\        W±4      pMgV'       d   \        W4      p \        WV
4      p\        WÀP                  R,          V P                  R	,          V4      P!                  VP                  4      p\#        WW4VR7      P!                  V4      # \%        WW#WER7      # )
u~  Warp an image by a destinationâ†’source homography in normalized ``[-1, 1]`` coordinates.

``out = homography_warp(patch_src, src_homo_dst, dsize)`` takes images ``(N, C, H, W)`` and one ``(N, 3, 3)``
homography per image that maps **destination** points to **source** points in **normalized** :math:`[-1, 1]`
coordinates, and returns the ``(N, C, h, w)`` destination images for ``dsize = (h, w)``. In normalized coordinates
an identity maps the whole source onto the whole output, so a different ``dsize`` resizes the image. For a
sourceâ†’destination homography in **pixel** coordinates, as :func:`get_perspective_transform`,
:func:`~kornia.geometry.homography.find_homography_dlt` and :class:`~kornia.geometry.ransac.RANSAC` return it, use
:func:`warp_perspective`. Passed here unchanged, such a homography is read as a normalized destinationâ†’source one,
which typically samples outside the source, so the output is mostly or entirely zeros (with the default
``padding_mode="zeros"``).

``normalized_coordinates=False`` reads the same destinationâ†’source homography in pixels, and
``normalized_homography=False`` instead hands a pixel sourceâ†’destination homography to :func:`warp_perspective`
with this function's ``align_corners=False`` default, which for a pixel homography samples the same positions as
``align_corners=True`` (see ``align_corners`` below), up to which pixel ``mode="nearest"`` takes for a sample
exactly halfway between two pixels.

Convention:
    See :doc:`Conventions & Pitfalls </get-started/conventions>` for homography direction, normalized
    coordinates and ``align_corners`` sampling rules.

    - ``src_homo_dst`` is the destinationâ†’source homography ``(N, 3, 3)`` when
      ``normalized_homography=True`` (default), in normalized :math:`[-1, 1]` coordinates by default
      (``normalized_coordinates=True``). With ``normalized_coordinates=False`` it is in **pixel**
      coordinates, pixel centres at integers: it maps the pixel ``(x, y)`` of the ``dsize`` output to the
      source pixel it samples, so an identity returns the top-left ``dsize`` window of the input
    - with ``normalized_homography=False`` it is consumed as the sourceâ†’destination **pixel** homography,
      exactly like :func:`warp_perspective`, and ``normalized_coordinates`` is ignored
    - ``src_homo_dst`` has the batch of ``patch_src``: a ``(1, 3, 3)`` homography is not shared by a larger
      batch
    - a ``float16``/``bfloat16`` patch with a homography of its dtype builds its grid and samples in ``float32`` on
      every device and returns the input dtype
    - with ``normalized_coordinates=False`` the pixel grid is warped and normalized in at least float32, also
      under a half default dtype and in a caller's autocast region, and then cast to the homography's dtype
    - with ``normalized_coordinates=True`` a caller's autocast region does not change the sampling grid, outside
      TorchScript
      (in the region, a patch and homography that mix float32 and half dtypes run in float32)
    - align_corners: ``False`` by default (differs from :func:`warp_perspective`). A pixel homography samples the
      same positions under both settings, which then differ only in ``padding_mode="reflection"`` and, with
      ``mode="nearest"``, in which pixel a sample exactly halfway between two pixels takes. A normalized homography
      reads the whole :math:`[-1, 1]` range of a one-pixel source axis as that pixel under ``align_corners=True``
    - negative output dimensions raise ``ValueError``

Args:
    patch_src: The image or torch.Tensor to warp. Should be from source of shape ``(N, C, H, W)``.
    src_homo_dst: The homography or torch.stack of homographies of shape ``(N, 3, 3)`` â€”
        destination to source when ``normalized_homography=True`` (default), source to
        destination (pixel) when ``normalized_homography=False``.
    dsize: output size ``(h, w)``.
    mode: interpolation mode to calculate output values ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values ``'zeros'`` | ``'border'`` | ``'reflection'``.
    align_corners: interpolation flag.
    normalized_coordinates: whether ``src_homo_dst`` is in normalized :math:`[-1, 1]` coordinates
        (``True``) or in pixel coordinates (``False``). Ignored when ``normalized_homography=False``.
    normalized_homography: whether ``src_homo_dst`` is a destinationâ†’source homography in the coordinates
        ``normalized_coordinates`` selects (``True``, default) or a pixel sourceâ†’destination homography
        (``False``).

Return:
    the warped images ``(N, C, h, w)``, sampled at the source locations of the destination pixels.

See Also:
    - :func:`warp_perspective`: takes the sourceâ†’destination homography in pixel coordinates.
    - :class:`HomographyWarper`: the module form, which can precompute the sampling grid for repeated warps.
    - :func:`homography_warp3d`: the same warp for ``(N, C, D, H, W)`` volumes by ``(N, 4, 4)`` homographies.
    - :func:`warp_grid`: the warped sampling grid alone, without sampling the image.
    - :func:`~kornia.geometry.conversions.normalize_homography`: convert a pixel sourceâ†’destination homography to
      normalized coordinates, with this function's ``align_corners`` (it defaults to ``True`` there); invert the
      result for this function.

Example:
    >>> input = torch.rand(1, 3, 32, 32)
    >>> homography = torch.eye(3).view(1, 3, 3)
    >>> output = homography_warp(input, homography, (32, 32))

Example:
    >>> img = torch.rand(1, 4, 5, 6)
    >>> H = torch.eye(3)[None]
    >>> out = homography_warp(img, H, (4, 2), align_corners=True, normalized_homography=False)
    >>> print(out.shape)
    torch.Size([1, 4, 4, 2])

rÈ   r*   úCPatch and homography must be on the same device. Got patch.device: ú src_H_dst.device: Tr§   rz  rc   r8   )rÐ   rˆ   rÎ   r.   rL   rM   r
   r-   r>   rh   r   r  rZ   r  r%  rQ   rŒ   r   rÒ   )r   rú   rv   rx   r@   ry   r3   r  rÑ   r  r  r—   Úwarped_grids   &&&&&&&&     r&   Úhomography_warpr  ƒ	  sŽ  € ð| ˆQ…x�!„|�u˜Q•x !”|ÜÐAÀ%ÀÈÐJÓKÐKØ×Ñ )×"2Ñ"2Ô2ÜØQÐR[×RbÑRbÐQcð d!Ø!-×!4Ñ!4Ð 5°Qð8ó
ð 	
÷ ÐÜ�y‰y×%Ñ%×'Ò'Ü&?À	Ó&XÑ#ˆIØ—O‘Oˆ	Ü˜I×4Ò4Ø&/§o¡oÓ&7¸×9KÑ9KÓ9M�|Ø‰ˆß!Ü"ØØØ'+Ø ×'Ñ'Ø—o‘oØ+ôˆDô $ DÓ7‰K÷ Ü/°	ÓH�	Ü*¨<ÀÓGˆKÜ6ØŸ_™_¨RÕ0°)·/±/À"Õ2EÀ}óç‰b�×#Ñ#Ó$ð ô "Ø¨ÐXeô
ç
‰"ˆY‹-ð	ô Ø Àôð r(   c               ó8   € V ^8„  d   QhRRRRRRRRRRR	RR
RRR/# )r   r   r    Údst_pix_trans_src_pixÚ	dsize_srcrž   Ú	dsize_dstÚ	grid_moderA   r@   ry   r4   r"   r$   )r%   s   "r&   r'   r'   
  sb   € ÷ tñ tØ	ðtà'ðtð $ðtð $ð	tð
 ðtð ðtð ðtð ñtr(   c           	     ó4  € \         P                  P                  4       '       d   \        WV4      pM<\	        V P
                  P                  4      ;_uu_ 4        \        WV4      pRRR4       \        X4      p\        WW4WVR4      #   + '       g   i     L); i)zHCompute the transform in normalized coordinates and perform the warping.NT)	r.   rL   rM   r   r   rˆ   rD   r   Úhomography_warp3d)	r   r  r	  r
  r  r@   ry   r¹   rº   s	   &&&&&&&  r&   rú  rú  
  sw   € ô ‡y�y×Ñ×ÒÜ0FÐG\ÐirÓ0sÑä §
¡
§¡×0Õ0Ü&<Ð=RÐ_hÓ&iÐ#÷ 1ô 2Ð2IÓJÐÜ˜S¸9ÐQ]ÐnrÓsÐs÷	 1×0ús   ÁBÂB	c               ó8   € V ^8„  d   QhRRRRRRRRRRR	R
RR
RR/# )r   r   r    rú   rv   rž   rx   rA   r@   ry   r4   r3   r"   r$   )r%   s   "r&   r'   r'    
  sb   € ÷ sñ sØðsàðsð  ðsð ð	sð
 ðsð ðsð !ðsð ñsr(   c                ó  € V^ ,          ^ 8  g   V^,          ^ 8  g   V^,          ^ 8  d   \        RV R24      hVP                  V P                  8X  g'   \        RV P                   RVP                   R24      hV P                  p\	        W4      '       d    V P                  4       VP                  4       r\        P                  P                  4       '       g   \        W4      w  rVw  r‰p
V'       d€   \        VV	V
RV P                  \        P                  ! V P                  VP                  4      R7      p\        P                  ! VR,          VR	,          VR
,          3R4      p\        W±4      pMyV'       d   \        W4      p \        WWš4      p\!        WÀP"                  R,          V P"                  R,          V P"                  R,          V4      P%                  VP                  4      p\'        WW4VR7      P%                  V4      # )u2  Warp a volume by a destinationâ†’source 3D homography in normalized coordinates.

``out = homography_warp3d(patch_src, src_homo_dst, dsize)`` takes volumes ``(N, C, D, H, W)`` and one
``(N, 4, 4)`` homography per volume that maps **destination** points ``(x, y, z)`` to **source** points in
**normalized** :math:`[-1, 1]` coordinates, and returns the ``(N, C, d, h, w)`` destination volumes for
``dsize = (d, h, w)``. In normalized coordinates, pass ``align_corners=True``: the normalized grid is always
corner-aligned, so at the default ``False`` even an identity resamples the volume
(`#4503 <https://github.com/kornia/kornia/issues/4503>`_). For a sourceâ†’destination homography in voxel
coordinates, use :func:`warp_perspective3d` with ``align_corners=True``, which at its default ``False`` resamples
even an identity for the same reason, or pass the inverse of that homography here with
``normalized_coordinates=False``. This function has no ``normalized_homography`` switch.

Convention:
    - input: ``(N, C, D, H, W)``; ``dsize`` is the output size ``(d, h, w)``
    - ``src_homo_dst`` is the destinationâ†’source homography ``(N, 4, 4)``, in normalized
      :math:`[-1, 1]` coordinates by default (``normalized_coordinates=True``), and acts on
      ``(x, y, z, 1)`` column vectors: ``x`` indexes ``W``, ``y`` indexes ``H``, ``z`` indexes
      ``D``. That is the order :func:`torch.nn.functional.grid_sample` reads a 5-D grid in, and
      the order :func:`warp_grid3d` takes. kornia's own 3-D grids and pixel coordinates are
      ``(d, x, y)`` (see :func:`~kornia.geometry.grid.create_meshgrid3d`), so the sampling grid
      is reordered here before the homography is applied; nothing else in the module changes
      its order
    - with ``normalized_coordinates=False`` ``src_homo_dst`` is in **voxel** coordinates, voxel
      centres at integers, in the same ``(x, y, z)`` order: it maps the voxel ``(x, y, z)`` of the
      ``dsize`` output to the source voxel it samples, so an identity returns the ``dsize`` window
      of the input that starts at voxel ``(0, 0, 0)``. The warped voxel grid is normalized with the
      source size under ``align_corners`` before ``grid_sample``
    - with ``normalized_coordinates=False`` the voxel grid is warped and normalized in at least
      float32, also under a half default dtype and in a caller's autocast region, and then cast to
      the homography's dtype
    - with ``normalized_coordinates=True`` a caller's autocast region does not change the sampling grid, outside
      TorchScript
      (in the region, a patch and homography that mix float32 and half dtypes run in float32)
    - align_corners: ``False`` by default. With ``normalized_coordinates=False``, a voxel homography samples
      the same positions under both settings, which then differ only in ``padding_mode="reflection"`` and,
      with ``mode="nearest"``, in which voxel a sample exactly halfway between two voxels takes
    - padding_mode: ``'zeros'`` by default
    - negative output dimensions raise ``ValueError``

Args:
    patch_src: The image or torch.Tensor to warp. Should be from source of shape ``(N, C, D, H, W)``.
    src_homo_dst: The homography or torch.stack of homographies from destination to source of shape
      ``(N, 4, 4)``.
    dsize: output size ``(d, h, w)``.
    mode: interpolation mode to calculate output values ``'bilinear'`` | ``'nearest'``.
    padding_mode: padding mode for outside grid values ``'zeros'`` | ``'border'`` | ``'reflection'``.
    align_corners: interpolation flag.
    normalized_coordinates: whether ``src_homo_dst`` is in normalized :math:`[-1, 1]` coordinates
      (``True``) or in voxel coordinates (``False``).

Return:
    the warped volumes ``(N, C, d, h, w)``, sampled at the source locations of the destination voxels.

See Also:
    - :func:`homography_warp`: the 2D warp of images, which also has a ``normalized_homography`` switch.
    - :func:`warp_perspective3d`: takes the sourceâ†’destination homography in voxel coordinates.
    - :func:`warp_grid3d`: the warped sampling grid alone, in ``(x, y, z)`` order.
    - :func:`~kornia.geometry.grid.create_meshgrid3d`: kornia's ``(d, x, y)`` grid, which this function reorders.

Example:
    >>> input = torch.rand(1, 3, 8, 32, 32)
    >>> homography = torch.eye(4).view(1, 4, 4)
    >>> output = homography_warp3d(input, homography, (8, 32, 32))

rÈ   r*   r  r  Tr  rz  r«   r  rª   r8   r    rc   )rÐ   rˆ   rÎ   r-   r>   rh   r.   rL   rM   r
   r   r/   r²   r*  rZ   r7  r;  rQ   rŒ   r   )r   rú   rv   rx   r@   ry   r3   rÑ   r)  r  r  r—   r  s   &&&&&&&      r&   r  r   
  sÂ  € ðT ˆQ…x�!„|�u˜Q•x !”| u¨Q¥x°!¤|ÜÐAÀ%ÀÈÐJÓKÐKØ×Ñ )×"2Ñ"2Ô2ÜØQÐR[×RbÑRbÐQcð d!Ø!-×!4Ñ!4Ð 5°Qð8ó
ð 	
ð
 —‘€IÜ˜	×0Ò0Ø"+§/¡/Ó"3°\×5GÑ5GÓ5I�<Ü�9‰9×!Ñ!×#Ò#Ü";¸IÓ"TÑˆ	Ø Ñ€E�5ßÜ ØØØØ#'Ø×#Ñ#Ü×%Ò% i§o¡o°|×7IÑ7IÓJô
ˆô �{Š{˜D �L¨$¨v­,¸¸V½ÐEÀrÓJˆÜ! $Ó5‰÷ Ü+¨IÓDˆIÜ(¨¸fÓLˆÜ4ØŸ™¨Õ,¨i¯o©o¸bÕ.AÀ9Ç?Á?ÐSUÕCVÐXeó
ç
‰"ˆ\×ÑÓ
 ð 	ô Ø TÐTaôç�bˆƒmðr(   )r�  r§  ri  rò  r¥  rs  rŒ  r¦  r’  r  r  r�  rÎ  r{  rê   rÉ  r  r*  rÒ   rþ  )NÚnoneTr!   )ÚbilinearrJ   TNr†  )r  rJ   NF)NN)NNNNNN)r  rJ   T)r  rJ   F)r  rJ   FTT)r  rJ   FT)UÚ__doc__Ú
__future__r   Útypingr   r.   Útorch.nn.functionalÚnnÚ
functionalrU   Úkornia.core.checkr   r   Úkornia.core.opsr   Úkornia.core.utilsr   r   r	   r
   r   r   r   r   r   Úkornia.geometry.conversionsr   r   r   r   r   r   r   r   r   r   Úkornia.geometry.gridr   r   Úkornia.geometry.linalgr   Ú__all__r0   r:   r>   rZ   rt   rœ   r¡   rÁ   rÒ   rã   rê   r�   r  r  r  r  r  r%  r*  r7  r;  rY  rd  ri  rs  r{  r�  r�  r’  rŒ  r§  r¦  rª  rÉ  rÎ  rÒ  r¥  rò  rì  rþ  r  rú  r  r$   r(   r&   Ú<module>r     sd  ðñ$õ> #å ã ß Ð ç >Ý $÷
÷ 
õ 
÷÷ ÷ ÷ DÝ 3ò€õ0;õ0õFõ"&õR>÷,W\õtsõ6')÷TAõH,)÷^J÷Z@xõF
Cõ
CõC3õL	õ3õ(	!õA:õH3õ.$õ:,3õ^(õV\Nõ@r÷jkõ\.#÷b?õD 9÷FB9÷JN÷be;õP7÷$dõN'õD8õ*W õt_õDF[÷R\m÷~EõPt÷*sñ sr(   