
    ڧg                        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 d dl	mZ ddl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 g dZdEdedededededej        fdZdFdedededej        fd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e         dee         de#dede"fd Z$d!ed"Z% G d# d$e          Z& G d% d&e          Z' G d' d(e          Z( G d) d*e          Z) G d+ d,e          Z* G d- d.e          Z+ G d/ d0e          Z, G d1 d2e          Z- G d3 d4e          Z. G d5 d6e          Z/ e             ed7e&j0        f8          dd9d:dee&         de#dede"fd;                        Z1 e             ed7e'j0        f8          dd9d:dee'         de#dede"fd<                        Z2 e             ed7e(j0        f8          dd9d:dee(         de#dede"fd=                        Z3 e             ed7e)j0        f8          dd9d:dee)         de#dede"fd>                        Z4 e             ed7e*j0        f8          dd9d:dee*         de#dede"fd?                        Z5 e             ed7e+j0        f8          dd9d:dee+         de#dede"fd@                        Z6 e             ed7e,j0        f8          dd9d:dee,         de#dede"fdA                        Z7 e             ed7e-j0        f8          dd9d:dee-         de#dede"fdB                        Z8 e             ed7e.j0        f8          dd9d:dee.         de#dede"fdC                        Z9 e             ed7e/j0        f8          dd9d:dee/         de#dede"fdD                        Z:dS )G    )partial)AnyCallableListOptionalTypeUnionN)Tensor   )ImageClassification)_log_api_usage_once   )register_modelWeightsWeightsEnum)_IMAGENET_CATEGORIES)_ovewrite_named_paramhandle_legacy_interface)ResNetResNet18_WeightsResNet34_WeightsResNet50_WeightsResNet101_WeightsResNet152_WeightsResNeXt50_32X4D_WeightsResNeXt101_32X8D_WeightsResNeXt101_64X4D_WeightsWide_ResNet50_2_WeightsWide_ResNet101_2_Weightsresnet18resnet34resnet50	resnet101	resnet152resnext50_32x4dresnext101_32x8dresnext101_64x4dwide_resnet50_2wide_resnet101_2	in_planes
out_planesstridegroupsdilationreturnc           
      :    t          j        | |d|||d|          S )z3x3 convolution with padding   F)kernel_sizer,   paddingr-   biasr.   nnConv2d)r*   r+   r,   r-   r.   s        U/var/www/html/ai-engine/env/lib/python3.11/site-packages/torchvision/models/resnet.pyconv3x3r9   (   s3    9	 	 	 	    c                 4    t          j        | |d|d          S )z1x1 convolutionr   F)r2   r,   r4   r5   )r*   r+   r,   s      r8   conv1x1r<   6   s    9Y
&uUUUUr:   c                        e Zd ZU dZeed<   	 	 	 	 	 	 ddedededeej                 d	ed
ededee	dej        f                  ddf fdZ
dedefdZ xZS )
BasicBlockr   	expansionN@   inplanesplanesr,   
downsampler-   
base_widthr.   
norm_layer.r/   c	                    t                                                       |t          j        }|dk    s|dk    rt	          d          |dk    rt          d          t          |||          | _         ||          | _        t          j	        d          | _
        t          ||          | _         ||          | _        || _        || _        d S )Nr   r@   z3BasicBlock only supports groups=1 and base_width=64z(Dilation > 1 not supported in BasicBlockTinplace)super__init__r6   BatchNorm2d
ValueErrorNotImplementedErrorr9   conv1bn1ReLUreluconv2bn2rC   r,   )
selfrA   rB   r,   rC   r-   rD   r.   rE   	__class__s
            r8   rJ   zBasicBlock.__init__>   s     	JQ;;***RSSSa<<%&PQQQXvv66
