o
    Vh{                     @   sT   d dl mZmZmZ d dlmZ d dlmZm	Z	 G dd de	Z
G dd de	ZdS )	    )AnyDictUnion)
tv_tensors)
functional	Transformc                       s^   e Zd ZdZejfZdeeej	f ddf fddZ
dejdeeef dejfd	d
Z  ZS )ConvertBoundingBoxFormata_  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                    s   t    || _d S N)super__init__r	   )selfr	   	__class__ S/var/www/vscode/kcb/lib/python3.10/site-packages/torchvision/transforms/v2/_meta.pyr      s   

z!ConvertBoundingBoxFormat.__init__inptparamsc                 C   s   t j|| jdS )N)
new_format)Fconvert_bounding_box_formatr	   r   r   r   r   r   r   	transform   s   z"ConvertBoundingBoxFormat.transform)__name__
__module____qualname____doc__r   BoundingBoxes_transformed_typesr   strBoundingBoxFormatr   r   r   r   __classcell__r   r   r   r   r      s
     *r   c                   @   s:   e Zd ZdZejfZdejdeee	f dejfddZ
dS )ClampBoundingBoxeszClamp bounding boxes to their corresponding image dimensions.

    The clamping is done according to the bounding boxes' ``canvas_size`` meta-data.

    r   r   r
   c                 C   s
   t |S r   )r   clamp_bounding_boxesr   r   r   r   r   #   s   
zClampBoundingBoxes.transformN)r   r   r   r   r   r   r   r   r    r   r   r   r   r   r   r#      s    &r#   N)typingr   r   r   torchvisionr   torchvision.transforms.v2r   r   r   r   r#   r   r   r   r   <module>   s
    