
    ڧgR                     @	   U d dl Z d dlZd dlmZ d dlmZ d dlmZmZm	Z	m
Z
mZmZmZmZ d dlZd dlmZmZ d dlmZ ddlmZmZ dd	lmZmZ dd
lmZ ddlmZmZmZ ddl m!Z! ddl"m#Z#m$Z$m%Z% g dZ&e G d d                      Z' G d de'          Z( G d de'          Z) G d dej*                  Z+ G d dej*                  Z, G d dej*                  Z-deee(e)f                  de.dee/         dee         d e0d!ed"e-fd#Z1d$e2d!ed"eeee(e)f                  ee/         f         fd%Z3d&e!iZ4e	e2ef         e5d'<   i e4d(d)d*Z6i e4d+d,d*Z7 G d- d.e          Z8 G d/ d0e          Z9 G d1 d2e          Z: G d3 d4e          Z; G d5 d6e          Z< G d7 d8e          Z= G d9 d:e          Z> G d; d<e          Z? G d= d>e          Z@ G d? d@e          ZA G dA dBe          ZB e             e%dCe8jC        fD          ddEdFdee8         d e0d!ed"e-fdG                        ZD e             e%dCe9jC        fD          ddEdFdee9         d e0d!ed"e-fdH                        ZE e             e%dCe:jC        fD          ddEdFdee:         d e0d!ed"e-fdI                        ZF e             e%dCe;jC        fD          ddEdFdee;         d e0d!ed"e-fdJ                        ZG e             e%dCe<jC        fD          ddEdFdee<         d e0d!ed"e-fdK                        ZH e             e%dCe=jC        fD          ddEdFdee=         d e0d!ed"e-fdL                        ZI e             e%dCe>jC        fD          ddEdFdee>         d e0d!ed"e-fdM                        ZJ e             e%dCe?jC        fD          ddEdFdee?         d e0d!ed"e-fdN                        ZK e             e%dCe@jC        fD          ddEdFdee@         d e0d!ed"e-fdO                        ZL e             e%dCeAjC        fD          ddEdFdeeA         d e0d!ed"e-fdP                        ZM e             e%dCeBjC        fD          ddEdFdeeB         d e0d!ed"e-fdQ                        ZNdS )R    N)	dataclass)partial)AnyCallableDictListOptionalSequenceTupleUnion)nnTensor)StochasticDepth   )Conv2dNormActivationSqueezeExcitation)ImageClassificationInterpolationMode)_log_api_usage_once   )register_modelWeightsWeightsEnum)_IMAGENET_CATEGORIES)_make_divisible_ovewrite_named_paramhandle_legacy_interface)EfficientNetEfficientNet_B0_WeightsEfficientNet_B1_WeightsEfficientNet_B2_WeightsEfficientNet_B3_WeightsEfficientNet_B4_WeightsEfficientNet_B5_WeightsEfficientNet_B6_WeightsEfficientNet_B7_WeightsEfficientNet_V2_S_WeightsEfficientNet_V2_M_WeightsEfficientNet_V2_L_Weightsefficientnet_b0efficientnet_b1efficientnet_b2efficientnet_b3efficientnet_b4efficientnet_b5efficientnet_b6efficientnet_b7efficientnet_v2_sefficientnet_v2_mefficientnet_v2_lc            
           e Zd ZU eed<   eed<   eed<   eed<   eed<   eed<   edej        f         ed<   e	dd
edede
e         defd            Zd	S )_MBConvConfigexpand_ratiokernelstrideinput_channelsout_channels
num_layers.blockNchannels
width_mult	min_valuereturnc                 *    t          | |z  d|          S )N   )r   )r>   r?   r@   s      [/var/www/html/ai-engine/env/lib/python3.11/site-packages/torchvision/models/efficientnet.pyadjust_channelsz_MBConvConfig.adjust_channels8   s    x*4aCCC    N)__name__
__module____qualname__float__annotations__intr   r   Modulestaticmethodr	   rE    rF   rD   r6   r6   .   s         KKKKKKOOOCN####D D# D5 DXc] D^a D D D \D D DrF   r6   c                        e Zd Z	 	 	 ddedededededed	ed
edeedej        f                  ddf fdZ	e
ded
efd            Z xZS )MBConvConfig      ?Nr7   r8   r9   r:   r;   r<   r?   
depth_multr=   .rA   c
           	          |                      ||          }|                      ||          }|                     ||          }|	t          }	t                                          |||||||	           d S rG   )rE   adjust_depthMBConvsuper__init__)selfr7   r8   r9   r:   r;   r<   r?   rT   r=   	__class__s             rD   rY   zMBConvConfig.__init__?   sz     --njII++L*EE&&z:>>
