U
    (d                     @   s  U 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 d dlZd dlmZ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 d
dlmZ d
dlmZmZmZ 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Z G d-d. d.eZ!G d/d0 d0ej"Z#G d1d2 d2ej$Z%G d3d4 d4ej"Z&G d5d6 d6Z'G d7d dej$Z(e'e
e e)ee(d8d9d:Z*d;ed<Z+ee,ef e-d=< e+d>d?d@Z.G dAd deZ/G dBd deZ0G dCd deZ1G dDd deZ2G dEd deZ3G dFd deZ4G dGd deZ5G dHd deZ6G dId deZ7G dJd deZ8G dKd deZ9G dLd deZ:G dMd deZ;G dNd deZ<G dOd deZ=edPe/j>fdQddRdSe
e/ e)ee(dTdUdZ?edPe0j>fdQddRdSe
e0 e)ee(dTdVdZ@edPe1j>fdQddRdSe
e1 e)ee(dTdWd ZAedPe2j>fdQddRdSe
e2 e)ee(dTdXd!ZBedPe3j>fdQddRdSe
e3 e)ee(dTdYd"ZCedPe4j>fdQddRdSe
e4 e)ee(dTdZd#ZDedPe5j>fdQddRdSe
e5 e)ee(dTd[d$ZEed\dQddRdSe
e6 e)ee(dTd]d%ZFedPe7j>fdQddRdSe
e7 e)ee(dTd^d&ZGedPe8j>fdQddRdSe
e8 e)ee(dTd_d'ZHedPe9j>fdQddRdSe
e9 e)ee(dTd`d(ZIedPe:j>fdQddRdSe
e: e)ee(dTdad)ZJedPe;j>fdQddRdSe
e; e)ee(dTdbd*ZKedPe<j>fdQddRdSe
e< e)ee(dTdcd+ZLedPe=j>fdQddRdSe
e= e)ee(dTddd,ZMd
delmNZN eNe/j>jOe0j>jOe1j>jOe2j>jOe3j>jOe4j>jOe5j>jOe7j>jOe8j>jOe9j>jOe:j>jOe;j>jOe<j>jOe=j>jOdfZPdS )g    N)OrderedDict)partial)AnyCallableDictListOptionalTuple)nnTensor   )Conv2dNormActivationSqueezeExcitation)ImageClassificationInterpolationMode)_log_api_usage_once   )WeightsEnumWeights)_IMAGENET_CATEGORIES)handle_legacy_interface_ovewrite_named_param_make_divisibleRegNetRegNet_Y_400MF_WeightsRegNet_Y_800MF_WeightsRegNet_Y_1_6GF_WeightsRegNet_Y_3_2GF_WeightsRegNet_Y_8GF_WeightsRegNet_Y_16GF_WeightsRegNet_Y_32GF_WeightsRegNet_Y_128GF_WeightsRegNet_X_400MF_WeightsRegNet_X_800MF_WeightsRegNet_X_1_6GF_WeightsRegNet_X_3_2GF_WeightsRegNet_X_8GF_WeightsRegNet_X_16GF_WeightsRegNet_X_32GF_Weightsregnet_y_400mfregnet_y_800mfregnet_y_1_6gfregnet_y_3_2gfregnet_y_8gfregnet_y_16gfregnet_y_32gfregnet_y_128gfregnet_x_400mfregnet_x_800mfregnet_x_1_6gfregnet_x_3_2gfregnet_x_8gfregnet_x_16gfregnet_x_32gfc                       sB   e Zd ZdZeeedejf edejf dd fddZ  Z	S )SimpleStemINz(Simple stem for ImageNet: 3x3, BN, ReLU..N)width_in	width_out
norm_layeractivation_layerreturnc                    s   t  j||dd||d d S )N   r   kernel_sizestrider;   r<   )super__init__)selfr9   r:   r;   r<   	__class__ =/tmp/pip-unpacked-wheel-vx7f76es/torchvision/models/regnet.pyrC   7   s         zSimpleStemIN.__init__)
__name__
__module____qualname____doc__intr   r
   ModulerC   __classcell__rG   rG   rE   rH   r8   4   s   r8   c                
       sN   e Zd ZdZeeeedejf edejf eee	e dd	 fddZ
  ZS )BottleneckTransformz/Bottleneck transformation: 1x1, 3x3 [+SE], 1x1..N	r9   r:   rA   r;   r<   group_widthbottleneck_multiplierse_ratior=   c	              	      s   t  }	tt|| }
|
| }t||
dd||d|	d< t|
|
d||||d|	d< |rvtt|| }t|
||d|	d< t|
|dd|d d|	d	< t |	 d S )
Nr   r?   ar>   )r@   rA   groupsr;   r<   b)Zinput_channelsZsqueeze_channels
activationsec)r   rM   roundr   r   rB   rC   )rD   r9   r:   rA   r;   r<   rR   rS   rT   ZlayersZw_bgZwidth_se_outrE   rG   rH   rC   F   sH         
      

     
zBottleneckTransform.__init__rI   rJ   rK   rL   rM   r   r
   rN   floatr   rC   rO   rG   rG   rE   rH   rP   C   s   rP   c                       s`   e Zd ZdZdeeeedejf edejf eee	e dd	 fddZ
eed	d
dZ  ZS )ResBottleneckBlockz>Residual bottleneck block: x + F(x), F = bottleneck transform.r         ?N.rQ   c	           
   	      sb   t    d | _||kp|dk}	|	r:t||d||d d| _t||||||||| _|dd| _d S )Nr   r?   T)Zinplace)rB   rC   projr   rP   frX   )