:f%%GD)))	VV,,
:f%%$r:   xc                 H   |}|                      |          }|                     |          }|                     |          }|                     |          }|                     |          }| j        |                     |          }||z  }|                     |          }|S N)rN   rO   rQ   rR   rS   rC   rT   rV   identityouts       r8   forwardzBasicBlock.forwardY   s    jjmmhhsmmiinnjjoohhsmm?&q))Hxiinn
r:   r   Nr   r@   r   N__name__
__module____qualname__r?   int__annotations__r   r6   Moduler   rJ   r
   r\   __classcell__rU   s   @r8   r>   r>   ;   s         Is *.9=   	
 RY'    Xc29n56 
     6 F        r:   r>   c                        e Zd ZU dZeed<   	 	 	 	 	 	 ddededed	eej                 d
edededee	dej        f                  ddf fdZ
dedefdZ xZS )
Bottleneck   r?   r   Nr@   rA   rB   r,   rC   r-   rD   r.   rE   .r/   c	                    t                                                       |t          j        }t	          ||dz  z            |z  }	t          ||	          | _         ||	          | _        t          |	|	|||          | _	         ||	          | _
        t          |	|| j        z            | _         ||| j        z            | _        t          j        d          | _        || _        || _        d S )Ng      P@TrG   )rI   rJ   r6   rK   rb   r<   rN   rO   r9   rR   rS   r?   conv3bn3rP   rQ   rC   r,   )rT   rA   rB   r,   rC   r-   rD   r.   rE   widthrU   s             r8   rJ   zBottleneck.__init__u   s     	JFj4/011F:Xu--
:e$$UE668DD
:e$$UFT^$;<<
:ft~566GD)))	$r:   rV   c                    |}|                      |          }|                     |          }|                     |          }|                     |          }|                     |          }|                     |          }|                     |          }|                     |          }| j        |                     |          }||z  }|                     |          }|S rX   )rN   rO   rQ   rR   rS   rk   rl   rC   rY   s       r8   r\   zBottleneck.forward   s    jjmmhhsmmiinnjjoohhsmmiinnjjoohhsmm?&q))Hxiinn
r:   r]   r^   rf   s   @r8   rh   rh   l   s          Is *.9=   	
 RY'    Xc29n56 
     4 F        r:   rh   c                   $    e Zd Z	 	 	 	 	 	 ddeeeef                  dee         ded	e	d
edede
ee	                  de
edej        f                  ddf fdZ	 	 ddeeeef                  dededede	dej        fdZdedefdZdedefdZ xZS )r     Fr   r@   Nblocklayersnum_classeszero_init_residualr-   width_per_groupreplace_stride_with_dilationrE   .r/   c	                    t                                                       t          |            |t          j        }|| _        d| _        d| _        |g d}t          |          dk    rt          d|           || _
        || _        t          j        d| j        dddd	          | _         || j                  | _        t          j        d
          | _        t          j        ddd          | _        |                     |d|d                   | _        |                     |d|d         d|d                   | _        |                     |d|d         d|d                   | _        |                     |d|d         d|d                   | _        t          j        d          | _        t          j        d|j        z  |          | _        |                                 D ]}	t=          |	t          j                  r(t          j                             |	j!        dd           Dt=          |	t          j        t          j"        f          rJt          j        #                    |	j!        d           t          j        #                    |	j$        d           |r|                                 D ]}	t=          |	tJ                    r7|	j&        j!        +t          j        #                    |	j&        j!        d           Nt=          |	tN                    r6|	j(        j!        *t          j        #                    |	j(        j!        d           d S d S )Nr@   r   )FFFr1   zFreplace_stride_with_dilation should be None or a 3-element tuple, got    r   F)r2   r,   r3   r4   TrG   )r2   r,   r3   r      )r,   dilate   i   r   r   fan_outrQ   )modenonlinearity))rI   rJ   r   r6   rK   _norm_layerrA   r.   lenrL   r-   rD   r7   rN   rO   rP   rQ   	MaxPool2dmaxpool_make_layerlayer1layer2layer3layer4AdaptiveAvgPool2davgpoolLinearr?   fcmodules
isinstanceinitkaiming_normal_weight	GroupNorm	constant_r4   rh   rl   r>   rS   )rT   rq   rr   rs   rt   r-   ru   rv   rE   mrU   s             r8   rJ   zResNet.__init__   s    	D!!!J%'/ ,A+@+@(+,,11L-IL L   )Yq$-QqRSZ_```
:dm,,GD)))	|!QGGG&&ub&)<<&&uc6!9QOklmOn&oo&&uc6!9QOklmOn&oo&&uc6!9QOklmOn&oo+F33)C%/1;?? 	- 	-A!RY'' -''yv'VVVVA=>> -!!!(A...!!!&!,,,
  	7\\^^ 7 7a,, 71IG%%aelA6666:.. 715<3KG%%aelA666	7 	77 7r:   rB   blocksr,   rz   c                 <   | j         }d }| j        }|r| xj        |z  c_        d}|dk    s| j        ||j        z  k    rBt	          j        t          | j        ||j        z  |           |||j        z                      }g }	|	                     || j        |||| j        | j	        ||                     ||j        z  | _        t          d|          D ]:}