=Evv~|U_afgggggrF   c                 J    t          t          j        | |z                      S rG   )rM   mathceil)r<   rT   s     rD   rV   zMBConvConfig.adjust_depthR   s    49Z*455666rF   )rS   rS   N)rH   rI   rJ   rK   rM   r	   r   r   rN   rY   rO   rV   __classcell__r[   s   @rD   rR   rR   =   s          48h hh h 	h
 h h h h h bi01h 
h h h h h h& 7 7% 7 7 7 \7 7 7 7 7rF   rR   c                   j     e Zd Z	 ddededededededeed	ej        f                  d
df fdZ	 xZ
S )FusedMBConvConfigNr7   r8   r9   r:   r;   r<   r=   .rA   c           	      h    |t           }t                                          |||||||           d S rG   )FusedMBConvrX   rY   )	rZ   r7   r8   r9   r:   r;   r<   r=   r[   s	           rD   rY   zFusedMBConvConfig.__init__Y   s;     =Evv~|U_afgggggrF   rG   )rH   rI   rJ   rK   rM   r	   r   r   rN   rY   r_   r`   s   @rD   rb   rb   W   s         59h hh h 	h
 h h h bi01h 
h h h h h h h h h hrF   rb   c                   |     e Zd Zefdedededej        f         dedej        f         ddf
 fdZ	d	e
de
fd
Z xZS )rW   cnfstochastic_depth_prob
norm_layer.se_layerrA   Nc                 b   t                                                       d|j        cxk    rdk    sn t          d          |j        dk    o|j        |j        k    | _        g }t          j        }|	                    |j        |j
                  }||j        k    r,|                    t          |j        |d||                     |                    t          |||j        |j        |||                     t          d|j        dz            }|                     |||t          t          j        d          	                     |                    t          ||j        d|d                      t          j        | | _        t%          |d
          | _        |j        | _        d S )Nr   r   illegal stride valuekernel_sizerh   activation_layer)rm   r9   groupsrh   rn      T)inplace)
activationrow)rX   rY   r9   
ValueErrorr:   r;   use_res_connectr   SiLUrE   r7   appendr   r8   maxr   
Sequentialr=   r   stochastic_depth)
rZ   rf   rg   rh   ri   layersrn   expanded_channelssqueeze_channelsr[   s
            rD   rY   zMBConv.__init__i   s    	SZ$$$$1$$$$3444"zQY33EIY3Y"$7  //0BCDTUU 222MM$&% !)%5     	 !!Jz(%!1  
	
 
	
 
	
 q#"4"9::hh02BwWYW^hlOmOmOmnnnooo 	 !3#3zlp  	
 	
 	
 ]F+
 /0Eu M M,rF   inputc                 r    |                      |          }| j        r|                     |          }||z  }|S rG   r=   ru   rz   rZ   r~   results      rD   forwardzMBConv.forward   ?    E"" 	**622FeOFrF   )rH   rI   rJ   r   rR   rK   r   r   rN   rY   r   r   r_   r`   s   @rD   rW   rW   h   s         .?8- 8-8-  %8- S")^,	8-
 3	>*8- 
8- 8- 8- 8- 8- 8-tV         rF   rW   c                   Z     e Zd Zdedededej        f         ddf fdZde	de	fd	Z
 xZS )