rD   r9   r:   rA   r;   r<   rR   rS   rT   Zshould_projrE   rG   rH   rC   o   s.    
     
zResBottleneckBlock.__init__xr=   c                 C   s8   | j d k	r |  || | }n|| | }| |S N)ra   rb   rX   rD   rd   rG   rG   rH   forward   s    
zResBottleneckBlock.forward)r   r`   N)rI   rJ   rK   rL   rM   r   r
   rN   r^   r   rC   r   rg   rO   rG   rG   rE   rH   r_   l   s    	    r_   c                       s`   e Zd ZdZdeeeeedejf edejf edejf eee	e edd fddZ
  ZS )	AnyStagez;AnyNet stage (sequence of blocks w/ the same output shape).Nr   .)r9   r:   rA   depthblock_constructorr;   r<   rR   rS   rT   stage_indexr=   c              
      sb   t    t|D ]J}||dkr$|n|||dkr4|nd||||	|
}| d| d| | qd S )Nr   r   block-)rB   rC   rangeZ
add_module)rD   r9   r:   rA   ri   rj   r;   r<   rR   rS   rT   rk   irl   rE   rG   rH   rC      s    
zAnyStage.__init__)Nr   r]   rG   rG   rE   rH   rh      s"     rh   c                   @   s   e Zd Zdee ee ee ee ee ee ddddZedeeeeeeee e	d d	ddZ
d	d
 Zeee ee ee eee ee f dddZdS )BlockParamsN)depthswidthsgroup_widthsbottleneck_multipliersstridesrT   r=   c                 C   s(   || _ || _|| _|| _|| _|| _d S re   rq   rr   rs   rt   ru   rT   )rD   rq   rr   rs   rt   ru   rT   rG   rG   rH   rC      s    	zBlockParams.__init__r`   )	ri   w_0w_aw_mrR   rS   rT   kwargsr=   c              	   K   sT  d}	d}
|dk s,|dks,|dks,|d dkr4t dt|| | }tt|| t| }tt|t|| |	|	  	 }t
t|}t|dg dg| |dg dg| }dd |D }dd t||d	d
 D }ttdd t|D  	 }|
g| }|g| }|g| }| |||\}}| ||||||dS )a(  
        Programatically compute all the per-block settings,
        given the RegNet parameters.

        The first step is to compute the quantized linear block parameters,
        in log space. Key parameters are:
        - `w_a` is the width progression slope
        - `w_0` is the initial width
        - `w_m` is the width stepping in the log space

        In other terms
        `log(block_width) = log(w_0) + w_m * block_capacity`,
        with `bock_capacity` ramping up following the w_0 and w_a params.
        This block width is finally quantized to multiples of 8.

        The second step is to compute the parameters per stage,
        taking into account the skip connection and the final 1x1 convolutions.
        We use the fact that the output width is constant within a stage.
           r   r   r   zInvalid RegNet settingsc                 S   s$   g | ]\}}}}||kp||kqS rG   rG   ).0wZwprrprG   rG   rH   
<listcomp>   s    
 z0BlockParams.from_init_params.<locals>.<listcomp>c                 S   s   g | ]\}}|r|qS rG   rG   )r|   r}   trG   rG   rH   r      s      Nc                 S   s   g | ]\}}|r|qS rG   rG   )r|   dr   rG   rG   rH   r      s      rv   )
ValueErrortorchZaranger[   logmathdividepowrM   tolistlensetzipZdiffZtensor	enumerate"_adjust_widths_groups_compatibilty)clsri   rw   rx   ry   rR   rS   rT   rz   ZQUANTZSTRIDEZwidths_contZblock_capacityZblock_widthsZ
num_stagesZsplit_helpersplitsstage_widthsZstage_depthsru   rt   rs   rG   rG   rH   from_init_params   sB     $*&


  zBlockParams.from_init_paramsc                 C   s   t | j| j| j| j| jS re   )r   rr   ru   rq   rs   rt   )rD   rG   rG   rH   _get_expanded_params  s    z BlockParams._get_expanded_params)r   bottleneck_ratiosrs   r=   c                 C   sX   dd t | |D }dd t ||D }dd t ||D }dd t ||D } | |fS )zl
        Adjusts the compatibility of widths and groups,
        depending on the bottleneck ratio.
        c                 S   s   g | ]\}}t || qS rG   rM   )r|   r}   rW   rG   rG   rH   r     s     zBBlockParams._adjust_widths_groups_compatibilty.<locals>.<listcomp>c                 S   s   g | ]\}}t ||qS rG   )min)r|   r\   w_botrG   rG   rH   r      s     c                 S   s   g | ]\}}t ||qS rG   )r   )r|   r   r\   rG   rG   rH   r   #  s     c                 S   s   g | ]\}}t || qS rG   r   )r|   r   rW   rG   rG   rH   r   $  s     )r   )r   r   rs   rr   Zgroup_widths_minZws_botrG   rG   rH   r     s
    	z.BlockParams._adjust_widths_groups_compatibilty)N)r`   N)rI   rJ   rK   r   rM   r^   r   rC   classmethodr   r   r   staticmethodr	   r   rG   rG   rG   rH   rp      s>      H  rp   c                       sz   e Zd Zdeeeeedejf  eedejf  eedejf  eedejf  dd fddZ	e
