
    h                         S SK r S SKJr  S SKJrJrJrJr  S SKJ	s  J
r
  SSK	Jr   " S S\
R                  5      r " S S	5      rg)
    N)Path)AnyCallableOptionalUnion   )_log_api_usage_oncec                       \ rS rSrSrSr    SS\\\4   S\	\
   S\	\
   S\	\
   S	S4
S
 jjrS\S	\4S jrS	\4S jrS	\4S jrS\
S\S	\\   4S jrS	\4S jrSrg)VisionDataset
   a  
Base Class For making datasets which are compatible with torchvision.
It is necessary to override the ``__getitem__`` and ``__len__`` method.

Args:
    root (string, optional): Root directory of dataset. Only used for `__repr__`.
    transforms (callable, optional): A function/transforms that takes in
        an image and a label and returns the transformed versions of both.
    transform (callable, optional): A function/transform that takes in a PIL image
        and returns a transformed version. E.g, ``transforms.RandomCrop``
    target_transform (callable, optional): A function/transform that takes in the
        target and transforms it.

.. note::

    :attr:`transforms` and the combination of :attr:`transform` and :attr:`target_transform` are mutually exclusive.
   Nroot
transforms	transformtarget_transformreturnc                 .   [        U 5        [        U[        5      (       a  [        R                  R                  U5      nXl        US LnUS L=(       d    US LnU(       a  U(       a  [        S5      eX0l        X@l	        U(       a  [        X45      nX l        g )NzGOnly transforms or transform/target_transform can be passed as argument)r	   
isinstancestrospath
expanduserr   
ValueErrorr   r   StandardTransformr   )selfr   r   r   r   has_transformshas_separate_transforms          S/var/www/auris/envauris/lib/python3.13/site-packages/torchvision/datasets/vision.py__init__VisionDataset.__init__   s     	D!dC  77%%d+D	#4/!*$!6!V:JRV:V4fgg # 0!*9GJ$    indexc                     [         e)z~
Args:
    index (int): Index

Returns:
    (Any): Sample and meta data, optionally transformed by the respective transforms.
NotImplementedError)r   r"   s     r   __getitem__VisionDataset.__getitem__8   s
     "!r!   c                     [         eNr$   r   s    r   __len__VisionDataset.__len__B   s    !!r!   c                    SU R                   R                  -   nSU R                  5        3/nU R                  b  UR	                  SU R                   35        X R                  5       R                  5       -  n[        U S5      (       a&  U R                  b  U[        U R                  5      /-  nU/U Vs/ s H  nSU R                  -  U-   PM     sn-   nSR                  U5      $ s  snf )NzDataset zNumber of datapoints: zRoot location: r    
)	__class____name__r+   r   append
extra_repr
splitlineshasattrr   repr_repr_indentjoin)r   headbodylineliness        r   __repr__VisionDataset.__repr__E   s    DNN333((89:99 KK/$))56!,,..4&&4??+FT$//*++DTJTT# 1 11D8TJJyy Ks   6C(r9   c           
          UR                  5       R                  5       nU US    3/USS   Vs/ s H!  nSR                  S[        U5      -  U5      PM#     sn-   $ s  snf Nr      z{}{}r.   r=   r4   formatlenr   r   r9   r<   r;   s        r   _format_transform_repr$VisionDataset._format_transform_reprP   f    ""$//1&q
#$Y^_`_aYb'cYbQUcCIot(LYb'ccc'c   (Ac                     g)N  r*   s    r   r3   VisionDataset.extra_reprT   s    r!   )r   r   r   r   )NNNN)r1   
__module____qualname____firstlineno____doc__r7   r   r   r   r   r   r   intr   r&   r+   r=   listrF   r3   __static_attributes__rL   r!   r   r   r   
   s    $ L "&)-(,/3%CI% X&% H%	%
 #8,% 
%2" " "" "	 # 	 d d dS	 dC r!   r   c                       \ rS rSrSS\\   S\\   SS4S jjrS\S\S\\\4   4S	 jr	S\S
\
S\\
   4S jrS\
4S jrSrg)r   X   Nr   r   r   c                     Xl         X l        g r)   r   r   )r   r   r   s      r   r   StandardTransform.__init__Y   s    " 0r!   inputtargetc                     U R                   b  U R                  U5      nU R                  b  U R                  U5      nX4$ r)   rX   )r   rZ   r[   s      r   __call__StandardTransform.__call__]   s>    >>%NN5)E  ,**62F}r!   r9   c           
          UR                  5       R                  5       nU US    3/USS   Vs/ s H!  nSR                  S[        U5      -  U5      PM#     sn-   $ s  snf r@   rB   rE   s        r   rF   (StandardTransform._format_transform_reprd   rH   rI   c                     U R                   R                  /nU R                  b  XR                  U R                  S5      -  nU R                  b  XR                  U R                  S5      -  nSR                  U5      $ )NzTransform: zTarget transform: r/   )r0   r1   r   rF   r   r8   )r   r:   s     r   r=   StandardTransform.__repr__h   sm    ''(>>%//NND  ,//0E0EG[\\Dyyr!   )r   r   )NN)r1   rN   rO   rP   r   r   r   r   tupler]   r   rS   rF   r=   rT   rL   r!   r   r   r   X   sx    1(8"4 1xX`Oa 1mq 1c 3 5c? d d dS	 d# r!   r   )r   pathlibr   typingr   r   r   r   torch.utils.datautilsdatar	   Datasetr   r   rL   r!   r   <module>rj      s7    	  1 1   'KDLL K\ r!   