rd   rf   rg   rh   .rA   Nc           
         t                                                       d|j        cxk    rdk    sn t          d          |j        dk    o|j        |j        k    | _        g }t          j        }|	                    |j        |j
                  }||j        k    rd|                    t          |j        ||j        |j        ||                     |                    t          ||j        d|d                      n<|                    t          |j        |j        |j        |j        ||                     t          j        | | _        t!          |d          | _        |j        | _        d S )Nr   r   rk   rm   r9   rh   rn   rl   rs   )rX   rY   r9   rt   r:   r;   ru   r   rv   rE   r7   rw   r   r8   ry   r=   r   rz   )rZ   rf   rg   rh   r{   rn   r|   r[   s          rD   rY   zFusedMBConv.__init__   s    	SZ$$$$1$$$$3444"zQY33EIY3Y"$7//0BCDTUU 222MM$&% #
:)%5  	 	 	 MM$%s'7QS]pt      MM$&$ #
:)%5  	 	 	 ]F+
 /0Eu M M,rF   r~   c                 r    |                      |          }| j        r|                     |          }||z  }|S rG   r   r   s      rD   r   zFusedMBConv.forward   r   rF   )rH   rI   rJ   rb   rK   r   r   rN   rY   r   r   r_   r`   s   @rD   rd   rd      s        2-2-  %2- S")^,	2-
 
2- 2- 2- 2- 2- 2-hV         rF   rd   c                        e Zd Z	 	 	 	 ddeeeef                  dededede	e
d	ej        f                  d
e	e         ddf fdZdedefdZdedefdZ xZS )r   皙?  Ninverted_residual_settingdropoutrg   num_classesrh   .last_channelrA   c           
         t                                                       t          |            |st          d          t	          |t
                    rt          d |D                       st          d          |t          j	        }g }|d         j
        }|                    t          d|dd|t          j                             t          d	 |D                       }	d}
|D ]}g }t          |j                  D ]o}t#          j        |          }|r|j        |_
        d
|_        |t)          |
          z  |	z  }|                    |                    |||                     |
d
z  }
p|                    t          j        |            |d         j        }||nd|z  }|                    t          ||d
|t          j                             t          j        | | _        t          j        d
          | _        t          j        t          j        |d          t          j        ||                    | _        |                                 D ]_}t	          |t          j                  rRt          j                             |j!        d           |j"        $t          j        #                    |j"                   ot	          |t          j	        t          j$        f          rIt          j        %                    |j!                   t          j        #                    |j"                   t	          |t          j                  rgdtM          j'        |j(                  z  }t          j        )                    |j!        | |           t          j        #                    |j"                   adS )a  
        EfficientNet V1 and V2 main class

        Args:
            inverted_residual_setting (Sequence[Union[MBConvConfig, FusedMBConvConfig]]): Network structure
            dropout (float): The droupout probability
            stochastic_depth_prob (float): The stochastic depth probability
            num_classes (int): Number of classes
            norm_layer (Optional[Callable[..., nn.Module]]): Module specifying the normalization layer to use
            last_channel (int): The number of channels on the penultimate layer
        z1The inverted_residual_setting should not be emptyc                 8    g | ]}t          |t                    S rP   )
isinstancer6   ).0ss     rD   
<listcomp>z)EfficientNet.__init__.<locals>.<listcomp>  s"    UUUaZ=11UUUrF   z:The inverted_residual_setting should be List[MBConvConfig]Nr      r   r   c              3   $   K   | ]}|j         V  d S rG   )r<   )r   rf   s     rD   	<genexpr>z(EfficientNet.__init__.<locals>.<genexpr>  s$       U UC U U U U U UrF   r   rp   rl   T)prq   fan_out)moderS   )*rX   rY   r   rt   r   r
   all	TypeErrorr   BatchNorm2dr:   rw   r   rv   sumranger<   copyr;   r9   rK   r=   ry   featuresAdaptiveAvgPool2davgpoolDropoutLinear
classifiermodulesConv2dinitkaiming_normal_weightbiaszeros_	GroupNormones_r]   sqrtout_featuresuniform_)rZ   r   r   rg   r   rh   r   r{   firstconv_output_channelstotal_stage_blocksstage_block_idrf   stage_	block_cnfsd_problastconv_input_channelslastconv_output_channelsm
init_ranger[   s                       rD   rY   zEfficientNet.__init__   s   ( 	D!!!( 	ZPQQQ0(;;	ZUU;TUUUVV	Z XYYYJ"$ %>a$@$O! ,!AR\oqov  	
 	
 	
 ! U U;T U U UUU, 	1 	1C%'E3>** $ $ IcNN	  )/8/EI,'(I$ 0%2G2GGJ\\Y__YLLMMM!#MM"-/0000 #<B"?"L3?3K<<QRUlQl  '(%!#  	
 	
 	
 v.+A..-J$///I.<<
 

  	' 	'A!RY'' 
'''y'AAA6%GNN16***A=>> 'ah'''qv&&&&Ary)) ' 49Q^#<#<<
  J;
CCCqv&&&	' 	'rF   xc                     |                      |          }|                     |          }t          j        |d          }|                     |          }|S )Nr   )r   r   torchflattenr   rZ   r   s     rD   _forward_implzEfficientNet._forward_implL  sI    MM!LLOOM!QOOArF   c                 ,    |                      |          S rG   )r   r   s     rD   r   zEfficientNet.forwardV  s    !!!$$$rF   )r   r   NN)rH   rI   rJ   r
   r   rR   rb   rK   rM   r	   r   r   rN   rY   r   r   r   r_   r`   s   @rD   r   r      s       
 (+9=&*a' a'#+E,@Q2Q,R#Sa' a'  %	a'
 a' Xc29n56a' sma' 
a' a' a' a' a' a'Fv &    % %F % % % % % % % %rF   r   r   r   r   weightsprogresskwargsrA   c                     |)t          |dt          |j        d                              t          | |fd|i|}|*|                    |                    |d                     |S )Nr   
categoriesr   T)r   
check_hash)r   lenmetar   load_state_dictget_state_dict)r   r   r   r   r   r   models          rD   _efficientnetr   Z  s|     fmSl9S5T5TUUU2Gaa,aZ`aaEg44hSW4XXYYYLrF   archc                 F   |                      d          rt          t          |                    d          |                    d                    } |dddddd           |d	dd
ddd
           |d	dd
ddd
           |d	dd
ddd           |d	ddddd           |d	dd
ddd           |d	ddddd          g}d }n|                      d          rxt	          dddddd
          t	          ddd
ddd          t	          ddd
ddd          t          ddd
ddd	          t          d	ddddd          t          d	dd
ddd          g}d}nP|                      d          rt	          dddddd          t	          ddd
ddd          t	          ddd
ddd          t          ddd
ddd          t          d	ddddd          t          d	dd
dd d!          t          d	ddd d"d          g}d}n|                      d#          rt	          dddddd          t	          ddd
ddd          t	          ddd
dd$d          t          ddd
d$dd%          t          d	dddd&d'          t          d	dd
d&d(d)          t          d	ddd(d*d          g}d}nt          d+|            ||fS ),Nefficientnet_br?   rT   r?   rT   r   r             r         (   P   p      rp   @  r2   0   @         	         i   r3            i0     i   r4   `   
              i  zUnsupported model type )