e
dd	d
Z  ZS )r         N.)block_paramsnum_classes
stem_width	stem_type
block_typer;   rX   r=   c                    s  t    t|  |d krt}|d kr,tj}|d kr8t}|d krFtj}|d|||| _|}g }	t	|
 D ]N\}
\}}}}}|	d|
d  t||||||||||j|
d df |}qjtt|	| _td| _tj||d| _|  D ]}t|tjr:|jd |jd  |j }tjj|jdtd	| d
 qt|tjrftj|j tj |j! qt|tjrtjj|jddd
 tj |j! qd S )Nr>   rl   r   )rk   r   r   )Zin_featuresZout_featuresr   g               @)ZmeanZstdg{Gz?)"rB   rC   r   r8   r
   BatchNorm2dr_   ZReLUstemr   r   appendrh   rT   
Sequentialr   trunk_outputZAdaptiveAvgPool2davgpoolZLinearfcmodules
isinstanceZConv2dr@   Zout_channelsinitZnormal_Zweightr   sqrtZones_Zzeros_Zbias)rD   r   r   r   r   r   r;   rX   Zcurrent_widthblocksro   r:   rA   ri   rR   rS   mZfan_outrE   rG   rH   rC   )  sp    



 zRegNet.__init__rc   c                 C   s8   |  |}| |}| |}|jdd}| |}|S )Nr   )Z	start_dim)r   r   r   flattenr   rf   rG   rG   rH   rg   x  s    



