ó
    EñiD  ã                   ój   • S SK r S SKrS SKJrJr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g)	é    N)ÚAnyÚCallableÚOptionalÚUnioné   )Údefault_loader)Údownload_and_extract_archiveÚverify_str_arg)ÚVisionDatasetc                   ó  ^ • \ rS rSrSrSrSrSSSSS\4S	\\	\
R                  4   S
\	S\S\\   S\\   S\S\\\	\
R                  4   /\4   SS4U 4S jjjrS\4S jrS\S\\\4   4S jrS\	4S jrS\4S jrSS jrSrU =r$ )ÚDTDé   a9  `Describable Textures Dataset (DTD) <https://www.robots.ox.ac.uk/~vgg/data/dtd/>`_.

Args:
    root (str or ``pathlib.Path``): Root directory of the dataset.
    split (string, optional): The dataset split, supports ``"train"`` (default), ``"val"``, or ``"test"``.
    partition (int, optional): The dataset partition. Should be ``1 <= partition <= 10``. Defaults to ``1``.

        .. note::

            The partition only changes which split each image belongs to. Thus, regardless of the selected
            partition, combining all splits will result in all images.

    transform (callable, optional): A function/transform that takes in a PIL image or torch.Tensor, depends on the given loader,
        and returns a transformed version. E.g, ``transforms.RandomCrop``
    target_transform (callable, optional): A function/transform that takes in the target and transforms it.
    download (bool, optional): If True, downloads the dataset from the internet and
        puts it in root directory. If dataset is already downloaded, it is not
        downloaded again. Default is False.
    loader (callable, optional): A function to load an image given its path.
        By default, it uses PIL as its image loader, but users could also pass in
        ``torchvision.io.decode_image`` for decoding image data into tensors directly.
