U
    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                       sX   e Zd ZdZejfZeeej	f dd fddZ
ejeeef ejd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.
    N)formatreturnc                    s   t    || _d S N)super__init__r	   )selfr	   	__class__ Q/var/www/html/venv/lib/python3.8/site-packages/torchvision/transforms/v2/_meta.pyr      s    
z!ConvertBoundingBoxFormat.__init__inptparamsr
   c                 C   s   t j|| jdS )N)Z
new_format)FZconvert_bounding_box_formatr	   r   r   r   r   r   r   
_transform   s    z#ConvertBoundingBoxFormat._transform)__name__
__module____qualname____doc__r   BoundingBoxes_transformed_typesr   strZBoundingBoxFormatr   r   r   r   __classcell__r   r   r   r   r      s   r   c                   @   s6   e Zd ZdZejfZejeee	f ejd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   c                 C   s
   t |S r   )r   Z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   Ztorchvisionr   Ztorchvision.transforms.v2r   r   r   r   r!   r   r   r   r   <module>   s   