zRegNet.forward)r   r   NNNN)rI   rJ   rK   rp   rM   r   r   r
   rN   rC   r   rg   rO   rG   rG   rE   rH   r   (  s"         O)r   weightsprogressrz   r=   c                 K   sh   |d k	rt |dt|jd  |dttjddd}t| fd|i|}|d k	rd||j	|d |S )Nr   
categoriesr;   gh㈵>g?)ZepsZmomentum)r   )
r   r   metapopr   r
   r   r   Zload_state_dictZget_state_dict)r   r   r   rz   r;   modelrG   rG   rH   _regnet  s    r   r   )Zmin_sizer   _COMMON_METAz(https://github.com/facebookresearch/SWAGz:https://github.com/facebookresearch/SWAG/blob/main/LICENSE)recipelicensec                
   @   sn   e Zd Zedeeddedddddd	id
ddZedeedddedddddd	idddZeZ	dS )r   z?https://download.pytorch.org/models/regnet_y_400mf-c65dace8.pth   	crop_sizeiPIB Rhttps://github.com/pytorch/vision/tree/main/references/classification#small-modelsImageNet-1KgmR@gV@zacc@1zacc@5XThese weights reproduce closely the results of the paper using a simple training recipe.
num_paramsr   _metrics_docsurlZ
transformsr   z?https://download.pytorch.org/models/regnet_y_400mf-e6988f5f.pth   r   resize_size8https://github.com/pytorch/vision/issues/3995#new-recipeg~jtR@gsh|/W@$  
                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/>`_.
            N
rI   rJ   rK   r   r   r   r   IMAGENET1K_V1IMAGENET1K_V2DEFAULTrG   rG   rG   rH   r     s:   
c                
   @   sn   e Zd Zedeeddedddddd	id
ddZedeedddedddddd	idddZeZ	dS )r   z?https://download.pytorch.org/models/regnet_y_800mf-1b27b58c.pthr   r   i 'b r   r   g{GS@gbX9HW@r   r   r   r   z?https://download.pytorch.org/models/regnet_y_800mf-58fc7688.pthr   r   r   gES@g㥛 W@r   Nr   rG   rG   rG   rH   r     s:   
c                
   @   sn   e Zd Zedeeddedddddd	id
ddZedeedddedddddd	idddZeZ	dS )r   z?https://download.pytorch.org/models/regnet_y_1_6gf-b11a554e.pthr   r   i~ r   r   g|S@g}W@r   r   r   r   z?https://download.pytorch.org/models/regnet_y_1_6gf-0d7bc02a.pthr   r   r   gMb8T@g#~jW@r   Nr   rG   rG   rG   rH   r     s:   
c                
   @   sn   e Zd Zedeeddedddddd	id
ddZedeedddedddddd	idddZeZ	dS )r   z?https://download.pytorch.org/models/regnet_y_3_2gf-b5a9779c.pthr   r   i2(Shttps://github.com/pytorch/vision/tree/main/references/classification#medium-modelsr   g&1S@g/ݤW@r   r   r   r   z?https://download.pytorch.org/models/regnet_y_3_2gf-9180c971.pthr   r   r   g+~T@g|?5W@r   Nr   rG   rG   rG   rH   r     s:   
c                
   @   sn   e Zd Zedeeddedddddd	id
ddZedeedddedddddd	idddZeZ	dS )r   z=https://download.pytorch.org/models/regnet_y_8gf-d0d0e4a8.pthr   r   iXr   r   g5^IT@gPnW@r   r   r   r   z=https://download.pytorch.org/models/regnet_y_8gf-dc2b1b54.pthr   r   r   gET@gQX@r   Nr   rG   rG   rG   rH   r   A  s:   
c                
   @   s   e Zd Zedeeddedddddd	id
ddZedeedddedddddd	idddZedeedde	j
deddddd	idddZedeedde	j
dedddddd	idd dZeZd!S )"r   z>https://download.pytorch.org/models/regnet_y_16gf-9e6ed7dd.pthr   r   i{Rhttps://github.com/pytorch/vision/tree/main/references/classification#large-modelsr   gB`"T@g(\W@r   r   r   r   z>https://download.pytorch.org/models/regnet_y_16gf-3e4a00f9.pthr   r   r   gbX9T@gEX@r   zChttps://download.pytorch.org/models/regnet_y_16gf_swag-43afe44d.pth  r   r   interpolationgT㥛ĀU@g~jtX@
                These weights are learnt via transfer learning by end-to-end fine-tuning the original
                `SWAG <https://arxiv.org/abs/2201.08371>`_ weights on ImageNet-1K data.
            r   r   r   zFhttps://download.pytorch.org/models/regnet_y_16gf_lc_swag-f3ec0043.pth+https://github.com/pytorch/vision/pull/5793gX9vT@gV-OX@
                These weights are composed of the original frozen `SWAG <https://arxiv.org/abs/2201.08371>`_ trunk
                weights and a linear classifier learnt on top of them trained on ImageNet-1K data.
            r   r   r   r   NrI   rJ   rK   r   r   r   r   r   r   r   BICUBIC_COMMON_SWAG_METAIMAGENET1K_SWAG_E2E_V1IMAGENET1K_SWAG_LINEAR_V1r   rG   rG   rG   rH   r   i  s   
      c                
   @   s   e Zd Zedeeddedddddd	id
ddZedeedddedddddd	idddZedeedde	j
deddddd	idddZedeedde	j
dedddddd	idd dZeZd!S )"r    z>https://download.pytorch.org/models/regnet_y_32gf-4dee3f7a.pthr   r   i<r   r   gx&18T@g(\W@r   r   r   r   z>https://download.pytorch.org/models/regnet_y_32gf-8db6d4b5.pthr   r   r   gd;OT@gZd;X@r   zChttps://download.pytorch.org/models/regnet_y_32gf_swag-04fdfa75.pthr   r   gʡU@gI+X@r   r   zFhttps://download.pytorch.org/models/regnet_y_32gf_lc_swag-e1583746.pthr   g+'U@gQ^X@r   r   Nr   rG   rG   rG   rH   r      s   
      c                
   @   sv   e Zd Zedeeddejdedddddid	d
