ó
    EñiÀ  ã                   ó¬   • S SK Jr  S SKJrJrJrJr  S SKrS SKJr  S SK	J
r  S SKJr   " S S\5      r " S	 S
\5      r " S S\5      r " S S\5      rg)é    )ÚSequence)ÚAnyÚCallableÚOptionalÚUnionN)Únn©Ú
transforms)Ú	Transformc                   ó^   ^ • \ rS rSrSrS\\   SS4U 4S jjrS\S\4S jr	S\
4S	 jrS
rU =r$ )ÚComposeé   a_  Composes several transforms together.

This transform does not support torchscript.
Please, see the note below.

Args:
    transforms (list of ``Transform`` objects): list of transforms to compose.

Example:
    >>> transforms.Compose([
    >>>     transforms.CenterCrop(10),
    >>>     transforms.PILToTensor(),
    >>>     transforms.ConvertImageDtype(torch.float),
    >>> ])

.. note::
    In order to script the transformations, please use ``torch.nn.Sequential`` as below.

    >>> transforms = torch.nn.Sequential(
    >>>     transforms.CenterCrop(10),
    >>>     transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225)),
    >>> )
    >>> scripted_transforms = torch.jit.script(transforms)

    Make sure to use only scriptable transformations, i.e. that work with ``torch.Tensor``, does not require
    `lambda` functions or ``PIL.Image``.

