
    \h]                         S SK JrJr  S SKJr  S SKJrJr  S SK	J
r
   " S S\5      r " S S\5      r " S	 S
\5      r " S S\5      rg)    )AnyUnion)
tv_tensors)
functional	Transform)CLAMPING_MODE_TYPEc                      ^  \ rS rSrSr\R                  4rS\\	\R                  4   SS4U 4S jjrS\R                  S\\	\4   S\R                  4S	 jrS
rU =r$ )ConvertBoundingBoxFormat   aK  Convert bounding box coordinates to the given ``format``, eg from "CXCYWH" to "XYXY".

Args:
    format (str or tv_tensors.BoundingBoxFormat): output bounding box format.
        Possible values are defined by :class:`~torchvision.tv_tensors.BoundingBoxFormat` and
        string values match the enums, e.g. "XYXY" or "XYWH" etc.
formatreturnNc                 .   > [         TU ]  5         Xl        g N)super__init__r   )selfr   	__class__s     Y/var/www/fran/franai/venv/lib/python3.13/site-packages/torchvision/transforms/v2/_meta.pyr   !ConvertBoundingBoxFormat.__init__   s        inptparamsc                 >    [         R                  " XR                  S9$ )N)
new_format)Fconvert_bounding_box_formatr   r   r   r   s      r   	transform"ConvertBoundingBoxFormat.transform   s    ,,TkkJJr   )r   )__name__
__module____qualname____firstlineno____doc__r   BoundingBoxes_transformed_typesr   strBoundingBoxFormatr   dictr   r   __static_attributes____classcell__r   s   @r   r
   r
      su     %224uS**F*F%FG D Kj66 KS#X KS]SkSk K Kr   r
   c                      ^  \ rS rSrSrSS\\\4   SS4U 4S jjjr\	R                  4rS\	R                  S\\\4   S\	R                  4S	 jrS
rU =r$ )ClampBoundingBoxes   a  Clamp bounding boxes to their corresponding image dimensions.

Args:
    clamping_mode: Default is "auto" which relies on the input box'
        ``clamping_mode`` attribute. Read more in :ref:`clamping_mode_tuto`
        for more details on how to use this transform.
clamping_moder   Nc                 .   > [         TU ]  5         Xl        g r   )r   r   r0   r   r0   r   s     r   r   ClampBoundingBoxes.__init__$   s    *r   r   r   c                 >    [         R                  " XR                  S9$ )Nr0   )r   clamp_bounding_boxesr0   r   s      r   r   ClampBoundingBoxes.transform*   s    %%d:L:LMMr   r5   )auto)r    r!   r"   r#   r$   r   r   r'   r   r   r%   r&   r)   r   r   r*   r+   r,   s   @r   r.   r.      sv    +e,>,C&D +RV + + %224Nj66 NS#X NS]SkSk N Nr   r.   c                   z    \ rS rSrSr\R                  4rS\R                  S\\	\
4   S\R                  4S jrSrg)	ClampKeyPoints.   zClamp keypoints to their corresponding image dimensions.

The clamping is done according to the keypoints' ``canvas_size`` meta-data.
r   r   r   c                 .    [         R                  " U5      $ r   )r   clamp_keypointsr   s      r   r   ClampKeyPoints.transform6   s      &&r    N)r    r!   r"   r#   r$   r   	KeyPointsr&   r)   r'   r   r   r*   r?   r   r   r:   r:   .   sF    
 %..0'j22 'DcN 'zOcOc 'r   r:   c                      ^  \ rS rSrSrS\SS4U 4S jjr\R                  4r	S\R                  S\
\\4   S\R                  4S	 jrS
rU =r$ )SetClampingMode:   a   Sets the ``clamping_mode`` attribute of the bounding boxes for future transforms.



Args:
    clamping_mode: The clamping mode to set. Possible values are: "soft",
        "hard", or ``None``. Read more in :ref:`clamping_mode_tuto` for more
        details on how to use this transform.
r0   r   Nc                 j   > [         TU ]  5         Xl        U R                  S;  a  [        SU 35      eg )N)Nsofthardz.clamping_mode must be soft, hard or None, got )r   r   r0   
ValueErrorr2   s     r   r   SetClampingMode.__init__E   s;    *%;;Mm_]^^ <r   r   r   c                 H    UR                  5       nU R                  Ul        U$ r   )cloner0   )r   r   r   outs       r   r   SetClampingMode.transformN   s     (,

 ..
r   r5   )r    r!   r"   r#   r$   r   r   r   r%   r&   r)   r'   r   r   r*   r+   r,   s   @r   rB   rB   :   sd    _&8 _T _ %224j66 S#X S]SkSk  r   rB   N)typingr   r   torchvisionr   torchvision.transforms.v2r   r   r   &torchvision.tv_tensors._bounding_boxesr   r
   r.   r:   rB   r?   r   r   <module>rQ      sE     " @ EKy K&N N&	'Y 	'i r   