dZ	edeeddejdeddddddidddZ
e	ZdS )r!   zDhttps://download.pytorch.org/models/regnet_y_128gf_swag-c8ce3e52.pthr   r   i^o&r   g;OV@gS㥫X@r   r   r   r   zGhttps://download.pytorch.org/models/regnet_y_128gf_lc_swag-cbe8ce12.pthr   r   g1ZU@gtvX@r   r   N)rI   rJ   rK   r   r   r   r   r   r   r   r   r   rG   rG   rG   rH   r!     sL         c                
   @   sn   e Zd Zedeeddedddddd	id
ddZedeedddedddddd	idddZeZ	dS )r"   z?https://download.pytorch.org/models/regnet_x_400mf-adf1edd5.pthr   r   iS r   r   gL7A`5R@g̼V@r   r   r   r   z?https://download.pytorch.org/models/regnet_x_400mf-62229a5f.pthr   r   Dhttps://github.com/pytorch/vision/issues/3995#new-recipe-with-fixresgKR@gS㥛W@r   Nr   rG   rG   rG   rH   r"   8  s:   
c                
   @   sn   e Zd Zedeeddedddddd	id
ddZedeedddedddddd	idddZeZ	dS )r#   z?https://download.pytorch.org/models/regnet_x_800mf-ad17e45c.pthr   r   in r   r   g!rhR@gʡEW@r   r   r   r   z?https://download.pytorch.org/models/regnet_x_800mf-94a99ebd.pthr   r   r   g rhaS@g/tW@r   Nr   rG   rG   rG   rH   r#   `  s:   
c                
   @   sn   e Zd Zedeeddedddddd	id
ddZedeedddedddddd	idddZeZ	dS )r$   z?https://download.pytorch.org/models/regnet_x_1_6gf-e3633e7f.pthr   r   i: r   r   g(\BS@g\(\W@r   r   r   r   z?https://download.pytorch.org/models/regnet_x_1_6gf-a12f2b72.pthr   r   r   gnS@g^IW@r   Nr   rG   rG   rG   rH   r$     s:   
c                
   @   sn   e Zd Zedeeddedddddd	id
ddZedeedddedddddd	idddZeZ	dS )r%   z?https://download.pytorch.org/models/regnet_x_3_2gf-f342aeae.pthr   r   i(h r   r   gKS@gsh|W@r   r   r   r   z?https://download.pytorch.org/models/regnet_x_3_2gf-7071aa85.pthr   r   r   gCLT@gQW@r   Nr   rG   rG   rG   rH   r%     s:   
c                
   @   sn   e Zd Zedeeddedddddd	id
ddZedeedddedddddd	idddZeZ	dS )r&   z=https://download.pytorch.org/models/regnet_x_8gf-03ceed89.pthr   r   i[r   r   gtS@gClW@r   r   r   r   z=https://download.pytorch.org/models/regnet_x_8gf-2b70d774.pthr   r   r   gSkT@gZdW@r   Nr   rG   rG   rG   rH   r&     s:   
c                
   @   sn   e Zd Zedeeddedddddd	id
ddZedeedddedddddd	idddZeZ	dS )r'   z>https://download.pytorch.org/models/regnet_x_16gf-2007eb11.pthr   r   i9<r   r   gʡET@g#~jW@r   r   r   r   z>https://download.pytorch.org/models/regnet_x_16gf-ba3796d7.pthr   r   r   gҭT@gCX@r   Nr   rG   rG   rG   rH   r'      s:   
c                
   @   sn   e Zd Zedeeddedddddd	id