r
   ÚreturnNc                 ó’   >• [         TU ]  5         [        U[        5      (       d  [	        S5      eU(       d  [        S5      eXl        g ©Nú5Argument transforms should be a sequence of callablesúPass at least one transform)ÚsuperÚ__init__Ú
isinstancer   Ú	TypeErrorÚ
ValueErrorr
   ©Úselfr
   Ú	__class__s     €Úa/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torchvision/transforms/v2/_container.pyr   ÚCompose.__init__)   s;   ø€ Ü‰ÑÔÜ˜*¤h×/Ñ/ÜÐSÓTÐTÞÜÐ:Ó;Ð;Ø$�ó    Úinputsc                 ój   • [        U5      S:„  nU R                   H  nU" U6 nU(       a  UOU4nM     W$ ©Né   )Úlenr
   ©r   r   Úneeds_unpackingÚ	transformÚoutputss        r   ÚforwardÚCompose.forward1   s9   € Ü˜f›+¨™/ˆØŸœˆIÙ Ð(ˆGÞ /‘W°g°ZŠFñ )ð ˆr   c                 óv   • / nU R                    H  nUR                  SU 35        M     SR                  U5      $ ©Nz    Ú
©r
   ÚappendÚjoin©r   Úformat_stringÚts      r   Ú
extra_reprÚCompose.extra_repr8   ó8   € ØˆØ—”ˆAØ× Ñ  4¨ s Ö,ñ !à�y‰y˜Ó'Ð'r   r	   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   r   r(   Ústrr3   Ú__static_attributes__Ú__classcell__©r   s   @r   r   r      sD   ø† ñð:% 8¨HÑ#5ð %¸$÷ %ð˜sð  sô ð(˜C÷ (ò (r   r   c                   ó´   ^ • \ rS rSrSr\R                  rSS\\	\
   \R                  4   S\SS4U 4S jjjrS\\\4   4S jrS	\S\4S
 jrS\4S jrSrU =r$ )ÚRandomApplyé?   a¶  Apply randomly a list of transformations with a given probability.

.. note::
    In order to script the transformation, please use ``torch.nn.ModuleList`` as input instead of list/tuple of
    transforms as shown below:

    >>> transforms = transforms.RandomApply(torch.nn.ModuleList([
    >>>     transforms.ColorJitter(),
    >>> ]), p=0.3)
    >>> scripted_transforms = torch.jit.script(transforms)

    Make sure to use only scriptable transformations, i.e. that work with ``torch.Tensor``, does not require
    `lambda` functions or ``PIL.Image``.

Args:
    transforms (sequence or torch.nn.Module): list of transformations
    p (float): probability of applying the list of transforms
r
   Úpr   Nc                 óò   >• [         TU ]  5         [        U[        [        R
                  45      (       d  [        S5      eU(       d  [        S5      eXl        SUs=::  a  S::  d  O  [        S5      eX l	        g )NzJArgument transforms should be a sequence of callables or a `nn.ModuleList`r   g        g      ð?z@`p` should be a floating point value in the interval [0.0, 1.0].)
r   r   r   r   r   Ú
ModuleListr   r   r
   rB   )r   r
   rB   r   s      €r   r   ÚRandomApply.__init__U   s`   ø€ Ü‰ÑÔä˜*¤x´·±Ð&?×@Ñ@ÜÐhÓiÐiÞÜÐ:Ó;Ð;Ø$Œà�q•˜C•ÜÐ_Ó`Ð`Ø�r   c                 ó4   • U R                   U R                  S.$ )N©r
   rB   rG   )r   s    r   Ú _extract_params_for_v1_transformÚ,RandomApply._extract_params_for_v1_transformb   s   € Ø"Ÿo™o°D·F±FÑ;Ð;r   r   c                 óÎ   • [        U5      S:„  n[        R                  " S5      U R                  :¼  a  U(       a  U$ US   $ U R                   H  nU" U6 nU(       a  UOU4nM     W$ )Nr"   r   )r#   ÚtorchÚrandrB   r
   r$   s        r   r(   ÚRandomApply.forwarde   s^   € Ü˜f›+¨™/ˆä�:Š:�a‹=˜DŸF™FÓ"Þ,�6Ð;°&¸±)Ð;àŸœˆIÙ Ð(ˆGÞ /‘W°g°ZŠFñ )ð ˆr   c                 óv   • / nU R                    H  nUR                  SU 35        M     SR                  U5      $ r+   r-   r0   s      r   r3   ÚRandomApply.extra_reprp   r5   r   ©rB   r
   )g      à?)r6   r7   r8   r9   r:   Ú_transformsr@   Ú_v1_transform_clsr   r   r   r   rD   Úfloatr   Údictr;   r   rH   r(   r3   r<   r=   r>   s   @r   r@   r@   ?   s‚   ø† ñð& $×/Ñ/Ðñ 5¨°(Ñ);¸R¿]¹]Ð)JÑ#Kð ÐPUð Ð`d÷ ð ð<°$°s¸C°x±.ô <ð	˜sð 	 sô 	ð(˜C÷ (ò (r   r@   c                   óf   ^ • \ rS rSrSr SS\\   S\\\	      SS4U 4S jjjr
S\S\4S	 jrS
rU =r$ )ÚRandomChoiceéw   a–  Apply single transformation randomly picked from a list.

This transform does not support torchscript.

Args:
    transforms (sequence or torch.nn.Module): list of transformations
    p (list of floats or None, optional): probability of each transform being picked.
        If ``p`` doesn't sum to 1, it is automatically normalized. If ``None``
        (default), all transforms have the same probability.
Nr
   rB   r   c                 ó‚  >• [        U[        5      (       d  [        S5      eU(       d  [        S5      eUc  S/[	        U5      -  nO;[	        U5      [	        U5      :w  a#  [        S[	        U5       S[	        U5       35      e[
        TU ]  5         Xl        [        U5      nU Vs/ s H  oDU-  PM	     snU l	        g s  snf )Nr   r   r"   z4Length of p doesn't match the number of transforms: z != )
r   r   r   r   r#   r   r   r
   ÚsumrB   )r   r
   rB   ÚtotalÚprobr   s        €r   r   ÚRandomChoice.__init__ƒ   s°   ø€ ô
 ˜*¤h×/Ñ/ÜÐSÓTÐTÞÜÐ:Ó;Ð;Ø‰9Ø�”c˜*“oÑ%‰AÜ�‹V”s˜:“Ó&ÜÐSÔTWÐXYÓTZÐS[Ð[_Ô`cÐdnÓ`oÐ_pÐqÓrÐrä‰ÑÔà$ŒÜ�A“ˆÙ+,Ó-ª1 4˜”,©1Ñ-ˆ�ùÒ-s   Â%B<r   c                 ó¦   • [        [        R                  " [        R                  " U R                  5      S5      5      nU R
                  U   nU" U6 $ r!   )ÚintrK   ÚmultinomialÚtensorrB   r
   )r   r   Úidxr&   s       r   r(   ÚRandomChoice.forward—   s?   € Ü”%×#Ò#¤E§L¢L°·±Ó$8¸!Ó<Ó=ˆØ—O‘O CÑ(ˆ	Ù˜&Ð!Ð!r   rP   )N)r6   r7   r8   r9   r:   r   r   r   ÚlistrS   r   r   r(   r<   r=   r>   s   @r   rV   rV   w   sY   ø† ñ	ð $(ñ.à˜XÑ&ð.ð �D˜‘KÑ ð.ð 
÷	.ð .ð("˜sð " s÷ "ò "r   rV   c                   óP   ^ • \ rS rSrSrS\\   SS4U 4S jjrS\S\4S jr	S	r
U =r$ )
ÚRandomOrderé�   z®Apply a list of transformations in a random order.

This transform does not support torchscript.

Args:
    transforms (sequence or torch.nn.Module): list of transformations
r
   r   Nc                 ó’   >• [        U[        5      (       d  [        S5      eU(       d  [        S5      e[        TU ]  5         Xl        g r   )r   r   r   r   r   r   r
   r   s     €r   r   ÚRandomOrder.__init__¦   s;   ø€ Ü˜*¤h×/Ñ/ÜÐSÓTÐTÞÜÐ:Ó;Ð;Ü‰ÑÔØ$�r   r   c                 óÂ   • [        U5      S:„  n[        R                  " [        U R                  5      5       H#  nU R                  U   nU" U6 nU(       a  UOU4nM%     W$ r!   )r#   rK   Úrandpermr
   )r   r   r%   ra   r&   r'   s         r   r(   ÚRandomOrder.forward®   sU   € Ü˜f›+¨™/ˆÜ—>’>¤# d§o¡oÓ"6Ö7ˆCØŸ™¨Ñ,ˆIÙ Ð(ˆGÞ /‘W°g°ZŠFñ 8ð ˆr   r	   )r6   r7   r8   r9   r:   r   r   r   r   r(   r<   r=   r>   s   @r   re   re   �   s8   ø† ñð% 8¨HÑ#5ð %¸$÷ %ð˜sð  s÷ ò r   re   )Úcollections.abcr   Útypingr   r   r   r   rK   r   Útorchvisionr
   rQ   Útorchvision.transforms.v2r   r   r@   rV   re   © r   r   Ú<module>rq      sM   ðÝ $ß 1Ó 1ã å Ý 1Ý /ô1(ˆiô 1(ôh5(�)ô 5(ôp#"�9ô #"ôL�)õ r   