ó
    Eñi5  ã                   óò  • S SK r S SKJr  S SKJrJrJr  S SKrS SKJr  SSK	J
r
Jr  \R                  R                  R                  r " S S\R                  R                  5      r " S	 S
\R                  R"                  5      r " S S\5      r " S S\5      r " S S\R                  R                  5      r " S S\R                  R"                  5      r " S S\R                  R                  5      rg)é    N)ÚSequence)ÚCallableÚOptionalÚUnion)ÚTensoré   )Ú_log_api_usage_onceÚ_make_ntuplec                   óœ   ^ • \ rS rSrSr SS\S\4U 4S jjjrS\S\	S\S	\
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$ )ÚFrozenBatchNorm2dé   a  
BatchNorm2d where the batch statistics and the affine parameters are fixed

Args:
    num_features (int): Number of features ``C`` from an expected input of size ``(N, C, H, W)``
    eps (float): a value added to the denominator for numerical stability. Default: 1e-5
Únum_featuresÚepsc                 ót  >• [         TU ]  5         [        U 5        X l        U R	                  S[
        R                  " U5      5        U R	                  S[
        R                  " U5      5        U R	                  S[
        R                  " U5      5        U R	                  S[
        R                  " U5      5        g )NÚweightÚbiasÚrunning_meanÚrunning_var)ÚsuperÚ__init__r	   r   Úregister_bufferÚtorchÚonesÚzeros)Úselfr   r   Ú	__class__s      €ÚQ/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torchvision/ops/misc.pyr   ÚFrozenBatchNorm2d.__init__   s�   ø€ ô
 	‰ÑÔÜ˜DÔ!ØŒØ×Ñ˜X¤u§z¢z°,Ó'?Ô@Ø×Ñ˜V¤U§[¢[°Ó%>Ô?Ø×Ñ˜^¬U¯[ª[¸Ó-FÔGØ×Ñ˜]¬E¯JªJ°|Ó,DÕEó    Ú
state_dictÚprefixÚlocal_metadataÚstrictÚmissing_keysÚunexpected_keysÚ
error_msgsc           	      óB   >• US-   nX�;   a  X	 [         T	U ]  XX4XVU5        g )NÚnum_batches_tracked)r   Ú_load_from_state_dict)
r   r    r!   r"   r#   r$   r%   r&   Únum_batches_tracked_keyr   s
            €r   r)   Ú'FrozenBatchNorm2d._load_from_state_dict$   s4   ø€ ð #)Ð+@Ñ"@ÐØ"Ó0ØÐ3ä‰Ñ%Ø ¸ÐWaõ	
r   ÚxÚreturnc                 óL  • U R                   R                  SSSS5      nU R                  R                  SSSS5      nU R                  R                  SSSS5      nU R                  R                  SSSS5      nX$U R
                  -   R                  5       -  nX5U-  -
  nX-  U-   $ )Né   éÿÿÿÿ)r   Úreshaper   r   r   r   Úrsqrt)r   r,   ÚwÚbÚrvÚrmÚscaler   s           r   ÚforwardÚFrozenBatchNorm2d.forward6   s¡   € ð �K‰K×Ñ  2 q¨!Ó,ˆØ�I‰I×Ñ˜a  Q¨Ó*ˆØ×Ñ×%Ñ% a¨¨Q°Ó2ˆØ×Ñ×&Ñ& q¨"¨a°Ó3ˆØ˜$Ÿ(™(‘]×)Ñ)Ó+Ñ+ˆØ˜‘:‰~ˆØ‰y˜4ÑÐr   c                 ó‚   • U R                   R                   SU R                  R                  S    SU R                   S3$ )NÚ(r   z, eps=Ú))r   Ú__name__r   Úshaper   )r   s    r   Ú__repr__ÚFrozenBatchNorm2d.__repr__A   s;   € Ø—.‘.×)Ñ)Ð*¨!¨D¯K©K×,=Ñ,=¸aÑ,@Ð+AÀÈÏÉÀzÐQRÐSÐSr   )r   )gñhãˆµøä>)r=   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚintÚfloatr   ÚdictÚstrÚboolÚlistr)   r   r8   r?   Ú__static_attributes__Ú__classcell__©r   s   @r   r   r      s©   ø† ñð ñFàðFð ÷Fð Fð