ddZedeedddedddddd	idddZeZ	dS )r(   z>https://download.pytorch.org/models/regnet_x_32gf-9d47f8d0.pthr   r   imr   r   g+'T@gZd;W@r   r   r   r   z>https://download.pytorch.org/models/regnet_x_32gf-6eb8fdc6.pthr   r   r   g7A`T@gOnX@r   Nr   rG   rG   rG   rH   r(   (  s:   

pretrained)r   T)r   r   )r   r   rz   r=   c              	   K   s8   t | } tjf ddddddd|}t|| |f|S )a  
    Constructs a RegNetY_400MF architecture from
    `Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>`_.

    Args:
        weights (:class:`~torchvision.models.RegNet_Y_400MF_Weights`, optional): The pretrained weights to use.
            See :class:`~torchvision.models.RegNet_Y_400MF_Weights` below for more details and possible values.
            By default, no pretrained weights are used.
        progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
        **kwargs: parameters passed to either ``torchvision.models.regnet.RegNet`` or
            ``torchvision.models.regnet.BlockParams`` class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>`_
            for more detail about the classes.

    .. autoclass:: torchvision.models.RegNet_Y_400MF_Weights
        :members:
       0   gp=
;@gQ @r{         ?ri   rw   rx   ry   rR   rT   )r   verifyrp   r   r   r   r   rz   paramsrG   rG   rH   r)   P  s    
c              	   K   s8   t | } tjf ddddddd|}t|| |f|S )a  
    Constructs a RegNetY_800MF architecture from
    `Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>`_.

    Args:
        weights (:class:`~torchvision.models.RegNet_Y_800MF_Weights`, optional): The pretrained weights to use.
            See :class:`~torchvision.models.RegNet_Y_800MF_Weights` below for more details and possible values.
            By default, no pretrained weights are used.
        progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
        **kwargs: parameters passed to either ``torchvision.models.regnet.RegNet`` or
            ``torchvision.models.regnet.BlockParams`` class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>`_
            for more detail about the classes.

    .. autoclass:: torchvision.models.RegNet_Y_800MF_Weights
        :members:
       8   gQkC@g333333@r   r   r   )r   r   rp   r   r   r   rG   rG   rH   r*   i  s    
c              	   K   s8   t | } tjf ddddddd|}t|| |f|S )a  
    Constructs a RegNetY_1.6GF architecture from
    `Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>`_.

    Args:
        weights (:class:`~torchvision.models.RegNet_Y_1_6GF_Weights`, optional): The pretrained weights to use.
            See :class:`~torchvision.models.RegNet_Y_1_6GF_Weights` below for more details and possible values.
            By default, no pretrained weights are used.
        progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
        **kwargs: parameters passed to either ``torchvision.models.regnet.RegNet`` or
            ``torchvision.models.regnet.BlockParams`` class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>`_
            for more detail about the classes.

    .. autoclass:: torchvision.models.RegNet_Y_1_6GF_Weights
        :members:
       r   g(\µ4@g333333@   r   r   )r   r   rp   r   r   r   rG   rG   rH   r+     s    
     c              	   K   s8   t | } tjf ddddddd|}t|| |f|S )a  
    Constructs a RegNetY_3.2GF architecture from
    `Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>`_.

    Args:
        weights (:class:`~torchvision.models.RegNet_Y_3_2GF_Weights`, optional): The pretrained weights to use.
            See :class:`~torchvision.models.RegNet_Y_3_2GF_Weights` below for more details and possible values.
            By default, no pretrained weights are used.
        progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
        **kwargs: parameters passed to either ``torchvision.models.regnet.RegNet`` or
            ``torchvision.models.regnet.BlockParams`` class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>`_
            for more detail about the classes.

    .. autoclass:: torchvision.models.RegNet_Y_3_2GF_Weights
        :members:
       P   gq=
ףPE@gHzG@r   r   r   )r   r   rp   r   r   r   rG   rG   rH   r,     s    
     c              	   K   s8   t | } tjf ddddddd|}t|| |f|S )a  
    Constructs a RegNetY_8GF architecture from
    `Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>`_.

    Args:
        weights (:class:`~torchvision.models.RegNet_Y_8GF_Weights`, optional): The pretrained weights to use.
            See :class:`~torchvision.models.RegNet_Y_8GF_Weights` below for more details and possible values.
            By default, no pretrained weights are used.
        progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
        **kwargs: parameters passed to either ``torchvision.models.regnet.RegNet`` or
            ``torchvision.models.regnet.BlockParams`` class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>`_
            for more detail about the classes.

    .. autoclass:: torchvision.models.RegNet_Y_8GF_Weights
        :members:
          gGz4S@gQ@r   r   r   )r   r   rp   r   r   r   rG   rG   rH   r-     s    
     c              	   K   s8   t | } tjf ddddddd|}t|| |f|S )a  
    Constructs a RegNetY_16GF architecture from
    `Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>`_.

    Args:
        weights (:class:`~torchvision.models.RegNet_Y_16GF_Weights`, optional): The pretrained weights to use.
            See :class:`~torchvision.models.RegNet_Y_16GF_Weights` below for more details and possible values.
            By default, no pretrained weights are used.
        progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
        **kwargs: parameters passed to either ``torchvision.models.regnet.RegNet`` or
            ``torchvision.models.regnet.BlockParams`` class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>`_
            for more detail about the classes.

    .. autoclass:: torchvision.models.RegNet_Y_16GF_Weights
        :members:
          gQZ@gףp=
