ó
    Eñiè  ã                  óZ   • S SK Jr  S SKJrJrJr  S SKrS SKJr  SSK	J
r
   " S S\
5      rg)	é    )Úannotations)ÚAnyÚMappingÚSequenceN)Útree_flattené   )ÚTVTensorc                  ó¨   • \ rS rSr% SrS\S'   \SS.SS jj5       rSSSS	.           SS
 jjr\  S       SS jj5       r	SS.SS jjr
Srg)Ú	KeyPointsé   u�  :class:`torch.Tensor` subclass for tensors with shape ``[..., 2]`` that represent points in an image.

.. note::
    Support for keypoints was released in TorchVision 0.23 and is currently
    a BETA feature. We don't expect the API to change, but there may be some
    rare edge-cases. If you find any issues, please report them on our bug
    tracker: https://github.com/pytorch/vision/issues?q=is:open+is:issue
    Each point is represented by its X and Y coordinates along the width and
    height dimensions, respectively.

Each point is represented by its X and Y coordinates along the width and height dimensions, respectively.

KeyPoints may represent any object that can be represented by sequences of 2D points:

- `Polygonal chains <https://en.wikipedia.org/wiki/Polygonal_chain>`_,
  including polylines, BÃ©zier curves, etc., which can be of shape
  ``[N_chains, N_points, 2]``.
- Polygons, which can be of shape ``[N_polygons, N_points, 2]``.
- Skeletons, which can be of shape ``[N_skeletons, N_bones, 2, 2]`` for
  pose-estimation models.

.. note::
    Like for :class:`torchvision.tv_tensors.BoundingBoxes`, there should
    only be a single instance of the
    :class:`torchvision.tv_tensors.KeyPoints` class per sample e.g.
    ``{"img": img, "poins_of_interest": KeyPoints(...)}``, although one
    :class:`torchvision.tv_tensors.KeyPoints` object can contain multiple
    key points

Args:
    data: Any data that can be turned into a tensor with
        :func:`torch.as_tensor`.
    canvas_size (two-tuple of ints): Height and width of the corresponding
        image or video.
    dtype (torch.dtype, optional): Desired data type of the bounding box. If
        omitted, will be inferred from ``data``.
    device (torch.device, optional): Desired device of the bounding box. If
        omitted and ``data`` is a :class:`torch.Tensor`, the device is taken
        from it. Otherwise, the bounding box is constructed on the CPU.
    requires_grad (bool, optional): Whether autograd should record
        operations on the bounding box. If omitted and ``data`` is a
        :class:`torch.Tensor`, the value is taken from it. Otherwise,
        defaults to ``False``.
útuple[int, int]Úcanvas_sizeT)Ú
check_dimsc               óÜ   • U(       aM  UR                   S:X  a  UR                  S5      nO+UR                  S   S:w  a  [        SUR                   35      eUR	                  U 5      nX$l        U$ )Nr   r   éÿÿÿÿé   z)Expected a tensor of shape (..., 2), not )ÚndimÚ	unsqueezeÚshapeÚ
ValueErrorÚas_subclassr   )ÚclsÚtensorr   r   Úpointss        Ú^/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torchvision/tv_tensors/_keypoints.pyÚ_wrapÚKeyPoints._wrap;   sd   € æØ�{‰{˜aÓØ×)Ñ)¨!Ó,‘Ø—‘˜bÑ! QÓ&Ü Ð#LÈVÏ\É\ÈNÐ![Ó\Ð\Ø×#Ñ# CÓ(ˆØ(ÔØˆó    N©ÚdtypeÚdeviceÚrequires_gradc               ó@   • U R                  XXES9nU R                  XbS9$ )Nr   ©r   )Ú
_to_tensorr   )r   Údatar   r    r!   r"   r   s          r   Ú__new__ÚKeyPoints.__new__F   s'   € ð —‘ ¸&�Ð^ˆØ�y‰y˜ˆyÐ9Ð9r   © c                ó¤  ^• [        X#(       a  [        UR                  5       5      OS-   5      u  pE[        S U 5       5      nUR                  m[        U[        R                  5      (       a,  [        U[        5      (       d  [        R                  UTSS9nU$ [        U[        [        45      (       a  [        U5      " U4S jU 5       5      nU$ )Nr)   c              3  óT   #   • U  H  n[        U[        5      (       d  M  Uv •  M      g 7f)N)Ú
isinstancer   )Ú.0Úxs     r   Ú	<genexpr>Ú)KeyPoints._wrap_output.<locals>.<genexpr>[   s   é € Ð(\²K¨qÄ:ÈaÔQZ×C[¯©²Kùs   ‚(Ÿ	(F©r   r   c              3  óN   >#   • U  H  n[         R                  UTS S9v •  M     g7f)Fr1   N)r   r   )r-   Úpartr   s     €r   r/   r0   b   s$   øé € Ð!vÒouÐgk¤)§/¡/°$ÀKÐ\a /Õ"bÒouùs   ƒ"%)r   ÚtupleÚvaluesÚnextr   r,   ÚtorchÚTensorr   r   ÚlistÚtype)r   ÚoutputÚargsÚkwargsÚflat_paramsÚ_Úfirst_keypoints_from_argsr   s          @r   Ú_wrap_outputÚKeyPoints._wrap_outputR   s¨   ø€ ô & dÍ¬e°F·M±M³OÔ.DÐTVÑ&WÓX‰ˆÜ$(Ñ(\±KÓ(\Ó$\Ð!Ø/×;Ñ;ˆä�fœeŸl™l×+Ñ+´J¸vÄy×4QÑ4QÜ—_‘_ V¸ÐQV�_ÐWˆFð ˆô ˜¤¬ ×.Ñ.ä˜&”\Ô!vÑouÓ!vÓvˆFØˆr   )Útensor_contentsc               ó4   • U R                  U R                  S9$ )Nr$   )Ú
_make_reprr   )ÚselfrC   s     r   Ú__repr__ÚKeyPoints.__repr__e   s   € Ø�‰¨4×+;Ñ+;ˆÐ<Ð<r   )r   útorch.Tensorr   r   r   ÚboolÚreturnr   )r&   r   r   r   r    ztorch.dtype | Noner!   ztorch.device | str | int | Noner"   zbool | NonerK   r   )r)   N)r;   rI   r<   zSequence[Any]r=   zMapping[str, Any] | NonerK   r   )rC   r   rK   Ústr)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__Úclassmethodr   r'   rA   rG   Ú__static_attributes__r)   r   r   r   r      sÀ   ‡ ñ+ðZ !Ó àØ]aö ó ðð %)Ø26Ø%)ñ
:àð
:ð %ð	
:ð
 "ð
:ð 0ð
:ð #ð
:ð 
õ
:ð ð !Ø+/ð	àðð ðð )ð	ð
 
ôó ðð$ 26÷ =ò =r   r   )Ú
__future__r   Útypingr   r   r   r7   Útorch.utils._pytreer   Ú
_tv_tensorr	   r   r)   r   r   Ú<module>rY      s%   ðÝ "ç )Ñ )ã Ý ,å  ô[=�õ [=r   