
    \h                    N    S SK Jr  S SKJr  S SKrS SKrSSKJr   " S S\5      r	g)    )annotations)AnyN   )TVTensorc                  R    \ rS rSrSrSSSS.         S	S jjrSS.S
S jjrSrg)Image   a  :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_gradc               X   [        U[        R                  R                  5      (       a  SSKJn  UR                  U5      nU R                  XX4S9nUR                  S:  a  [        SUR                   S35      eUR                  S:X  a  UR                  S5      nUR                  U 5      $ )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)clsdatar   r   r   Ftensors          W/var/www/fran/franai/venv/lib/python3.13/site-packages/torchvision/tv_tensors/_image.py__new__Image.__new__   s     dCIIOO,,A??4(D&^;;?@YWXX[[A%%a(F!!#&&    )tensor_contentsc               "    U R                  5       $ )N)
_make_repr)selfr"   s     r   __repr__Image.__repr__4   s      r!    )
r   r   r   ztorch.dtype | Noner   ztorch.device | str | int | Noner   zbool | Nonereturnr   )r"   r   r)   str)__name__
__module____qualname____firstlineno____doc__r   r&   __static_attributes__r(   r!   r   r   r      sV    . %)26%)'' "	'
 0' #' 
'* 26 ! !r!   r   )

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