@p   r   r   )r   r   rp   r   r   r   rG   rG   rH   r.     s    
     c              	   K   s8   t | } tjf ddddddd|}t|| |f|S )a  
    Constructs a RegNetY_32GF architecture from
    `Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>`_.

    Args:
        weights (:class:`~torchvision.models.RegNet_Y_32GF_Weights`, optional): The pretrained weights to use.
            See :class:`~torchvision.models.RegNet_Y_32GF_Weights` below for more details and possible values.
            By default, no pretrained weights are used.
        progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
        **kwargs: parameters passed to either ``torchvision.models.regnet.RegNet`` or
            ``torchvision.models.regnet.BlockParams`` class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>`_
            for more detail about the classes.

    .. autoclass:: torchvision.models.RegNet_Y_32GF_Weights
        :members:
       r   g)\\@g=
ףp=@r   r   )r    r   rp   r   r   r   rG   rG   rH   r/     s    
     )r   Nc              	   K   s8   t | } tjf ddddddd|}t|| |f|S )a  
    Constructs a RegNetY_128GF architecture from
    `Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>`_.

    Args:
        weights (:class:`~torchvision.models.RegNet_Y_128GF_Weights`, optional): The pretrained weights to use.
            See :class:`~torchvision.models.RegNet_Y_128GF_Weights` below for more details and possible values.
            By default, no pretrained weights are used.
        progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
        **kwargs: parameters passed to either ``torchvision.models.regnet.RegNet`` or
            ``torchvision.models.regnet.BlockParams`` class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>`_
            for more detail about the classes.

    .. autoclass:: torchvision.models.RegNet_Y_128GF_Weights
        :members:
    r   i  g(\d@g)\(@i  r   r   )r!   r   rp   r   r   r   rG   rG   rH   r0   	  s    
     c                 K   s6   t | } tjf dddddd|}t|| |f|S )a  
    Constructs a RegNetX_400MF architecture from
    `Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>`_.

    Args:
        weights (:class:`~torchvision.models.RegNet_X_400MF_Weights`, optional): The pretrained weights to use.
            See :class:`~torchvision.models.RegNet_X_400MF_Weights` below for more details and possible values.
            By default, no pretrained weights are used.
        progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
        **kwargs: parameters passed to either ``torchvision.models.regnet.RegNet`` or
            ``torchvision.models.regnet.BlockParams`` class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>`_
            for more detail about the classes.

    .. autoclass:: torchvision.models.RegNet_X_400MF_Weights
        :members:
       r   g{Gz8@gRQ@r   ri   rw   rx   ry   rR   )r"   r   rp   r   r   r   rG   rG   rH   r1   $  s    
c                 K   s6   t | } tjf dddddd|}t|| |f|S )a  
    Constructs a RegNetX_800MF architecture from
    `Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>`_.

    Args:
        weights (:class:`~torchvision.models.RegNet_X_800MF_Weights`, optional): The pretrained weights to use.
            See :class:`~torchvision.models.RegNet_X_800MF_Weights` below for more details and possible values.
            By default, no pretrained weights are used.
        progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
        **kwargs: parameters passed to either ``torchvision.models.regnet.RegNet`` or
            ``torchvision.models.regnet.BlockParams`` class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>`_
            for more detail about the classes.

    .. autoclass:: torchvision.models.RegNet_X_800MF_Weights
        :members:
    r   r   g=
ףpA@g=
ףp=@r   )r#   r   rp   r   r   r   rG   rG   rH   r2   =  s    
c                 K   s6   t | } tjf dddddd|}t|| |f|S )aX  
    Constructs a RegNetX_1.6GF architecture from
    `Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>`_.

    Args:
        weights (:class:`~torchvision.models.RegNet_X_1_6GF_Weights`, optional): The pretrained weights to use.
            See :class:`~torchvision.models.RegNet_X_1_6GF_Weights` below for more details and possible values.
            By default, no pretrained weights are used.
        progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
        **kwargs: parameters passed to either ``torchvision.models.regnet.RegNet`` or
            ``torchvision.models.regnet.BlockParams`` class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>`_
            for more detail about the classes.

    .. autoclass:: torchvision.models.RegNet_X_1_6GF_Weights
        :members:

    Args:
        weights (RegNet_X_1_6GF_Weights, optional): The pretrained weights for the model
        progress (bool): If True, displays a progress bar of the download to stderr
    r   r   gzGA@      @r   r   )r$   r   rp   r   r   r   rG   rG   rH   r3   V  s    
c                 K   s6   t | } tjf dddddd|}t|| |f|S )aX  
    Constructs a RegNetX_3.2GF architecture from
    `Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>`_.

    Args:
        weights (:class:`~torchvision.models.RegNet_X_3_2GF_Weights`, optional): The pretrained weights to use.
            See :class:`~torchvision.models.RegNet_X_3_2GF_Weights` below for more details and possible values.
            By default, no pretrained weights are used.
        progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
        **kwargs: parameters passed to either ``torchvision.models.regnet.RegNet`` or
            ``torchvision.models.regnet.BlockParams`` class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>`_
            for more detail about the classes.

    .. autoclass:: torchvision.models.RegNet_X_3_2GF_Weights
        :members:

    Args:
        weights (RegNet_X_3_2GF_Weights, optional): The pretrained weights for the model
        progress (bool): If True, displays a progress bar of the download to stderr
       X   g(\O:@r   r   r   )r%   r   rp   r   r   r   rG   rG   rH   r4   s  s    