àð
ð ð
ð ð	
ð
 ð
ð ˜3‘ið
ð ˜c™ð
ð ˜‘I÷
ð$	 ˜ð 	  Fô 	 ðT˜#÷ Tò Tr   r   c                   óö  ^ • \ rS rSrSSSS\R
                  R                  \R
                  R                  SSS\R
                  R                  4
S\	S\	S\
\	\\	S	4   4   S
\
\	\\	S	4   4   S\\
\	\\	S	4   \4      S\	S\\S	\R
                  R                  4      S\\S	\R
                  R                  4      S\
\	\\	S	4   4   S\\   S\\   S\S	\R
                  R                  4   SS4U 4S jjjrSrU =r$ )ÚConvNormActivationéE   é   r/   NTÚin_channelsÚout_channelsÚkernel_size.ÚstrideÚpaddingÚgroupsÚ
norm_layerÚactivation_layerÚdilationÚinplacer   Ú
conv_layerr-   c                 óv  >^^	• Uc˜  [        T[        5      (       a!  [        T	[        5      (       a  TS-
  S-  T	-  nOb[        T[        5      (       a  [        T5      O
[        T	5      n[	        TU5      m[	        T	U5      m	[        U	U4S j[        U5       5       5      nUc  US L nU" UUTUUT	UUS9/nUb  UR                  U" U5      5        Ub   U
c  0 OSU
0nUR                  U" S0 UD65        [        TU ]$  " U6   [        U 5        X l        U R                  [        :X  a  [        R                  " S5        g g )Nr/   r   c              3   óF   >#   • U  H  nTU   S -
  S-  TU   -  v •  M     g7f)r/   r   N© )Ú.0ÚirZ   rT   s     €€r   Ú	<genexpr>Ú.ConvNormActivation.__init__.<locals>.<genexpr>]   s*   øé € ÐbÒQaÈA ¨Q¡°!Ñ!3¸Ñ 9¸HÀQ¹KÖ GÒQaùs   ƒ!)rZ   rW   r   r[   zhDon't use ConvNormActivation directly, please use Conv2dNormActivation and Conv3dNormActivation instead.r_   )Ú
isinstancerE   r   Úlenr
   ÚtupleÚrangeÚappendr   r   r	   rS   r   rO   ÚwarningsÚwarn)r   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r   r\   Ú	_conv_dimÚlayersÚparamsr   s      `     `      €r   r   ÚConvNormActivation.__init__F   s<  ú€ ð  ‰?Ü˜+¤s×+Ñ+´
¸8ÄS×0IÑ0IØ&¨™?¨qÑ0°8Ñ;‘ä0:¸;Ì×0QÑ0QœC Ô,ÔWZÐ[cÓWd�	Ü*¨;¸	ÓB�Ü'¨°)Ó<�ÜÕbÔQVÐW`ÔQaÓbÓb�Ø‰<Ø Ð%ˆDñ ØØØØØØ!ØØñ	ð
ˆð Ñ!Ø�M‰M™* \Ó2Ô3àÑ'Ø"™?‘R°¸GÐ0DˆFØ�M‰MÑ*Ñ4¨VÑ4Ô5Ü‰Ò˜&Ñ!Ü˜DÔ!Ø(Ôà�>‰>Ô/Ó/Ü�MŠMØzõð 0r   )rS   )r=   rA   rB   rC   r   ÚnnÚBatchNorm2dÚReLUÚConv2drE   r   rf   r   rH   r   ÚModulerI   r   rK   rL   rM   s   @r   rO   rO   E   s^  ø† ð
 45Ø./Ø>BØØ?D¿x¹x×?SÑ?SØEJÇXÁXÇ]Á]Ø01Ø"&Ø#Ø5:·X±X·_±_ñ5àð5ð ð5ð ˜3  c¨3 h¡Ð/Ñ0ð	5ð
 �c˜5  c ™?Ð*Ñ+ð5ð ˜%  U¨3°¨8¡_°cÐ 9Ñ:Ñ;ð5ð ð5ð ˜X c¨5¯8©8¯?©?Ð&:Ñ;Ñ<ð5ð # 8¨C°·±·±Ð,@Ñ#AÑBð5ð ˜˜U 3¨ 8™_Ð,Ñ-ð5ð ˜$‘ð5ð �t‰nð5ð ˜S %§(¡(§/¡/Ð1Ñ2ð5ð 
÷5ö 5r   rO   c                   óš  ^ • \ rS rSrSrSSSS\R                  R                  \R                  R                  SSS4	S\	S\	S	\
\	\\	\	4   4   S
\
\	\\	\	4   4   S\\
\	\\	\	4   \4      S\	S\\S\R                  R                  4      S\\S\R                  R                  4      S\
\	\\	\	4   4   S\\   S\\   SS4U 4S jjjrSrU =r$ )ÚConv2dNormActivationé~   a³  
Configurable block used for Convolution2d-Normalization-Activation blocks.

Args:
    in_channels (int): Number of channels in the input image
    out_channels (int): Number of channels produced by the Convolution-Normalization-Activation block
    kernel_size: (int, optional): Size of the convolving kernel. Default: 3
    stride (int, optional): Stride of the convolution. Default: 1
    padding (int, tuple or str, optional): Padding added to all four sides of the input. Default: None, in which case it will be calculated as ``padding = (kernel_size - 1) // 2 * dilation``
    groups (int, optional): Number of blocked connections from input channels to output channels. Default: 1
    norm_layer (Callable[..., torch.nn.Module], optional): Norm layer that will be stacked on top of the convolution layer. If ``None`` this layer won't be used. Default: ``torch.nn.BatchNorm2d``
    activation_layer (Callable[..., torch.nn.Module], optional): Activation function which will be stacked on top of the normalization layer (if not None), otherwise on top of the conv layer. If ``None`` this layer won't be used. Default: ``torch.nn.ReLU``
    dilation (int): Spacing between kernel elements. Default: 1
    inplace (bool): Parameter for the activation layer, which can optionally do the operation in-place. Default ``True``
    bias (bool, optional): Whether to use bias in the convolution layer. By default, biases are included if ``norm_layer is None``.

rQ   r/   NTrR   rS   rT   rU   rV   rW   rX   .rY   rZ   r[   r   r-   c                 ój   >• [         TU ]  UUUUUUUUU	U
U[        R                  R                  5        g ©N)r   r   r   ro   rr   ©r   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r   r   s               €r   r   ÚConv2dNormActivation.__init__‘   ó>   ø€ ô 	‰ÑØØØØØØØØØØØÜ�H‰H�O‰Oõ	
r   r_   )r=   rA   rB   rC   rD   r   ro   rp   rq   rE   r   rf   r   rH   r   rs   rI   r   rK   rL   rM   s   @r   ru   ru   ~   s<  ø† ñð, 45Ø./Ø>BØØ?D¿x¹x×?SÑ?SØEJÇXÁXÇ]Á]Ø01Ø"&Ø#ñ
àð
ð ð
ð ˜3  c¨3 h¡Ð/Ñ0ð	
ð
 �c˜5  c ™?Ð*Ñ+ð
ð ˜%  U¨3°¨8¡_°cÐ 9Ñ:Ñ;ð
ð ð
ð ˜X c¨5¯8©8¯?©?Ð&:Ñ;Ñ<ð
ð # 8¨C°·±·±Ð,@Ñ#AÑBð
ð ˜˜U 3¨ 8™_Ð,Ñ-ð
ð ˜$‘ð
ð �t‰nð
ð 
÷
ö 
r   ru   c                   ó¢  ^ • \ rS rSrSrSSSS\R                  R                  \R                  R                  SSS4	S\	S\	S	\
\	\\	\	\	4   4   S
\
\	\\	\	\	4   4   S\\
\	\\	\	\	4   \4      S\	S\\S\R                  R                  4      S\\S\R                  R                  4      S\
\	\\	\	\	4   4   S\\   S\\   SS4U 4S jjjrSrU =r$ )ÚConv3dNormActivationé°   a³  
Configurable block used for Convolution3d-Normalization-Activation blocks.

Args:
    in_channels (int): Number of channels in the input video.
    out_channels (int): Number of channels produced by the Convolution-Normalization-Activation block
    kernel_size: (int, optional): Size of the convolving kernel. Default: 3
    stride (int, optional): Stride of the convolution. Default: 1
    padding (int, tuple or str, optional): Padding added to all four sides of the input. Default: None, in which case it will be calculated as ``padding = (kernel_size - 1) // 2 * dilation``
    groups (int, optional): Number of blocked connections from input channels to output channels. Default: 1
    norm_layer (Callable[..., torch.nn.Module], optional): Norm layer that will be stacked on top of the convolution layer. If ``None`` this layer won't be used. Default: ``torch.nn.BatchNorm3d``
    activation_layer (Callable[..., torch.nn.Module], optional): Activation function which will be stacked on top of the normalization layer (if not None), otherwise on top of the conv layer. If ``None`` this layer won't be used. Default: ``torch.nn.ReLU``
    dilation (int): Spacing between kernel elements. Default: 1
    inplace (bool): Parameter for the activation layer, which can optionally do the operation in-place. Default ``True``
    bias (bool, optional): Whether to use bias in the convolution layer. By default, biases are included if ``norm_layer is None``.
rQ   r/   NTrR   rS   rT   rU   rV   rW   rX   .rY   rZ   r[   r   r-   c                 ój   >• [         TU ]  UUUUUUUUU	U
U[        R                  R                  5        g rx   )r   r   r   ro   ÚConv3dry   s               €r   r   ÚConv3dNormActivation.__init__Â   r{   r   r_   )r=   rA   rB   rC   rD   r   ro   ÚBatchNorm3drq   rE   r   rf   r   rH   r   rs   rI   r   rK   rL   rM   s   @r   r}   r}   °   sH  ø† ñð* 9:Ø34ØCGØØ?D¿x¹x×?SÑ?SØEJÇXÁXÇ]Á]Ø56Ø"&Ø#ñ
àð
ð ð
ð ˜3  c¨3° mÑ 4Ð4Ñ5ð	
ð
 �c˜5  c¨3 Ñ/Ð/Ñ0ð
ð ˜%  U¨3°°S¨=Ñ%9¸3Ð >Ñ?Ñ@ð
ð ð
ð ˜X c¨5¯8©8¯?©?Ð&:Ñ;Ñ<ð
ð # 8¨C°·±·±Ð,@Ñ#AÑBð
ð ˜˜U 3¨¨S =Ñ1Ð1Ñ2ð
ð ˜$‘ð
ð �t‰nð
ð 
÷
ö 
r   r}   c                   ó$  ^ • \ rS rSrSr\R                  R                  \R                  R                  4S\	S\	S\
S\R                  R                  4   S\
S\R                  R                  4   SS	4
U 4S
 jjjrS\S\4S jrS\S\4S jrSrU =r$ )ÚSqueezeExcitationéá   a%  
This block implements the Squeeze-and-Excitation block from https://arxiv.org/abs/1709.01507 (see Fig. 1).
Parameters ``activation``, and ``scale_activation`` correspond to ``delta`` and ``sigma`` in eq. 3.

Args:
    input_channels (int): Number of channels in the input image
    squeeze_channels (int): Number of squeeze channels
    activation (Callable[..., torch.nn.Module], optional): ``delta`` activation. Default: ``torch.nn.ReLU``
    scale_activation (Callable[..., torch.nn.Module]): ``sigma`` activation. Default: ``torch.nn.Sigmoid``
Úinput_channelsÚsqueeze_channelsÚ
activation.Úscale_activationr-   Nc                 óD  >• [         TU ]  5         [        U 5        [        R                  R                  S5      U l        [        R                  R                  XS5      U l        [        R                  R                  X!S5      U l	        U" 5       U l
        U" 5       U l        g )Nr/   )r   r   r	   r   ro   ÚAdaptiveAvgPool2dÚavgpoolrr   Úfc1Úfc2rˆ   r‰   )r   r†   r‡   rˆ   r‰   r   s        €r   r   ÚSqueezeExcitation.__init__í   so   ø€ ô 	‰ÑÔÜ˜DÔ!Ü—x‘x×1Ñ1°!Ó4ˆŒÜ—8‘8—?‘? >ÀQÓGˆŒÜ—8‘8—?‘?Ð#3ÀQÓGˆŒÙ$›,ˆŒÙ 0Ó 2ˆÕr   Úinputc                 ó¬   • U R                  U5      nU R                  U5      nU R                  U5      nU R                  U5      nU R	                  U5      $ rx   )rŒ   r�   rˆ   rŽ   r‰   ©r   r�   r7   s      r   Ú_scaleÚSqueezeExcitation._scaleü   sI   € Ø—‘˜UÓ#ˆØ—‘˜“ˆØ—‘ Ó&ˆØ—‘˜“ˆØ×$Ñ$ UÓ+Ð+r   c                 ó,   • U R                  U5      nX!-  $ rx   )r“   r’   s      r   r8   ÚSqueezeExcitation.forward  s   € Ø—‘˜EÓ"ˆØ‰}Ðr   )rˆ   rŒ   r�   rŽ   r‰   )r=   rA   rB   rC   rD   r   ro   rq   ÚSigmoidrE   r   rs   r   r   r“   r8   rK   rL   rM   s   @r   r„   r„   á   s«   ø† ñ	ð 6;·X±X·]±]Ø;@¿8¹8×;KÑ;Kñ3àð3ð ð3ð ˜S %§(¡(§/¡/Ð1Ñ2ð	3ð
 # 3¨¯©¯©Ð#7Ñ8ð3ð 
÷3ð 3ð,˜Fð , vô ,ð˜Vð ¨÷ ò r   r„   c                   óþ   ^ • \ rS rSrSrS\R                  R                  SSS4S\S\	\   S\
\S	\R                  R                  4      S
\
\S	\R                  R                  4      S\
\   S\S\4U 4S jjjrSrU =r$ )ÚMLPi  añ  This block implements the multi-layer perceptron (MLP) module.

Args:
    in_channels (int): Number of channels of the input
    hidden_channels (List[int]): List of the hidden channel dimensions
    norm_layer (Callable[..., torch.nn.Module], optional): Norm layer that will be stacked on top of the linear layer. If ``None`` this layer won't be used. Default: ``None``
    activation_layer (Callable[..., torch.nn.Module], optional): Activation function which will be stacked on top of the normalization layer (if not None), otherwise on top of the linear layer. If ``None`` this layer won't be used. Default: ``torch.nn.ReLU``
    inplace (bool, optional): Parameter for the activation layer, which can optionally do the operation in-place.
        Default is ``None``, which uses the respective default values of the ``activation_layer`` and Dropout layer.
    bias (bool): Whether to use bias in the linear layer. Default ``True``
    dropout (float): The probability for the dropout layer. Default: 0.0
NTg        rR   Úhidden_channelsrX   .rY   r[   r   Údropoutc           	      óH  >• Uc  0 OSU0n/ n	Un
US S  H“  nU	R                  [        R                  R                  X«US95        Ub  U	R                  U" U5      5        U	R                  U" S0 UD65        U	R                  [        R                  R                  " U40 UD65        Un
M•     U	R                  [        R                  R                  X¢S   US95        U	R                  [        R                  R                  " U40 UD65        [
        TU ]  " U	6   [        U 5        g )Nr[   r0   )r   r_   )rh   r   ro   ÚLinearÚDropoutr   r   r	   )r   rR   rš   rX   rY   r[   r   r›   rm   rl   Úin_dimÚ
hidden_dimr   s               €r   r   ÚMLP.__init__  s÷   ø€ ð ‘‘¨Y¸Ð,@ˆàˆØˆØ)¨#¨2Ó.ˆJØ�M‰Mœ%Ÿ(™(Ÿ/™/¨&À4˜/ÐHÔIØÑ%Ø—‘™j¨Ó4Ô5Ø�M‰MÑ*Ñ4¨VÑ4Ô5Ø�M‰Mœ%Ÿ(™(×*Ò*¨7Ñ=°fÑ=Ô>ØŠFñ /ð 	�‰”e—h‘h—o‘o f¸bÑ.AÈ�oÐMÔNØ�‰”e—h‘h×&Ò& wÑ9°&Ñ9Ô:ä‰Ò˜&Ñ!Ü˜DÕ!r   r_   )r=   rA   rB   rC   rD   r   ro   rq   rE   rJ   r   r   rs   rI   rF   r   rK   rL   rM   s   @r   r™   r™     s§   ø† ñð" @DØEJÇXÁXÇ]Á]Ø"&ØØñ"àð"ð ˜c™ð"ð ˜X c¨5¯8©8¯?©?Ð&:Ñ;Ñ<ð	"ð
 # 8¨C°·±·±Ð,@Ñ#AÑBð"ð ˜$‘ð"ð ð"ð ÷"ö "r   r™   c                   óL   ^ • \ rS rSrSrS\\   4U 4S jjrS\S\4S jr	Sr
U =r$ )	ÚPermutei5  z�This module returns a view of the tensor input with its dimensions permuted.

Args:
    dims (List[int]): The desired ordering of dimensions
Údimsc                 ó.   >• [         TU ]  5         Xl        g rx   )r   r   r¤   )r   r¤   r   s     €r   r   ÚPermute.__init__<  s   ø€ Ü‰ÑÔØ�	r   r,   r-   c                 óB   • [         R                  " XR                  5      $ rx   )r   Úpermuter¤   )r   r,   s     r   r8   ÚPermute.forward@  s   € Ü�}Š}˜Q§	¡	Ó*Ð*r   )r¤   )r=   rA   rB   rC   rD   rJ   rE   r   r   r8   rK   rL   rM   s   @r   r£   r£   5  s0   ø† ñð˜T #™Y÷ ð+˜ð + F÷ +ò +r   r£   )ri   Úcollections.abcr   Útypingr   r   r   r   r   Úutilsr	   r
   ro   Ú
functionalÚinterpolaters   r   Ú
SequentialrO   ru   r}   r„   r™   r£   r_   r   r   Ú<module>r°      s»   ðÛ Ý $ß ,Ñ ,ã Ý ç 5ð �h‰h×!Ñ!×-Ñ-€ô4T˜Ÿ™Ÿ™ô 4Tôn6˜Ÿ™×,Ñ,ô 6ôr/
Ð-ô /
ôd.
Ð-ô .
ôb$˜Ÿ™Ÿ™ô $ôN*"ˆ%�(‰(×
Ñ
ô *"ôZ+ˆe�h‰h�o‰oõ +r   