startswithr   rR   poprb   rt   )r   r   
bneck_confr   r   s        rD   _efficientnet_confr   m  s3   
 '(( -;\fjj6N6N[a[e[efr[s[sttt
Jq!QB**Jq!QB**Jq!QB**Jq!QB**Jq!QC++Jq!QS!,,Jq!QS!,,%
! 	,	-	- !;aAr2q11aAr2q11aAr2q11Aq"c1--Aq#sA..Aq#sB//%
! 	,	-	- ;aAr2q11aAr2q11aAr2q11Aq"c1--Aq#sB//Aq#sB//Aq#sA..%
! 	,	-	- ;aAr2q11aAr2q11aAr2q11Aq"c2..Aq#sB//Aq#sB//Aq#sA..%
! 9499:::$l22rF   r   _COMMON_META)r   r   zUhttps://github.com/pytorch/vision/tree/main/references/classification#efficientnet-v1)min_sizerecipe)!   r   zUhttps://github.com/pytorch/vision/tree/main/references/classification#efficientnet-v2c                   p    e Zd Z ed eeddej                  i eddddd	id
ddd          Z	e	Z
dS )r   zJhttps://download.pytorch.org/models/efficientnet_b0_rwightman-7f5810bc.pthr   r   	crop_sizeresize_sizeinterpolationidP ImageNet-1Kg?5^IlS@g5^IbW@zacc@1zacc@5gNbX9?g~jts4@1These weights are ported from the original paper.
num_params_metrics_ops
_file_size_docsurl
transformsr   NrH   rI   rJ   r   r   r   r   BICUBIC_COMMON_META_V1IMAGENET1K_V1DEFAULTrP   rF   rD   r   r             GX73CO`Oh
 
 


!##     L
 
 
  M( GGGrF   r   c                       e Zd Z ed eeddej                  i eddddd	id
ddd          Z	 ed eeddej
                  i edddddd	id
ddd          ZeZdS )r    zJhttps://download.pytorch.org/models/efficientnet_b1_rwightman-bac287d4.pth   r   r   iv r   g+S@gClW@r   gCl?gM">@r  r  r  z@https://download.pytorch.org/models/efficientnet_b1-c27df63c.pth   zOhttps://github.com/pytorch/vision/issues/3995#new-recipe-with-lr-wd-crop-tuninggʡS@gƻW@gA`">@$  
                These weights improve upon the results of the original paper by using a modified version of TorchVision's
                `new training recipe
                <https://pytorch.org/blog/how-to-train-state-of-the-art-models-using-torchvision-latest-primitives/>`_.
            )r  r   r  r  r  r  N)rH   rI   rJ   r   r   r   r   r  r  r  BILINEARIMAGENET1K_V2r  rP   rF   rD   r    r      s       GX73CO`Oh
 
 


!##     L
 
 
  M( GN73CO`Oi
 
 