zDhttps://www.robots.ox.ac.uk/~vgg/data/dtd/download/dtd-r1.0.1.tar.gzÚ fff73e5086ae6bdbea199a49dfb8a4c1Útrainr   NFÚrootÚsplitÚ	partitionÚ	transformÚtarget_transformÚdownloadÚloaderÚreturnc           
      óÆ  >• [        USS5      U l        [        U[        5      (       d  SUs=::  a  S::  d  O  [	        SU S35      eX0l        [        TU ]  XUS9  [        R                  " U R                  5      [        U 5      R                  R                  5       -  U l        U R                  S-  U l        U R                  S	-  U l        U R                  S
-  U l        U(       a  U R%                  5         U R'                  5       (       d  [)        S5      e/ U l        / n[-        U R                   U R                   U R
                   S3-  5       n	U	 Hi  n
U
R/                  5       R1                  S5      u  p¼U R*                  R3                  U R"                  R5                  X¼5      5        UR3                  U5        Mk     S S S 5        [7        [9        U5      5      U l        [=        [?        U R:                  [A        [C        U R:                  5      5      5      5      U l"        U Vs/ s H  o°RD                  U   PM     snU l#        Xpl$        g ! , (       d  f       N’= fs  snf )Nr   )r   ÚvalÚtestr   é
   zPParameter 'partition' should be an integer with `1 <= partition <= 10`, but got z instead)r   r   ÚdtdÚlabelsÚimagesz;Dataset not found. You can use download=True to download itz.txtÚ/)%r
   Ú_splitÚ
isinstanceÚintÚ
ValueErrorÚ
_partitionÚsuperÚ__init__ÚpathlibÚPathr   ÚtypeÚ__name__ÚlowerÚ_base_folderÚ_data_folderÚ_meta_folderÚ_images_folderÚ	_downloadÚ_check_existsÚRuntimeErrorÚ_image_filesÚopenÚstripr   ÚappendÚjoinpathÚsortedÚsetÚclassesÚdictÚzipÚrangeÚlenÚclass_to_idxÚ_labelsr   )Úselfr   r   r   r   r   r   r   r;   ÚfileÚlineÚclsÚnameÚ	__class__s                €ÚU/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torchvision/datasets/dtd.pyr'   ÚDTD.__init__&   sð  ø€ ô % U¨GÐ5MÓNˆŒÜ˜)¤S×)Ñ)°1¸	Õ3GÀRÕ3GÜðØ$˜+ Xð/óð ð $Œä‰Ñ˜ÐEUÐÑVÜ#ŸLšL¨¯©Ó3´d¸4³j×6IÑ6I×6OÑ6OÓ6QÑQˆÔØ ×-Ñ-°Ñ5ˆÔØ ×-Ñ-°Ñ8ˆÔØ"×/Ñ/°(Ñ:ˆÔæØ�N‰NÔà×!Ñ!×#Ñ#ÜÐ\Ó]Ð]àˆÔØˆÜ�$×#Ñ#¨¯©¨°d·o±oÐ5FÀdÐ&KÑKÔLÐPTÛ�Ø ŸJ™J›L×.Ñ.¨sÓ3‘	�Ø×!Ñ!×(Ñ(¨×)<Ñ)<×)EÑ)EÀcÓ)PÔQØ—‘˜sÖ#ñ ÷ Mô œc '›lÓ+ˆŒÜ ¤ T§\¡\´5¼¸T¿\¹\Ó9JÓ3KÓ!LÓMˆÔÙ:AÓBº'°3×)Ñ)¨#Ô.¹'ÑBˆŒØ�÷ MÕLüò Cs   ÅA0IÈ&IÉ
Ic                 ó,   • [        U R                  5      $ ©N)r?   r4   ©rB   s    rH   Ú__len__ÚDTD.__len__Q   s   € Ü�4×$Ñ$Ó%Ð%ó    Úidxc                 óì   • U R                   U   U R                  U   p2U R                  U5      nU R                  (       a  U R                  U5      nU R                  (       a  U R	                  U5      nXC4$ rK   )r4   rA   r   r   r   )rB   rP   Ú
image_fileÚlabelÚimages        rH   Ú__getitem__ÚDTD.__getitem__T   sa   € Ø ×-Ñ-¨cÑ2°D·L±LÀÑ4E�EØ—‘˜JÓ'ˆà�>�>Ø—N‘N 5Ó)ˆEà× × Ø×)Ñ)¨%Ó0ˆEàˆ|ÐrO   c                 ó:   • SU R                    SU R                   3$ )Nzsplit=z, partition=)r!   r%   rL   s    rH   Ú
extra_reprÚDTD.extra_repr`   s   € Ø˜Ÿ™�} L°·±Ð0AÐBÐBrO   c                 ó´   • [         R                  R                  U R                  5      =(       a)    [         R                  R	                  U R                  5      $ rK   )ÚosÚpathÚexistsr.   ÚisdirrL   s    rH   r2   ÚDTD._check_existsc   s3   € Ü�w‰w�~‰~˜d×/Ñ/Ó0×U´R·W±W·]±]À4×CTÑCTÓ5UÐUrO   c                 ó”   • U R                  5       (       a  g [        U R                  [        U R                  5      U R
                  S9  g )N)Údownload_rootÚmd5)r2   r	   Ú_URLÚstrr-   Ú_MD5rL   s    rH   r1   ÚDTD._downloadf   s6   € Ø×Ñ×ÑØÜ$ T§Y¡Y¼cÀ$×BSÑBSÓ>TÐZ^×ZcÑZcÓdrO   )r-   r.   r4   r0   rA   r/   r%   r!   r@   r;   r   )r   N)r+   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rc   re   r   r   rd   r(   r)   r#   r   r   Úboolr   r'   rM   ÚtuplerU   rX   r2   r1   Ú__static_attributes__Ú__classcell__)rG   s   @rH   r   r      s  ø† ñð. R€DØ-€Dð
 ØØ(,Ø/3ØØ<Jñ)à�C˜Ÿ™Ð%Ñ&ð)ð ð)ð ð	)ð
 ˜HÑ%ð)ð # 8Ñ,ð)ð ð)ð ˜%  W§\¡\Ð 1Ñ2Ð3°SÐ8Ñ9ð)ð 
÷)ð )ðV&˜ô &ð
˜sð 
 u¨S°#¨X¡ô 
ðC˜Cô CðV˜tô V÷eò erO   r   )r[   r(   Útypingr   r   r   r   Úfolderr   Úutilsr	   r
   Úvisionr   r   © rO   rH   Ú<module>rt      s*   ðÛ 	Û ß 1Ó 1å "ç ?Ý !ô^eˆ-õ ^erO   