|	                     || j        || j        | j	        | j        |                     ;t	          j        |	 S )Nr   )r-   rD   r.   rE   )r   r.   rA   r?   r6   
Sequentialr<   appendr-   rD   range)rT   rq   rB   r   r,   rz   rE   rC   previous_dilationrr   _s              r8   r   zResNet._make_layer   sU    %

 M 	MMV#MMFQ;;$-6EO+CCCv'?HH
6EO344 J
 Evvz4;Yjlv 	
 	
 	

 0q&!! 
	 
	AMMM;#!])  	 	 	 	 }f%%r:   rV   c                    |                      |          }|                     |          }|                     |          }|                     |          }|                     |          }|                     |          }|                     |          }|                     |          }|                     |          }t          j
        |d          }|                     |          }|S )Nr   )rN   rO   rQ   r   r   r   r   r   r   torchflattenr   rT   rV   s     r8   _forward_implzResNet._forward_impl
  s    JJqMMHHQKKIIaLLLLOOKKNNKKNNKKNNKKNNLLOOM!QGGAJJr:   c                 ,    |                      |          S rX   )r   r   s     r8   r\   zResNet.forward  s    !!!$$$r:   )rp   Fr   r@   NN)r   F)r_   r`   ra   r   r	   r>   rh   r   rb   boolr   r   r6   rd   rJ   r   r   r
   r   r\   re   rf   s   @r8   r   r      s       
  #(!=A9=87 87E*j01287 S	87 	87
 !87 87 87 '/tDz&:87 Xc29n5687 
87 87 87 87 87 87~ '& '&E*j012'& '& 	'&
 '& '& 
'& '& '& '&Rv &    $% %F % % % % % % % %r:   r   rq   rr   weightsprogresskwargsc                     |)t          |dt          |j        d                              t          | |fi |}|*|                    |                    |d                     |S )Nrs   
categoriesT)r   
check_hash)r   r   metar   load_state_dictget_state_dict)rq   rr   r   r   r   models         r8   _resnetr      su     fmSl9S5T5TUUU5&++F++Eg44hSW4XXYYYLr:   r|   )min_sizer   c                   d    e Zd Z ed eed          i edddddd	id
ddd          ZeZdS )r   z9https://download.pytorch.org/models/resnet18-f37072fd.pth   	crop_sizei(^ Lhttps://github.com/pytorch/vision/tree/main/references/classification#resnetImageNet-1KgnpQ@gEDV@zacc@1zacc@5g/$?gS㥛TF@XThese weights reproduce closely the results of the paper using a simple training recipe.
num_paramsrecipe_metrics_ops
_file_size_docsurl
transformsr   N	r_   r`   ra   r   r   r   _COMMON_METAIMAGENET1K_V1DEFAULT r:   r8   r   r   8          GG7.#>>>

"d##     s
 
 
  M$ GGGr:   r   c                   d    e Zd Z ed eed          i edddddd	id