!g##     
 
 
  M0 GGGrF   r    c                   p    e Zd Z ed eeddej                  i edddddid	d
dd          Z	e	Z
dS )r!   zJhttps://download.pytorch.org/models/efficientnet_b2_rwightman-c35c1473.pthi   r   i r   gx&T@gp=
W@r   g rh?gʡEA@r  r  r  Nr  rP   rF   rD   r!   r!     r  rF   r!   c                   p    e Zd Z ed eeddej                  i eddddd	id
ddd          Z	e	Z
dS )r"   zJhttps://download.pytorch.org/models/efficientnet_b3_rwightman-b3899882.pthi,  r   r   i r   gnT@g~jtX@r   gZd;?gd;OG@r  r  r  Nr  rP   rF   rD   r"   r"             GX73CO`Oh
 
 


"##     L
 
 
  M( GGGrF   r"   c                   p    e Zd Z ed eeddej                  i eddddd	id
ddd          Z	e	Z
dS )r#   zJhttps://download.pytorch.org/models/efficientnet_b4_rwightman-23ab8bcd.pthi|  r   r   i0!'r   gjtT@gt&X@r   g~jt@gKR@r  r  r  Nr  rP   rF   rD   r#   r#   /  r  rF   r#   c                   p    e Zd Z ed eeddej                  i edddddid	d
dd          Z	e	Z
dS )r$   zJhttps://download.pytorch.org/models/efficientnet_b5_lukemelas-1a07897c.pthi  r   ir   g#~jT@gx&1(X@r   gx&1$@gK7]@r  r  r  Nr  rP   rF   rD   r$   r$   G          GX73CO`Oh
 
 


"##    !L
 
 
  M( GGGrF   r$   c                   p    e Zd Z ed eeddej                  i edddddid	d
dd          Z	e	Z
dS )r%   zJhttps://download.pytorch.org/models/efficientnet_b6_lukemelas-24a108a5.pthi  r   ir   gn U@gv:X@r   g rh3@g$d@r  r  r  Nr  rP   rF   rD   r%   r%   _  r  rF   r%   c                   p    e Zd Z ed eeddej                  i edddddid	d
dd          Z	e	Z
dS )r&   zJhttps://download.pytorch.org/models/efficientnet_b7_lukemelas-c5b4e57e.pthiX  r   icr   g+U@g'1:X@r   gsh|B@go@r  r  r  Nr  rP   rF   rD   r&   r&   w  r  rF   r&   c                   p    e Zd Z ed eeddej                  i edddddid	d
dd          Z	e	Z
dS )r'   zBhttps://download.pytorch.org/models/efficientnet_v2_s-dd5fe13b.pthr   r   i8nGr   g;OU@gx&18X@r   gZd @gVT@r  r  r  NrH   rI   rJ   r   r   r   r   r  _COMMON_META_V2r  r  rP   rF   rD   r'   r'     s        GP7+4	
 
 


