Ë
    éÓ^jÃ  ã                   ó˜   — d dl Z d dl mZ 	 d dlmZmZ dZdd	lmZ e G d
„ dej                  «      «       Z
y# e$ r dZ	 dd„Zd„ ZY Œ2w xY w)é    N)Únn)Úinplace_abnÚinplace_abn_syncTFc
                 ó   — t        d«      ‚)Nz`Please install InplaceABN:'pip install git+https://github.com/mapillary/inplace_abn.git@v1.0.12')ÚImportError)
ÚxÚweightÚbiasÚrunning_meanÚrunning_varÚtrainingÚmomentumÚepsÚ
activationÚactivation_params
             úb/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/timm/layers/inplace_abn.pyr   r   
   s   € äØnópð 	pó    c                  ó   — t        di | ¤Ž y )N© )r   )Úkwargss    r   r   r      s   € ÜÑ�fÓr   é   )Úregister_notrace_modulec                   ó>   ‡ — e Zd ZdZ	 	 	 	 	 	 	 dˆ fd„	Zd„ Zd„ Zˆ xZS )Ú
InplaceAbna   Activated Batch Normalization

    This gathers a BatchNorm and an activation function in a single module

    Parameters
    ----------
    num_features : int
        Number of feature channels in the input and output.
    eps : float
        Small constant to prevent numerical issues.
    momentum : float
        Momentum factor applied to compute running statistics.
    affine : bool
        If `True` apply learned scale and shift transformation after normalization.
    act_layer : str or nn.Module type
        Name or type of the activation functions, one of: `leaky_relu`, `elu`
    act_param : float
        Negative slope for the `leaky_relu` activation.
    c	                 óX  •— t         ‰	| �  «        || _        || _        || _        || _        |rŠt        |t        «      r|dv sJ ‚|r|nd| _        no|t        j                  k(  rd| _        nT|t        j                  k(  rd| _        n9|�|t        j                  k(  rd| _        nJ d|j                  › d�«       ‚d| _        || _        | j                  r[t        j                  t!        j"                  |«      «      | _        t        j                  t!        j&                  |«      «      | _        n$| j+                  dd «       | j+                  dd «       | j-                  d	t!        j&                  |«      «       | j-                  d
t!        j"                  |«      «       | j/                  «        y )N)Ú
leaky_reluÚeluÚidentityÚ r   r   r   zInvalid act layer z	 for IABNr	   r
   r   r   )ÚsuperÚ__init__Únum_featuresÚaffiner   r   Ú
isinstanceÚstrÚact_namer   ÚELUÚ	LeakyReLUÚIdentityÚ__name__Ú	act_paramÚ	ParameterÚtorchÚonesr	   Úzerosr
   Úregister_parameterÚregister_bufferÚreset_parameters)
Úselfr"   r   r   r#   Ú	apply_actÚ	act_layerr+   Ú
drop_layerÚ	__class__s
            €r   r!   zInplaceAbn.__init__+   sT  ø€ ô 	‰ÑÔØ(ˆÔØˆŒØˆŒØ ˆŒÙÜ˜)¤SÔ)Ø Ð$IÑIÐIÐIÙ-6¡	¸J�•ð ¤§¡Ò&Ø$)�D•MØ¤"§,¡,Ò.Ø$0�D•MØÐ&¨)´r·{±{Ò*BØ$.�D•MàTÐ$6°y×7IÑ7IÐ6JÈ)Ð"TÓT˜5à&ˆDŒMØ"ˆŒØ�;Š;ÜŸ,™,¤u§z¡z°,Ó'?Ó@ˆDŒKÜŸ™¤U§[¡[°Ó%>Ó?ˆD�Ià×#Ñ# H¨dÔ3Ø×#Ñ# F¨DÔ1Ø×Ñ˜^¬U¯[©[¸Ó-FÔGØ×Ñ˜]¬E¯J©J°|Ó,DÔEØ×ÑÕr   c                 ón  — t         j                  j                  | j                  d«       t         j                  j                  | j                  d«       | j
                  rUt         j                  j                  | j                  d«       t         j                  j                  | j                  d«       y y )Nr   r   )r   ÚinitÚ	constant_r   r   r#   r	   r
   )r3   s    r   r2   zInplaceAbn.reset_parametersV   sr   € Ü
�‰×Ñ˜$×+Ñ+¨QÔ/Ü
�‰×Ñ˜$×*Ñ*¨AÔ.Ø�;Š;Ü�G‰G×Ñ˜dŸk™k¨1Ô-Ü�G‰G×Ñ˜dŸi™i¨Õ+ð r   c                 ó  — t        || j                  | j                  | j                  | j                  | j
                  | j                  | j                  | j                  | j                  «
      }t        |t        «      r|d   }|S )Nr   )r   r	   r
   r   r   r   r   r   r&   r+   r$   Útuple)r3   r   Úoutputs      r   ÚforwardzInplaceAbn.forward]   se   € ÜØˆt�{‰{˜DŸI™I t×'8Ñ'8¸$×:JÑ:JØ�M‰M˜4Ÿ=™=¨$¯(©(°D·M±MÀ4Ç>Á>óSˆô �fœeÔ$Ø˜A‘YˆFØˆr   )çñhãˆµøä>çš™™™™™¹?TTr   ç{®Gáz„?N)r*   Ú
__module__Ú__qualname__Ú__doc__r!   r2   r>   Ú__classcell__)r7   s   @r   r   r      s/   ø„ ñð. ØØØØ"ØØõ) òV,ör   r   )Tr@   r?   r   rA   )r-   r   Úinplace_abn.functionsr   r   Úhas_iabnr   Ú_fxr   ÚModuler   r   r   r   ú<module>rJ      sg   ðÛ Ý ðßCØ€Hõ )ð ôM�—‘ó Mó ñMøð ò 	Ø€Hð gkópô
ð	ús   Œ
7 ·A	ÁA	