ddd          ZeZdS )r   z9https://download.pytorch.org/models/resnet34-b627a593.pthr   r   i(Lr   r   gjtTR@g{GV@r   gZd;O@gT@r   r   r   Nr   r   r:   r8   r   r   N  r   r:   r   c                       e Zd Z ed eed          i edddddd	id
ddd          Z ed eedd          i edddddd	id
ddd          ZeZ	dS )r   z9https://download.pytorch.org/models/resnet50-0676ba61.pthr   r   i(r   r   gQS@gI+7W@r   gB`"[@gDlqX@r   r   r   z9https://download.pytorch.org/models/resnet50-11ad3fa6.pth   r   resize_sizezEhttps://github.com/pytorch/vision/issues/3995#issuecomment-1013906621gx6T@gW@g(\rX@
                These weights improve upon the results of the original paper by using TorchVision's `new training recipe
                <https://pytorch.org/blog/how-to-train-state-of-the-art-models-using-torchvision-latest-primitives/>`_.
            N
r_   r`   ra   r   r   r   r   r   IMAGENET1K_V2r   r   r:   r8   r   r   d  s        GG7.#>>>

"d##     s
 
 
  M$ GG7.#3OOO

"]##    
 
 
  M* GGGr:   r   c                       e Zd Z ed eed          i edddddd	id
ddd          Z ed eedd          i edddddd	id
ddd          ZeZ	dS )r   z:https://download.pytorch.org/models/resnet101-63fe2227.pthr   r   i(ħr   r   g-WS@gmbW@r   gNbX94@g1ZPe@r   r   r   z:https://download.pytorch.org/models/resnet101-cd907fc2.pthr   r   8https://github.com/pytorch/vision/issues/3995#new-recipegbX9xT@gRW@g)\Pe@r   Nr   r   r:   r8   r   r     s        GH7.#>>>

"d##    !s
 
 
  M$ GH7.#3OOO

"P##     
 
 
  M* GGGr:   r   c                       e Zd Z ed eed          i edddddd	id
ddd          Z ed eedd          i edddddd	id
ddd          ZeZ	dS )r   z:https://download.pytorch.org/models/resnet152-394f9c45.pthr   r   i(xr   r   gS@gmW@r   gI+'@gSl@r   r   r   z:https://download.pytorch.org/models/resnet152-f82ba261.pthr   r   r   gV-T@g㥛  X@gI+l@r   Nr   r   r:   r8   r   r     s        GH7.#>>>

"d##    !s
 
 
  M$ GH7.#3OOO

"P##    !
 
 
  M* GGGr:   r   c                       e Zd Z ed eed          i edddddd	id
ddd          Z ed eedd          i edddddd	id
ddd          ZeZ	dS )r   z@https://download.pytorch.org/models/resnext50_32x4d-7cdf4587.pthr   r   i(}Mhttps://github.com/pytorch/vision/tree/main/references/classification#resnextr   gd;OgS@g&1lW@r   gQ@g"~W@r   r   r   z@https://download.pytorch.org/models/resnext50_32x4d-1a0047aa.pthr   r   r   g&1LT@g(\W@gZd;OW@r   Nr   r   r:   r8   r   r     s        GN7.#>>>

"e##     s
 
 
  M$ GN7.#3OOO

"P##     
 
 
  M* GGGr:   r   c                       e Zd Z ed eed          i edddddd	id
ddd          Z ed eedd          i edddddd	id
ddd          ZeZ	dS )r   zAhttps://download.pytorch.org/models/resnext101_32x8d-8ba56ff5.pthr   r   i(Jr   r   gS@glW@r   gDli0@gL7A`9u@r   r   r   zAhttps://download.pytorch.org/models/resnext101_32x8d-110c445d.pthr   r   Dhttps://github.com/pytorch/vision/issues/3995#new-recipe-with-fixresgL7A`T@g;OX@gT㥛:u@r   Nr   r   r:   r8   r   r     s        GO7.#>>>