"##     
 
 
  M4 GGGrF   r'   c                   p    e Zd Z ed eeddej                  i edddddid	d
dd          Z	e	Z
dS )r(   zBhttps://download.pytorch.org/models/efficientnet_v2_m-dc08266a.pth  r   i:r   gI+GU@gDlIX@r   gE8@gQ j@r  r  r  Nr   rP   rF   rD   r(   r(     s        GP7+4	
 
 


"##     
 
 
  M4 GGGrF   r(   c                   t    e Zd Z ed eeddej        dd          i eddddd	id
ddd          Z	e	Z
dS )r)   zBhttps://download.pytorch.org/models/efficientnet_v2_l-59c71312.pthr#  )      ?r%  r%  )r   r   r   meanstdiHfr   gʡEsU@gOnrX@r   g
ףp=
L@gI+i|@r  r  r  N)rH   rI   rJ   r   r   r   r   r  r!  r  r  rP   rF   rD   r)   r)     s        GP7+3 
 
 


###    !L
 
 
  M0 GGGrF   r)   
pretrained)r   T)r   r   c                     t                               |           } t          ddd          \  }}t          ||                    dd          || |fi |S )a  EfficientNet B0 model architecture from the `EfficientNet: Rethinking Model Scaling for Convolutional
    Neural Networks <https://arxiv.org/abs/1905.11946>`_ paper.

    Args:
        weights (:class:`~torchvision.models.EfficientNet_B0_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.EfficientNet_B0_Weights` below for
            more details, and possible values. By default, no pre-trained
            weights are used.
        progress (bool, optional): If True, displays a progress bar of the
            download to stderr. Default is True.
        **kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
            for more details about this class.
    .. autoclass:: torchvision.models.EfficientNet_B0_Weights
        :members:
    r*   rS   r   r   r   )r   verifyr   r   r   r   r   r   r   r   s        rD   r*   r*     m    . &,,W55G.@AR_bor.s.s.s+|!6::i#=#=|WV^ bh  rF   c                     t                               |           } t          ddd          \  }}t          ||                    dd          || |fi |S )a  EfficientNet B1 model architecture from the `EfficientNet: Rethinking Model Scaling for Convolutional
    Neural Networks <https://arxiv.org/abs/1905.11946>`_ paper.

    Args:
        weights (:class:`~torchvision.models.EfficientNet_B1_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.EfficientNet_B1_Weights` below for
            more details, and possible values. By default, no pre-trained
            weights are used.
        progress (bool, optional): If True, displays a progress bar of the
            download to stderr. Default is True.
        **kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
            for more details about this class.
    .. autoclass:: torchvision.models.EfficientNet_B1_Weights
        :members:
    r+   rS   皙?r   r   r   )r    r*  r   r   r   r+  s        rD   r+   r+     r,  rF   c                     t                               |           } t          ddd          \  }}t          ||                    dd          || |fi |S )a  EfficientNet B2 model architecture from the `EfficientNet: Rethinking Model Scaling for Convolutional
    Neural Networks <https://arxiv.org/abs/1905.11946>`_ paper.

    Args:
        weights (:class:`~torchvision.models.EfficientNet_B2_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.EfficientNet_B2_Weights` below for
            more details, and possible values. By default, no pre-trained
            weights are used.
        progress (bool, optional): If True, displays a progress bar of the
            download to stderr. Default is True.
        **kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
            for more details about this class.
    .. autoclass:: torchvision.models.EfficientNet_B2_Weights
        :members:
    r,   r.  333333?r   r   333333?)r!   r*  r   r   r   r+  s        rD   r,   r,   &  r,  rF   c                     t                               |           } t          ddd          \  }}t          ||                    dd          || |fi |S )a  EfficientNet B3 model architecture from the `EfficientNet: Rethinking Model Scaling for Convolutional
    Neural Networks <https://arxiv.org/abs/1905.11946>`_ paper.

    Args:
        weights (:class:`~torchvision.models.EfficientNet_B3_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.EfficientNet_B3_Weights` below for
            more details, and possible values. By default, no pre-trained
            weights are used.
        progress (bool, optional): If True, displays a progress bar of the
            download to stderr. Default is True.
        **kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
            for more details about this class.
    .. autoclass:: torchvision.models.EfficientNet_B3_Weights
        :members:
    r-   r0  ffffff?r   r   r1  )r"   r*  r   r   r   r+  s        rD   r-   r-   E  r    . &,,W55G.@AR_bor.s.s.s+|!

