
    %`i                    V    d dl mZ d dlmZ d dlZd dlZddlmZ  G d de          Z	dS )    )annotations)AnyN   )TVTensorc                  2    e Zd ZdZddddddZddddZdS )Imagea  :class:`torch.Tensor` subclass for images with shape ``[..., C, H, W]``.

    .. note::

        In the :ref:`transforms <transforms>`, ``Image`` instances are largely
        interchangeable with pure :class:`torch.Tensor`. See
        :ref:`this note <passthrough_heuristic>` for more details.

    Args:
        data (tensor-like, PIL.Image.Image): Any data that can be turned into a tensor with :func:`torch.as_tensor` as
            well as PIL images.
        dtype (torch.dtype, optional): Desired data type. If omitted, will be inferred from
            ``data``.
        device (torch.device, optional): Desired device. If omitted and ``data`` is a
            :class:`torch.Tensor`, the device is taken from it. Otherwise, the image is constructed on the CPU.
        requires_grad (bool, optional): Whether autograd should record operations. If omitted and
            ``data`` is a :class:`torch.Tensor`, the value is taken from it. Otherwise, defaults to ``False``.
    Ndtypedevicerequires_graddatar   r
   torch.dtype | Noner   torch.device | str | int | Noner   bool | Nonereturnc               X   t          |t          j        j                  rddlm} |                    |          }|                     ||||          }|j        dk     rt          d|j         d          |j        dk    r|	                    d          }|
                    |           S )Nr   )
functionalr	      z!Tensor must be 2D or higher, got z	D tensor.)
isinstancePILr   torchvision.transforms.v2r   pil_to_tensor
_to_tensorndim
ValueError	unsqueezeas_subclass)clsr   r
   r   r   Ftensors          q/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/torchvision/tv_tensors/_image.py__new__zImage.__new__   s     dCIO,, 	)AAAAAA??4((DE&P]^^;??WWWWXXX[A%%a((F!!#&&&    )tensor_contentsr$   strc               *    |                                  S )N)
_make_repr)selfr$   s     r!   __repr__zImage.__repr__4   s       r#   )
r   r   r
   r   r   r   r   r   r   r   )r$   r   r   r%   )__name__
__module____qualname____doc__r"   r)    r#   r!   r   r      sj         . %)26%)' ' ' ' ' '* 26 ! ! ! ! ! ! ! !r#   r   )

__future__r   typingr   	PIL.Imager   torch
_tv_tensorr   r   r.   r#   r!   <module>r4      s    " " " " " "                       *! *! *! *! *!H *! *! *! *! *!r#   