"e##    !s
 
 
  M$ GO7.#3OOO

"\##    !
 
 
  M* GGGr:   r   c                   f    e Zd Z ed eedd          i eddddd	d
idddd          ZeZdS )r   zAhttps://download.pytorch.org/models/resnext101_64x4d-173b62eb.pthr   r   r   i(mz+https://github.com/pytorch/vision/pull/5935r   g9vT@gVX@r   gQ.@g+s@z
                These weights were trained from scratch by using TorchVision's `new training recipe
                <https://pytorch.org/blog/how-to-train-state-of-the-art-models-using-torchvision-latest-primitives/>`_.
            r   r   Nr   r   r:   r8   r   r   ;  s        GO7.#3OOO

"C##    !
 
 
  M* GGGr:   r   c                       e Zd Z ed eed          i edddddd	id
ddd          Z ed eedd          i edddddd	id
ddd          ZeZ	dS )r   z@https://download.pytorch.org/models/wide_resnet50_2-95faca4d.pthr   r   i(:https://github.com/pytorch/vision/pull/912#issue-445437439r   gˡES@g/$W@r   g&@g
ףp=z`@r   r   r   z@https://download.pytorch.org/models/wide_resnet50_2-9ba9bcbe.pthr   r   r   gJ+fT@gnW@gDlqp@r   Nr   r   r:   r8   r   r   T  s        GN7.#>>>

"R##     s
 
 
  M$ GN7.#3OOO

"\##    !
 
 
  M* GGGr:   r   c                       e Zd Z ed eed          i edddddd	id
ddd          Z ed eedd          i edddddd	id
ddd          ZeZ	dS )r   zAhttps://download.pytorch.org/models/wide_resnet101_2-32ee1156.pthr   r   i(#r   r   gʡES@gV-W@r   gT㥛6@g&1\n@r   r   r   zAhttps://download.pytorch.org/models/wide_resnet101_2-d733dc28.pthr   r   r   gq=
ףT@gzGX@gˡEK~@r   Nr   r   r:   r8   r   r     s        GO7.#>>>

#R##    !s
 
 
  M$ GO7.#3OOO

#P##    !
 
 
  M* GGGr:   r   
pretrained)r   T)r   r   c                 d    t                               |           } t          t          g d| |fi |S )ap  ResNet-18 from `Deep Residual Learning for Image Recognition <https://arxiv.org/abs/1512.03385>`__.

    Args:
        weights (:class:`~torchvision.models.ResNet18_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.ResNet18_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.resnet.ResNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py>`_
            for more details about this class.

    .. autoclass:: torchvision.models.ResNet18_Weights
        :members:
    )r   r   r   r   )r   verifyr   r>   r   r   r   s      r8   r    r      7    * %%g..G:|||WhII&IIIr:   c                 d    t                               |           } t          t          g d| |fi |S )ap  ResNet-34 from `Deep Residual Learning for Image Recognition <https://arxiv.org/abs/1512.03385>`__.

    Args:
        weights (:class:`~torchvision.models.ResNet34_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.ResNet34_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.resnet.ResNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py>`_
            for more details about this class.

    .. autoclass:: torchvision.models.ResNet34_Weights
        :members:
    r1   ri      r1   )r   r   r   r>   r   s      r8   r!   r!     r   r:   c                 d    t                               |           } t          t          g d| |fi |S )a  ResNet-50 from `Deep Residual Learning for Image Recognition <https://arxiv.org/abs/1512.03385>`__.

    .. note::
       The bottleneck of TorchVision places the stride for downsampling to the second 3x3
       convolution while the original paper places it to the first 1x1 convolution.
       This variant improves the accuracy and is known as `ResNet V1.5
       <https://ngc.nvidia.com/catalog/model-scripts/nvidia:resnet_50_v1_5_for_pytorch>`_.

    Args:
        weights (:class:`~torchvision.models.ResNet50_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.ResNet50_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.resnet.ResNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py>`_
            for more details about this class.

    .. autoclass:: torchvision.models.ResNet50_Weights
        :members:
    r   )r   r   r   rh   r   s      r8   r"   r"     s7    6 %%g..G:|||WhII&IIIr:   c                 d    t                               |           } t          t          g d| |fi |S )a  ResNet-101 from `Deep Residual Learning for Image Recognition <https://arxiv.org/abs/1512.03385>`__.

    .. note::
       The bottleneck of TorchVision places the stride for downsampling to the second 3x3
       convolution while the original paper places it to the first 1x1 convolution.
       This variant improves the accuracy and is known as `ResNet V1.5
       <https://ngc.nvidia.com/catalog/model-scripts/nvidia:resnet_50_v1_5_for_pytorch>`_.

    Args:
        weights (:class:`~torchvision.models.ResNet101_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.ResNet101_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.resnet.ResNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py>`_
            for more details about this class.

    .. autoclass:: torchvision.models.ResNet101_Weights
        :members:
    r1   ri      r1   )r   r   r   rh   r   s      r8   r#   r#     7    6  &&w//G:}}}gxJJ6JJJr:   c                 d    t                               |           } t          t          g d| |fi |S )a  ResNet-152 from `Deep Residual Learning for Image Recognition <https://arxiv.org/abs/1512.03385>`__.

    .. note::
       The bottleneck of TorchVision places the stride for downsampling to the second 3x3
       convolution while the original paper places it to the first 1x1 convolution.
       This variant improves the accuracy and is known as `ResNet V1.5
       <https://ngc.nvidia.com/catalog/model-scripts/nvidia:resnet_50_v1_5_for_pytorch>`_.

    Args:
        weights (:class:`~torchvision.models.ResNet152_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.ResNet152_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.resnet.ResNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py>`_
            for more details about this class.

    .. autoclass:: torchvision.models.ResNet152_Weights
        :members:
    )r1      $   r1   )r   r   r   rh   r   s      r8   r$   r$     r   r:   c                     t                               |           } t          |dd           t          |dd           t          t          g d| |fi |S )a  ResNeXt-50 32x4d model from
    `Aggregated Residual Transformation for Deep Neural Networks <https://arxiv.org/abs/1611.05431>`_.

    Args:
        weights (:class:`~torchvision.models.ResNeXt50_32X4D_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.ResNext50_32X4D_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.resnet.ResNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py>`_
            for more details about this class.
    .. autoclass:: torchvision.models.ResNeXt50_32X4D_Weights
        :members:
    r-       ru   ri   r   )r   r   r   r   rh   r   s      r8   r%   r%   >  s\    . &,,W55G&(B///&"3Q777:|||WhII&IIIr:   c                     t                               |           } t          |dd           t          |dd           t          t          g d| |fi |S )a  ResNeXt-101 32x8d model from
    `Aggregated Residual Transformation for Deep Neural Networks <https://arxiv.org/abs/1611.05431>`_.

    Args:
        weights (:class:`~torchvision.models.ResNeXt101_32X8D_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.ResNeXt101_32X8D_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.resnet.ResNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py>`_
            for more details about this class.
    .. autoclass:: torchvision.models.ResNeXt101_32X8D_Weights
        :members:
    r-   r   ru   r   r   )r   r   r   r   rh   r   s      r8   r&   r&   \  \    . '--g66G&(B///&"3Q777:}}}gxJJ6JJJr:   c                     t                               |           } t          |dd           t          |dd           t          t          g d| |fi |S )a  ResNeXt-101 64x4d model from
    `Aggregated Residual Transformation for Deep Neural Networks <https://arxiv.org/abs/1611.05431>`_.

    Args:
        weights (:class:`~torchvision.models.ResNeXt101_64X4D_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.ResNeXt101_64X4D_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.resnet.ResNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py>`_
            for more details about this class.
    .. autoclass:: torchvision.models.ResNeXt101_64X4D_Weights
        :members:
    r-   r@   ru   ri   r   )r   r   r   r   rh   r   s      r8   r'   r'   z  r   r:   c                     t                               |           } t          |dd           t          t          g d| |fi |S )a  Wide ResNet-50-2 model from
    `Wide Residual Networks <https://arxiv.org/abs/1605.07146>`_.

    The model is the same as ResNet except for the bottleneck number of channels
    which is twice larger in every block. The number of channels in outer 1x1
    convolutions is the same, e.g. last block in ResNet-50 has 2048-512-2048
    channels, and in Wide ResNet-50-2 has 2048-1024-2048.

    Args:
        weights (:class:`~torchvision.models.Wide_ResNet50_2_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.Wide_ResNet50_2_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.resnet.ResNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py>`_
            for more details about this class.
    .. autoclass:: torchvision.models.Wide_ResNet50_2_Weights
        :members:
    ru   ry   r   )r   r   r   r   rh   r   s      r8   r(   r(     sJ    8 &,,W55G&"3V<<<:|||WhII&IIIr:   c                     t                               |           } t          |dd           t          t          g d| |fi |S )a  Wide ResNet-101-2 model from
    `Wide Residual Networks <https://arxiv.org/abs/1605.07146>`_.

    The model is the same as ResNet except for the bottleneck number of channels
    which is twice larger in every block. The number of channels in outer 1x1
    convolutions is the same, e.g. last block in ResNet-101 has 2048-512-2048
    channels, and in Wide ResNet-101-2 has 2048-1024-2048.

    Args:
        weights (:class:`~torchvision.models.Wide_ResNet101_2_Weights`, optional): The
            pretrained weights to use. See
            :class:`~torchvision.models.Wide_ResNet101_2_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.resnet.ResNet``
            base class. Please refer to the `source code
            <https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py>`_
            for more details about this class.
    .. autoclass:: torchvision.models.Wide_ResNet101_2_Weights
        :members:
    ru   ry   r   )r   r   r   r   rh   r   s      r8   r)   r)     sJ    8 '--g66G&"3V<<<:}}}gxJJ6JJJr:   )r   r   r   )r   );	functoolsr   typingr   r   r   r   r   r	   r   torch.nnr6   r
   transforms._presetsr   utilsr   _apir   r   r   _metar   _utilsr   r   __all__rb   r7   r9   r<   rd   r>   rh   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r   r:   r8   <module>r      s	         = = = = = = = = = = = = = = = =              5 5 5 5 5 5 ' ' ' ' ' ' 6 6 6 6 6 6 6 6 6 6 ' ' ' ' ' ' B B B B B B B B  2 s  S c Y\ egen    V Vs V VS V V V V V
. . . . . . . .b7 7 7 7 7 7 7 7tw% w% w% w% w%RY w% w% w%tj*,-.I k" 	
     & &     {   ,    {   ,( ( ( ( ({ ( ( (V( ( ( ( ( ( ( (V( ( ( ( ( ( ( (V( ( ( ( (k ( ( (V( ( ( ( ({ ( ( (V    {   2( ( ( ( (k ( ( (V( ( ( ( ({ ( ( (V ,0@0N!OPPP6:T J J J"23 Jd J]` Jek J J J QP J0 ,0@0N!OPPP6:T J J J"23 Jd J]` Jek J J J QP J0 ,0@0N!OPPP6:T J J J"23 Jd J]` Jek J J J QP J< ,0A0O!PQQQ8<t K K K(#45 K K_b Kgm K K K RQ K< ,0A0O!PQQQ8<t K K K(#45 K K_b Kgm K K K RQ K< ,0G0U!VWWW484J J J01JDHJ[^JJ J J XW J8 ,0H0V!WXXX59DK K K12KEIK\_KK K K YX K8 ,0H0V!WXXX59DK K K12KEIK\_KK K K YX K8 ,0G0U!VWWW484J J J01JDHJ[^JJ J J XW J@ ,0H0V!WXXX59DK K K12KEIK\_KK K K YX K K Kr:   