9c""    rF   c                     t                               |           } t          ddd          \  }}t          ||                    dd          || |fi |S )a  EfficientNet B4 model architecture from the `EfficientNet: Rethinking Model Scaling for Convolutional
    Neural Networks <https://arxiv.org/abs/1905.11946>`_ paper.

    Args:
        weights (:class:`~torchvision.models.EfficientNet_B4_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.EfficientNet_B4_Weights` below for
            more details, and possible values. By default, no pre-trained
            weights are used.
        progress (bool, optional): If True, displays a progress bar of the
            download to stderr. Default is True.
        **kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
            for more details about this class.
    .. autoclass:: torchvision.models.EfficientNet_B4_Weights
        :members:
    r.   r3  ?r   r   皙?)r#   r*  r   r   r   r+  s        rD   r.   r.   i  r4  rF   c           	          t                               |           } t          ddd          \  }}t          ||                    dd          || |fdt          t          j        dd	
          i|S )a  EfficientNet B5 model architecture from the `EfficientNet: Rethinking Model Scaling for Convolutional
    Neural Networks <https://arxiv.org/abs/1905.11946>`_ paper.

    Args:
        weights (:class:`~torchvision.models.EfficientNet_B5_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.EfficientNet_B5_Weights` below for
            more details, and possible values. By default, no pre-trained
            weights are used.
        progress (bool, optional): If True, displays a progress bar of the
            download to stderr. Default is True.
        **kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
            for more details about this class.
    .. autoclass:: torchvision.models.EfficientNet_B5_Weights
        :members:
    r/   g?g@r   r   r7  rh   MbP?{Gz?epsmomentum)r$   r*  r   r   r   r   r   r   r+  s        rD   r/   r/         . &,,W55G.@AR_bor.s.s.s+|!

9c""  2>utDDD   rF   c           	          t                               |           } t          ddd          \  }}t          ||                    dd          || |fdt          t          j        dd	
          i|S )a  EfficientNet B6 model architecture from the `EfficientNet: Rethinking Model Scaling for Convolutional
    Neural Networks <https://arxiv.org/abs/1905.11946>`_ paper.

    Args:
        weights (:class:`~torchvision.models.EfficientNet_B6_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.EfficientNet_B6_Weights` below for
            more details, and possible values. By default, no pre-trained
            weights are used.
        progress (bool, optional): If True, displays a progress bar of the
            download to stderr. Default is True.
        **kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
            for more details about this class.
    .. autoclass:: torchvision.models.EfficientNet_B6_Weights
        :members:
    r0   r6  g@r   r   r%  rh   r9  r:  r;  )r%   r*  r   r   r   r   r   r   r+  s        rD   r0   r0     r>  rF   c           	          t                               |           } t          ddd          \  }}t          ||                    dd          || |fdt          t          j        dd	
          i|S )a  EfficientNet B7 model architecture from the `EfficientNet: Rethinking Model Scaling for Convolutional
    Neural Networks <https://arxiv.org/abs/1905.11946>`_ paper.

    Args:
        weights (:class:`~torchvision.models.EfficientNet_B7_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.EfficientNet_B7_Weights` below for
            more details, and possible values. By default, no pre-trained
            weights are used.
        progress (bool, optional): If True, displays a progress bar of the
            download to stderr. Default is True.
        **kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
            for more details about this class.
    .. autoclass:: torchvision.models.EfficientNet_B7_Weights
        :members:
    r1   g       @g@r   r   r%  rh   r9  r:  r;  )r&   r*  r   r   r   r   r   r   r+  s        rD   r1   r1     r>  rF   c                     t                               |           } t          d          \  }}t          ||                    dd          || |fdt          t          j        d          i|S )a  
    Constructs an EfficientNetV2-S architecture from
    `EfficientNetV2: Smaller Models and Faster Training <https://arxiv.org/abs/2104.00298>`_.

    Args:
        weights (:class:`~torchvision.models.EfficientNet_V2_S_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.EfficientNet_V2_S_Weights` below for
            more details, and possible values. By default, no pre-trained
            weights are used.
        progress (bool, optional): If True, displays a progress bar of the
            download to stderr. Default is True.
        **kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
            for more details about this class.
    .. autoclass:: torchvision.models.EfficientNet_V2_S_Weights
        :members:
    r2   r   r   rh   r9  r<  )r'   r*  r   r   r   r   r   r   r+  s        rD   r2   r2         0 (..w77G.@AT.U.U+|!