c                 K   s6   t | } tjf dddddd|}t|| |f|S )aN  
    Constructs a RegNetX_8GF architecture from
    `Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>`_.

    Args:
        weights (:class:`~torchvision.models.RegNet_X_8GF_Weights`, optional): The pretrained weights to use.
            See :class:`~torchvision.models.RegNet_X_8GF_Weights` below for more details and possible values.
            By default, no pretrained weights are used.
        progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
        **kwargs: parameters passed to either ``torchvision.models.regnet.RegNet`` or
            ``torchvision.models.regnet.BlockParams`` class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>`_
            for more detail about the classes.

    .. autoclass:: torchvision.models.RegNet_X_8GF_Weights
        :members:

    Args:
        weights (RegNet_X_8GF_Weights, optional): The pretrained weights for the model
        progress (bool): If True, displays a progress bar of the download to stderr
       r   gHzH@g
ףp=
@x   r   )r&   r   rp   r   r   r   rG   rG   rH   r5     s    
c                 K   s6   t | } tjf dddddd|}t|| |f|S )aS  
    Constructs a RegNetX_16GF architecture from
    `Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>`_.

    Args:
        weights (:class:`~torchvision.models.RegNet_X_16GF_Weights`, optional): The pretrained weights to use.
            See :class:`~torchvision.models.RegNet_X_16GF_Weights` below for more details and possible values.
            By default, no pretrained weights are used.
        progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
        **kwargs: parameters passed to either ``torchvision.models.regnet.RegNet`` or
            ``torchvision.models.regnet.BlockParams`` class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>`_
            for more detail about the classes.

    .. autoclass:: torchvision.models.RegNet_X_16GF_Weights
        :members:

    Args:
        weights (RegNet_X_16GF_Weights, optional): The pretrained weights for the model
        progress (bool): If True, displays a progress bar of the download to stderr
    r      gQK@g @   r   )r'   r   rp   r   r   r   rG   rG   rH   r6     s    
c                 K   s6   t | } tjf dddddd|}t|| |f|S )aS  
    Constructs a RegNetX_32GF architecture from
    `Designing Network Design Spaces <https://arxiv.org/abs/2003.13678>`_.

    Args:
        weights (:class:`~torchvision.models.RegNet_X_32GF_Weights`, optional): The pretrained weights to use.
            See :class:`~torchvision.models.RegNet_X_32GF_Weights` below for more details and possible values.
            By default, no pretrained weights are used.
        progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
        **kwargs: parameters passed to either ``torchvision.models.regnet.RegNet`` or
            ``torchvision.models.regnet.BlockParams`` class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/regnet.py>`_
            for more detail about the classes.

    .. autoclass:: torchvision.models.RegNet_X_32GF_Weights
        :members:

    Args:
        weights (RegNet_X_32GF_Weights, optional): The pretrained weights for the model
        progress (bool): If True, displays a progress bar of the download to stderr
    r   i@  gףp=
wQ@r      r   )r(   r   rp   r   r   r   rG   rG   rH   r7     s    
)
_ModelURLs)r)   r*   r+   r,   r-   r.   r/   r1   r2   r3   r4   r5   r6   r7   )Qr   collectionsr   	functoolsr   typingr   r   r   r   r   r	   r   r
   r   Zops.miscr   r   Ztransforms._presetsr   r   utilsr   Z_apir   r   Z_metar   _utilsr   r   r   __all__r8   r   rP   rN   r_   rh   rp   r   boolr   r   str__annotations__r   r   r   r   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   r5   r6   r7   r   r   Z
model_urlsrG   rG   rG   rH   <module>   s     #)+"o\(((((QQ-((((((("""""""""""""""