
    h@n                        S SK r S SKJr  S SKJr  S SKrS SKJr  SSKJr	J
r
  / SQrS\S	\S
\S\
S\\\      4
S jr " S S\5      r " S S\R"                  R$                  5      r " S S\R"                  R$                  5      r " S S\R"                  R$                  5      r " S S\R"                  R$                  5      rg)    N)Enum)Optional)Tensor   )
functionalInterpolationMode)AutoAugmentPolicyAutoAugmentRandAugmentTrivialAugmentWideAugMiximgop_name	magnitudeinterpolationfillc                    US:X  aK  [         R                  " U SSS/S[        R                  " [        R                  " U5      5      S/UUSS/S9n U $ US:X  aK  [         R                  " U SSS/SS[        R                  " [        R                  " U5      5      /UUSS/S9n U $ US:X  a)  [         R                  " U S[        U5      S/SUSS/US9n U $ US	:X  a)  [         R                  " U SS[        U5      /SUSS/US9n U $ US
:X  a  [         R                  " XX4S9n U $ US:X  a  [         R                  " U SU-   5      n U $ US:X  a  [         R                  " U SU-   5      n U $ US:X  a  [         R                  " U SU-   5      n U $ US:X  a  [         R                  " U SU-   5      n U $ US:X  a"  [         R                  " U [        U5      5      n U $ US:X  a  [         R                  " X5      n U $ US:X  a  [         R                  " U 5      n U $ US:X  a  [         R                  " U 5      n U $ US:X  a  [         R                  " U 5      n U $ US:X  a   U $ [!        SU S35      e)NShearX        r         ?)angle	translatescaleshearr   r   centerShearY
TranslateX)r   r   r   r   r   r   
TranslateYRotater   r   
BrightnessColorContrast	Sharpness	PosterizeSolarizeAutoContrastEqualizeInvertIdentityzThe provided operator  is not recognized.)Faffinemathdegreesatanintrotateadjust_brightnessadjust_saturationadjust_contrastadjust_sharpness	posterizesolarizeautocontrastequalizeinvert
ValueError)r   r   r   r   r   s        Z/var/www/auris/envauris/lib/python3.13/site-packages/torchvision/transforms/autoaugment.py	_apply_opr>      s    ( hh!f<<		) 45s;'q6	
F Js 
H	 hh!fTYYy%9:;'q6	
l JY 
L	 hh9~q)'*
V JE 
L	 hh#i.)'*
B J1 
H	hhs]N. J- 
L	 !!#sY7* J) 
G	!!#sY7& J% 
J	S9_5" J! 
K	  cIo6 J 
K	kk#s9~. J 
J	jj( J 
N	"nnS! J 
J	jjo J 
H	hhsm
 J	 
J	 J 1':MNOO    c                   $    \ rS rSrSrSrSrSrSrg)r	   ]   zgAutoAugment policies learned on different datasets.
Available policies are IMAGENET, CIFAR10 and SVHN.
imagenetcifar10svhn N)	__name__
__module____qualname____firstlineno____doc__IMAGENETCIFAR10SVHN__static_attributes__rE   r?   r=   r	   r	   ]   s     HGDr?   r	   c                   @  ^  \ rS rSrSr\R                  \R                  S4S\S\S\	\
\      SS4U 4S jjjrS\S\
\\\\\	\   4   \\\\	\   4   4      4S	 jrS
\S\\\4   S\\\\\4   4   4S jr\S\S\\\\4   4S j5       rS\S\4S jrS\4S jrSrU =r$ )r
   h   a  AutoAugment data augmentation method based on
`"AutoAugment: Learning Augmentation Strategies from Data" <https://arxiv.org/pdf/1805.09501.pdf>`_.
If the image is torch Tensor, it should be of type torch.uint8, and it is expected
to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions.
If img is PIL Image, it is expected to be in mode "L" or "RGB".

Args:
    policy (AutoAugmentPolicy): Desired policy enum defined by
        :class:`torchvision.transforms.autoaugment.AutoAugmentPolicy`. Default is ``AutoAugmentPolicy.IMAGENET``.
    interpolation (InterpolationMode): Desired interpolation enum defined by
        :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``.
        If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
    fill (sequence or number, optional): Pixel fill value for the area outside the transformed
        image. If given a number, the value is used for all bands respectively.
Npolicyr   r   returnc                 r   > [         TU ]  5         Xl        X l        X0l        U R                  U5      U l        g N)super__init__rQ   r   r   _get_policiespolicies)selfrQ   r   r   	__class__s       r=   rV   AutoAugment.__init__y   s2     	*	**62r?   c                     U[         R                  :X  a  / SQ$ U[         R                  :X  a  / SQ$ U[         R                  :X  a  / SQ$ [	        SU S35      e)N)))r%   皙?   )r   333333?	   )r&   r_      r'   r_   Nr(   皙?Nr(   r_   N))r%   r_      )r%   r_      r(   r]   N)r&   皙?   )rk   r   rf   r^   ))r&   r_      rg   ))r%   rf   rb   r(   r   N))r   rl   ro   )r&   r_   r^   )rg   )r%   r]   ri   )rn   r"   r]   r   ))r   r]   r`   rg   ))r(   r   Nre   r)   r_   Nrp   )r"   r_   rm   )r#   r   r^   )rn   )r"   r      ))r"   rf   r^   )r&   rf   rh   ))r$   r]   rh   rs   ))r   r_   rb   rp   )rq   rg   rj   ra   rr   rt   rd   ))r)   皙?N)r#   rl   ri   ))r   ffffff?ru   )r   333333?r`   ))r$   rf   r   )r$   ?ro   ))r         ?r^   r   rx   r`   ))r'   r{   Nr(   rz   N))r   rl   rh   )r%   ry   rh   ))r"   r]   ro   )r!   r_   rh   ))r$   ry   r`   )r!   rx   r`   )rg   )r(   r{   N))r#   r_   rh   )r$   r_   rb   ))r"   rx   rh   )r   r{   r^   ))r(   ry   N)r'   r]   N))r   r]   ro   )r$   rl   ri   ))r!   rz   ri   )r"   rl   r^   ))r&   r{   ru   )r)   r   N)r(   rl   Nrc   )r~   rg   ))r"   rz   r`   rg   )r'   rf   N)r&   rl   r^   ))r!   rw   ro   )r"   rx   r   ))r&   r]   rb   r'   rz   N))r   rz   r`   r|   )r   )r&   rf   ro   )re   rv   )r|   r   ))r   rz   rm   )r)   rl   N)r   rz   r^   r)   rx   N)rg   )r&   r_   ri   r)   rz   Nrg   rg   )r   rz   ro   )r   r   )r   )r)   r]   N))r   rz   rb   )r&   rl   ri   )r   r   r   )r   )r&   ry   ro   ))r   rf   r^   r   )r}   )r   r_   ri   r   ))r#   ry   ro   r   rf   rm   )r)   rf   N)r   r   ru   ))r   rx   ri   )r&   r]   r^   )rs   r   ))r   ry   rh   )r   rz   ro   ))r   rw   ri   rs   ))r&   rx   ru   )r   r_   rh   ))r   rf   rm   r   ))r   rx   r`   )r   rf   ro   ))r   rf   rb   )r'   rx   N))r   rx   ru   rv   zThe provided policy r+   )r	   rK   rL   rM   r<   )rY   rQ   s     r=   rW   AutoAugment._get_policies   sk     &/// 6 (000 6 (--- 8 3F8;NOPPr?   num_bins
image_sizec                    [         R                  " SSU5      S4[         R                  " SSU5      S4[         R                  " SSUS   -  U5      S4[         R                  " SSUS   -  U5      S4[         R                  " SSU5      S4[         R                  " SSU5      S4[         R                  " SSU5      S4[         R                  " SSU5      S4[         R                  " SSU5      S4S	[         R                  " U5      US-
  S
-  -  R                  5       R	                  5       -
  S4[         R                  " SSU5      S4[         R
                  " S5      S4[         R
                  " S5      S4[         R
                  " S5      S4S.$ )Nr   ry   Tt ?r   r         >@rz   r^   rm   F     o@)r   r   r   r   r   r!   r"   r#   r$   r%   r&   r'   r(   r)   )torchlinspacearangeroundr1   tensorrY   r   r   s      r=   _augmentation_spaceAutoAugment._augmentation_space   s^    ~~c394@~~c394@ >>#}z!}/LhWY]^ >>#}z!}/LhWY]^~~c4:DA >>#sH=tDnnS#x8$?S(;TB..c8<dCu||H5(Q,!9KLSSUYY[[]bcsH=uE"\\#.6c*E2||C(%0
 	
r?   transform_numc                     [        [        R                  " U S5      R                  5       5      n[        R                  " S5      n[        R                  " SS5      nXU4$ )znGet parameters for autoaugment transformation

Returns:
    params required by the autoaugment transformation
r   )ru   ru   )r1   r   randintitemrand)r   	policy_idprobssignss       r=   
get_paramsAutoAugment.get_params   sK     mT:??AB	

4 a&&&r?   r   c           	         U R                   n[        R                  " U5      u  p4n[        U[        5      (       aI  [        U[
        [        45      (       a  [        U5      /U-  nOUb  U Vs/ s H  n[        U5      PM     nnU R                  [        U R                  5      5      u  pxn	U R                  SXE45      n
[        U R                  U   5       Hd  u  nu  pnX   U::  d  M  X   u  nnUb  [        X   R                  5       5      OSnU(       a  X   S:X  a  US-  n[        XUU R                  US9nMf     U$ s  snf )zq
    img (PIL Image or Tensor): Image to be transformed.

Returns:
    PIL Image or Tensor: AutoAugmented image.

   r   r         r    )r   r,   get_dimensions
isinstancer   r1   floatr   lenrX   r   	enumerater   r>   r   )rY   r   r   channelsheightwidthftransform_idr   r   op_metair   pmagnitude_id
magnitudessignedr   s                     r=   forwardAutoAugment.forward   s-    yy"#"2"23"7%c6""$e--d}x/!*./$Qa$/%)__S5G%H"U**2?-6t}}\7R-S)A)Lx1}%,%5"
FFRF^E*":"?"?"ABdg	eh!m%IitGYGY`de .T 
 0s   -E c                 h    U R                   R                   SU R                   SU R                   S3$ )Nz(policy=, fill=))rZ   rF   rQ   r   )rY   s    r=   __repr__AutoAugment.__repr__  s/    ..))*(4;;-wtyykQRSSr?   )r   r   rX   rQ   )rF   rG   rH   rI   rJ   r	   rK   r   NEARESTr   listr   rV   tuplestrr1   rW   dictr   boolr   staticmethodr   r   r   rN   __classcell__rZ   s   @r=   r
   r
   h   s4   $ %6$>$>+<+D+D&*	
3!
3 )
3 tE{#	
3
 

3 
3XQ'XQ	eE#uhsm34eCQT<U6VVW	XXQt
C 
U38_ 
QUVY[`agimam[nVnQo 
& 
'# 
'%VV0C*D 
' 
'6 f 8T# T Tr?   r
   c                      ^  \ rS rSrSrSSS\R                  S4S\S\S	\S
\S\\	\
      SS4U 4S jjjrS\S\\\4   S\\\\\4   4   4S jrS\S\4S jrS\4S jrSrU =r$ )r   i  aB  RandAugment data augmentation method based on
`"RandAugment: Practical automated data augmentation with a reduced search space"
<https://arxiv.org/abs/1909.13719>`_.
If the image is torch Tensor, it should be of type torch.uint8, and it is expected
to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions.
If img is PIL Image, it is expected to be in mode "L" or "RGB".

Args:
    num_ops (int): Number of augmentation transformations to apply sequentially.
    magnitude (int): Magnitude for all the transformations.
    num_magnitude_bins (int): The number of different magnitude values.
    interpolation (InterpolationMode): Desired interpolation enum defined by
        :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``.
        If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
    fill (sequence or number, optional): Pixel fill value for the area outside the transformed
        image. If given a number, the value is used for all bands respectively.
ru   r`      Nnum_opsr   num_magnitude_binsr   r   rR   c                 ^   > [         TU ]  5         Xl        X l        X0l        X@l        XPl        g rT   )rU   rV   r   r   r   r   r   )rY   r   r   r   r   r   rZ   s         r=   rV   RandAugment.__init__2  s+     	""4*	r?   r   r   c                    [         R                  " S5      S4[         R                  " SSU5      S4[         R                  " SSU5      S4[         R                  " SSUS   -  U5      S4[         R                  " SSUS   -  U5      S4[         R                  " SSU5      S4[         R                  " SS	U5      S4[         R                  " SS	U5      S4[         R                  " SS	U5      S4[         R                  " SS	U5      S4S
[         R                  " U5      US-
  S-  -  R	                  5       R                  5       -
  S4[         R                  " SSU5      S4[         R                  " S5      S4[         R                  " S5      S4S.$ )Nr   Fry   Tr   r   r   r   rz   r^   rm   r   r*   r   r   r   r   r   r!   r"   r#   r$   r%   r&   r'   r(   r   r   r   r   r   r1   r   s      r=   r   RandAugment._augmentation_spaceA  s^    c*E2~~c394@~~c394@ >>#}z!}/LhWY]^ >>#}z!}/LhWY]^~~c4:DA >>#sH=tDnnS#x8$?S(;TB..c8<dCu||H5(Q,!9KLSSUYY[[]bcsH=uE"\\#.6c*E2
 	
r?   r   c           	      "   U R                   n[        R                  " U5      u  p4n[        U[        5      (       aI  [        U[
        [        45      (       a  [        U5      /U-  nOUb  U Vs/ s H  n[        U5      PM     nnU R                  U R                  XE45      n[        U R                  5       H  n[        [        R                  " [        U5      S5      R                  5       5      n	[        UR!                  5       5      U	   n
Xz   u  pUR"                  S:  a%  [        XR$                     R                  5       5      OSnU(       a!  [        R                  " SS5      (       a  US-  n['        XXR(                  US9nM     U$ s  snf )o
    img (PIL Image or Tensor): Image to be transformed.

Returns:
    PIL Image or Tensor: Transformed image.
r   r   r   ru   r   r    )r   r,   r   r   r   r1   r   r   r   ranger   r   r   r   r   r   keysndimr   r>   r   )rY   r   r   r   r   r   r   r   _op_indexr   r   r   r   s                 r=   r   RandAugment.forwardT  sD    yy"#"2"23"7%c6""$e--d}x/!*./$Qa$/**4+B+BVOTt||$A5==Wt<AACDH7<<>*84G!(!1JDNOOVWDWj8==?@]`I%--400T!	C)CUCU\`aC % 
 0s   -Fc                     U R                   R                   SU R                   SU R                   SU R                   SU R
                   SU R                   S3nU$ )Nz	(num_ops=z, magnitude=z, num_magnitude_bins=, interpolation=r   r   )rZ   rF   r   r   r   r   r   rY   ss     r=   r   RandAugment.__repr__o  sg    ~~&&' (||n4>>*#D$;$;#<t112dii[ 	
 r?   )r   r   r   r   r   )rF   rG   rH   rI   rJ   r   r   r1   r   r   r   rV   r   r   r   r   r   r   r   r   rN   r   r   s   @r=   r   r     s    ( "$+<+D+D&*   	
 ) tE{# 
 
C 
U38_ 
QUVY[`agimam[nVnQo 
&6 f 6
# 
 
r?   r   c            	          ^  \ rS rSrSrS\R                  S4S\S\S\\	\
      SS4U 4S	 jjjrS
\S\\\\\4   4   4S jrS\S\4S jrS\4S jrSrU =r$ )r   i|  a  Dataset-independent data-augmentation with TrivialAugment Wide, as described in
`"TrivialAugment: Tuning-free Yet State-of-the-Art Data Augmentation" <https://arxiv.org/abs/2103.10158>`_.
If the image is torch Tensor, it should be of type torch.uint8, and it is expected
to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions.
If img is PIL Image, it is expected to be in mode "L" or "RGB".

Args:
    num_magnitude_bins (int): The number of different magnitude values.
    interpolation (InterpolationMode): Desired interpolation enum defined by
        :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``.
        If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
    fill (sequence or number, optional): Pixel fill value for the area outside the transformed
        image. If given a number, the value is used for all bands respectively.
r   Nr   r   r   rR   c                 F   > [         TU ]  5         Xl        X l        X0l        g rT   )rU   rV   r   r   r   )rY   r   r   r   rZ   s       r=   rV   TrivialAugmentWide.__init__  s!     	"4*	r?   r   c                    [         R                  " S5      S4[         R                  " SSU5      S4[         R                  " SSU5      S4[         R                  " SSU5      S4[         R                  " SSU5      S4[         R                  " SSU5      S4[         R                  " SSU5      S4[         R                  " SSU5      S4[         R                  " SSU5      S4[         R                  " SSU5      S4S[         R                  " U5      US-
  S	-  -  R	                  5       R                  5       -
  S4[         R                  " S
SU5      S4[         R                  " S5      S4[         R                  " S5      S4S.$ )Nr   FgGz?Tg      @@g     `@r^   r   ri   r   r   r   )rY   r   s     r=   r   &TrivialAugmentWide._augmentation_space  sJ    c*E2~~c4:DA~~c4:DA >>#tX>E >>#tX>E~~c5(;TB >>#tX>EnnS$94@T8<dC..dH=tDu||H5(Q,!9KLSSUYY[[]bcsH=uE"\\#.6c*E2
 	
r?   r   c           	      &   U R                   n[        R                  " U5      u  p4n[        U[        5      (       aI  [        U[
        [        45      (       a  [        U5      /U-  nOUb  U Vs/ s H  n[        U5      PM     nnU R                  U R                  5      n[        [        R                  " [        U5      S5      R                  5       5      n[        UR                  5       5      U   n	Xy   u  pU
R                  S:  aG  [        U
[        R                  " [        U
5      S[        R                   S9   R                  5       5      OSnU(       a!  [        R                  " SS5      (       a  US-  n[#        XXR$                  US9$ s  snf )r   r   r   dtyper   ru   r   r    )r   r,   r   r   r   r1   r   r   r   r   r   r   r   r   r   r   longr>   r   )rY   r   r   r   r   r   r   r   r   r   r   r   r   s                r=   r   TrivialAugmentWide.forward  sC    yy"#"2"23"7%c6""$e--d}x/!*./$Qa$/**4+B+BCu}}S\48==?@w||~&x0$-
 " *U]]3z?D

STYY[\ 	
 emmAt,,Iy@R@RY]^^ 0s   -Fc                     U R                   R                   SU R                   SU R                   SU R                   S3nU$ )Nz(num_magnitude_bins=r   r   r   )rZ   rF   r   r   r   r   s     r=   r   TrivialAugmentWide.__repr__  sP    ~~&&' (""&"9"9!:t112dii[	 	
 r?   )r   r   r   )rF   rG   rH   rI   rJ   r   r   r1   r   r   r   rV   r   r   r   r   r   r   r   r   rN   r   r   s   @r=   r   r   |  s    " #%+<+D+D&*			 )	 tE{#		
 
	 	
C 
DeFDL>Q9Q4R 
&_6 _f _:#  r?   r   c                   h  ^  \ rS rSrSrSSSSS\R                  S4S\S	\S
\S\S\	S\S\
\\      SS4U 4S jjjrS\S\\\4   S\\\\\	4   4   4S jr\R&                  R(                  S\4S j5       r\R&                  R(                  S\4S j5       rS\S\4S jrS\S\4S jrS\4S jrSrU =r$ )r   i  ax  AugMix data augmentation method based on
`"AugMix: A Simple Data Processing Method to Improve Robustness and Uncertainty" <https://arxiv.org/abs/1912.02781>`_.
If the image is torch Tensor, it should be of type torch.uint8, and it is expected
to have [..., 1 or 3, H, W] shape, where ... means an arbitrary number of leading dimensions.
If img is PIL Image, it is expected to be in mode "L" or "RGB".

Args:
    severity (int): The severity of base augmentation operators. Default is ``3``.
    mixture_width (int): The number of augmentation chains. Default is ``3``.
    chain_depth (int): The depth of augmentation chains. A negative value denotes stochastic depth sampled from the interval [1, 3].
        Default is ``-1``.
    alpha (float): The hyperparameter for the probability distributions. Default is ``1.0``.
    all_ops (bool): Use all operations (including brightness, contrast, color and sharpness). Default is ``True``.
    interpolation (InterpolationMode): Desired interpolation enum defined by
        :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``.
        If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
    fill (sequence or number, optional): Pixel fill value for the area outside the transformed
        image. If given a number, the value is used for all bands respectively.
ro   r   TNseveritymixture_widthchain_depthalphaall_opsr   r   rR   c                    > [         TU ]  5         SU l        SUs=::  a  U R                  ::  d  O  [        SU R                   SU S35      eXl        X l        X0l        X@l        XPl        X`l	        Xpl
        g )Nr   r   z!The severity must be between [1, z]. Got z	 instead.)rU   rV   _PARAMETER_MAXr<   r   r   r   r   r   r   r   )	rY   r   r   r   r   r   r   r   rZ   s	           r=   rV   AugMix.__init__  sw     	 X4!4!44@ATAT@UU\]e\ffopqq *&
*	r?   r   r   c                 8   [         R                  " SSU5      S4[         R                  " SSU5      S4[         R                  " SUS   S-  U5      S4[         R                  " SUS   S-  U5      S4[         R                  " SSU5      S4S[         R                  " U5      US-
  S-  -  R                  5       R	                  5       -
  S	4[         R                  " S
SU5      S	4[         R
                  " S5      S	4[         R
                  " S5      S	4S.	nU R                  (       av  UR                  [         R                  " SSU5      S4[         R                  " SSU5      S4[         R                  " SSU5      S4[         R                  " SSU5      S4S.5        U$ )Nr   ry   Tr   g      @r   r   rm   Fr   )	r   r   r   r   r   r%   r&   r'   r(   rz   )r!   r"   r#   r$   )r   r   r   r   r1   r   r   update)rY   r   r   r   s       r=   r   AugMix._augmentation_space  si    ~~c394@~~c394@ >>#z!}s/BHMtT >>#z!}s/BHMtT~~c4:DAu||H5(Q,!9KLSSUYY[[]bcsH=uE"\\#.6c*E2
 <<HH#(>>#sH#Et"L#nnS#x@$G!&S(!CT J"'..c8"Dd!K	 r?   c                 .    [         R                  " U5      $ rT   )r,   pil_to_tensorrY   r   s     r=   _pil_to_tensorAugMix._pil_to_tensor  s    s##r?   r   c                 .    [         R                  " U5      $ rT   )r,   to_pil_imager   s     r=   _tensor_to_pilAugMix._tensor_to_pil  s    ~~c""r?   paramsc                 .    [         R                  " U5      $ rT   )r   _sample_dirichlet)rY   r   s     r=   r  AugMix._sample_dirichlet  s    &&v..r?   orig_imgc                    U R                   n[        R                  " U5      u  p4n[        U[        5      (       aL  Un[        U[
        [        45      (       a  [        U5      /U-  nO0Ub  U Vs/ s H  n[        U5      PM     nnOU R                  U5      nU R                  U R                  XE45      n[        UR                  5      n	UR                  S/[        SUR                  -
  S5      -  U	-   5      n
U
R                  S5      /S/U
R                  S-
  -  -   nU R!                  ["        R$                  " U R&                  U R&                  /U
R(                  S9R+                  US   S5      5      nU R!                  ["        R$                  " U R&                  /U R,                  -  U
R(                  S9R+                  US   S5      5      USS2S4   R                  US   S/5      -  nUSS2S4   R                  U5      U
-  n[/        U R,                  5       GH  nU
nU R0                  S:  a  U R0                  O,[        ["        R2                  " SSSS9R5                  5       5      n[/        U5       H  n[        ["        R2                  " [7        U5      S5      R5                  5       5      n[        UR9                  5       5      U   nUU   u  nnUR                  S:  aH  [        U["        R2                  " U R:                  S["        R<                  S	9   R5                  5       5      OS
nU(       a!  ["        R2                  " SS5      (       a  US-  n[?        UUUU R@                  US9nM     URC                  USS2U4   R                  U5      U-  5        GM     UR                  U	5      RE                  URF                  S	9n[        U[        5      (       d  U RI                  U5      $ U$ s  snf )r   Nr   rm   r   )devicer   r   )lowhighsizer   r   ru   r   r    )%r   r,   r   r   r   r1   r   r   r   r   r   shapeviewmaxr   r  r  r   r   r   r  expandr   r   r   r   r   r   r   r   r   r>   r   add_tor   r   )rY   r  r   r   r   r   r   r   r   	orig_dimsbatch
batch_dimsmcombined_weightsmixr   augdepthr   r   r   r   r   r   s                           r=   r   AugMix.forward!  sY    yy"#"2"28"<%h''C$e--d}x/!*./$Qa$/%%h/C**4+>+>PO	!s1sxx<33i?@jjm_sejj1n'==
 ""LL$**djj1%,,GNNzZ[}^`a

  11LL$**(:(::5<<PWWXbcdXegij
adGLL*Q-,-. 1gll:&.t))*AC(,(8(81(<D$$#emmXY`ahlFmFrFrFtBuE5\u}}S\4@EEGHw||~.x8%,W%5"
F "* *U]]4==$ejj%YZ__ab 
 emmAt44%IWitGYGY`de " HH%ad+00<sBC +  hhy!$$399$5(F++&&s++
U 0s   /O1c                     U R                   R                   SU R                   SU R                   SU R                   SU R
                   SU R                   SU R                   SU R                   S3nU$ )	Nz
(severity=z, mixture_width=z, chain_depth=z, alpha=z
, all_ops=r   r   r   )	rZ   rF   r   r   r   r   r   r   r   r   s     r=   r   AugMix.__repr__[  s    ~~&&' (t112T--.tzzlt112dii[ 	
 r?   )r   r   r   r   r   r   r   r   )rF   rG   rH   rI   rJ   r   BILINEARr1   r   r   r   r   rV   r   r   r   r   r   r   jitunusedr   r   r  r   r   rN   r   r   s   @r=   r   r     sC   , +<+E+E&*  	
   ) tE{# 
 ,C U38_ QUVY[`agimam[nVnQo 0 YY$V $ $ YY#& # #/ /6 /8 86 8t#  r?   r   )r.   enumr   typingr   r   r    r   r,   r   __all__r   r   r   r>   r	   nnModuler
   r   r   r   rE   r?   r=   <module>r#     s         0
]M	MM*/M@QMYabfglbmYnM` tT%((// tTnZ%((// ZzS SlUUXX__ Ur?   