9c""  2>u555   rF   c                     t                               |           } t          d          \  }}t          ||                    dd          || |fdt          t          j        d          i|S )a  
    Constructs an EfficientNetV2-M architecture from
    `EfficientNetV2: Smaller Models and Faster Training <https://arxiv.org/abs/2104.00298>`_.

    Args:
        weights (:class:`~torchvision.models.EfficientNet_V2_M_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.EfficientNet_V2_M_Weights` below for
            more details, and possible values. By default, no pre-trained
            weights are used.
        progress (bool, optional): If True, displays a progress bar of the
            download to stderr. Default is True.
        **kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
            for more details about this class.
    .. autoclass:: torchvision.models.EfficientNet_V2_M_Weights
        :members:
    r3   r   r1  rh   r9  rB  )r(   r*  r   r   r   r   r   r   r+  s        rD   r3   r3   "  rC  rF   c                     t                               |           } t          d          \  }}t          ||                    dd          || |fdt          t          j        d          i|S )a  
    Constructs an EfficientNetV2-L architecture from
    `EfficientNetV2: Smaller Models and Faster Training <https://arxiv.org/abs/2104.00298>`_.

    Args:
        weights (:class:`~torchvision.models.EfficientNet_V2_L_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.EfficientNet_V2_L_Weights` below for
            more details, and possible values. By default, no pre-trained
            weights are used.
        progress (bool, optional): If True, displays a progress bar of the
            download to stderr. Default is True.
        **kwargs: parameters passed to the ``torchvision.models.efficientnet.EfficientNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/efficientnet.py>`_
            for more details about this class.
    .. autoclass:: torchvision.models.EfficientNet_V2_L_Weights
        :members:
    r4   r   r7  rh   r9  rB  )r)   r*  r   r   r   r   r   r   r+  s        rD   r4   r4   H  rC  rF   )Or   r]   dataclassesr   	functoolsr   typingr   r   r   r   r	   r
   r   r   r   r   r   torchvision.opsr   ops.miscr   r   transforms._presetsr   r   utilsr   _apir   r   r   _metar   _utilsr   r   r   __all__r6   rR   rb   rN   rW   rd   r   rK   rM   boolr   strr   r   rL   r  r!  r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r  r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   rP   rF   rD   <module>rS     s     ! ! ! ! ! !       N N N N N N N N N N N N N N N N N N N N          + + + + + + > > > > > > > > H H H H H H H H ' ' ' ' ' ' 6 6 6 6 6 6 6 6 6 6 ' ' ' ' ' ' S S S S S S S S S S  6 D D D D D D D D7 7 7 7 7= 7 7 74h h h h h h h h"@ @ @ @ @RY @ @ @F: : : : :") : : :zo% o% o% o% o%29 o% o% o%d'l<M.M(NO 3- k"	
      &43
4343 8E,(99:;Xc]JK43 43 43 43p & d38n   
e  e      k   0- - - - -k - - -`    k   0    k   0    k   0    k   0    k   0    k   0       <       <       : ,0G0U!VWWW484  01DH[^   XW : ,0G0U!VWWW484  01DH[^   XW : ,0G0U!VWWW484  01DH[^   XW : ,0G0U!VWWW484  01DH[^   XW D ,0G0U!VWWW484  01DH[^   XW D ,0G0U!VWWW484     01 DH [^       XW  F ,0G0U!VWWW484     01 DH [^       XW  F ,0G0U!VWWW484     01 DH [^       XW  F ,0I0W!XYYY6:T! ! !23!FJ!]`!! ! ! ZY !H ,0I0W!XYYY6:T! ! !23!FJ!]`!! ! ! ZY !H ,0I0W!XYYY6:T! ! !23!FJ!]`!! ! ! ZY ! ! !rF   