
    ڧg                     F   d dl mZ d dl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mZmZ dd	lmZ dd
lmZmZ g dZ G d dej                  Z G d de          Z e             edej        f          ddddee         dededefd                        ZdS )    )partial)AnyOptionalN   )ImageClassification)_log_api_usage_once   )register_modelWeightsWeightsEnum)_IMAGENET_CATEGORIES)_ovewrite_named_paramhandle_legacy_interface)AlexNetAlexNet_Weightsalexnetc                   R     e Zd Zd
dededdf fdZdej        dej        fd	Z xZ	S )r           ?num_classesdropoutreturnNc                 >   t                                                       t          |            t          j        t          j        ddddd          t          j        d          t          j        dd	          t          j        dd
dd          t          j        d          t          j        dd	          t          j        d
ddd          t          j        d          t          j        dddd          t          j        d          t          j        dddd          t          j        d          t          j        dd	                    | _        t          j	        d          | _
        t          j        t          j        |          t          j        dd          t          j        d          t          j        |          t          j        dd          t          j        d          t          j        d|                    | _        d S )N   @         r   )kernel_sizestridepaddingT)inplace)r   r         )r   r    i  r	      )   r%   )pi $  i   )super__init__r   nn
SequentialConv2dReLU	MaxPool2dfeaturesAdaptiveAvgPool2davgpoolDropoutLinear
classifier)selfr   r   	__class__s      V/var/www/html/ai-engine/env/lib/python3.11/site-packages/torchvision/models/alexnet.pyr(   zAlexNet.__init__   s   D!!!IaAqAAAGD!!!LQq111Ib#1a888GD!!!LQq111Ic3Aq999GD!!!Ic3Aq999GD!!!Ic3Aq999GD!!!LQq111
 
 +F33-J!!!Ik4((GD!!!J!!!IdD!!GD!!!IdK((
 
    xc                     |                      |          }|                     |          }t          j        |d          }|                     |          }|S )Nr	   )r.   r0   torchflattenr3   )r4   r8   s     r6   forwardzAlexNet.forward/   sI    MM!LLOOM!QOOAr7   )r   r   )
__name__
__module____qualname__intfloatr(   r:   Tensorr<   __classcell__)r5   s   @r6   r   r      s}        
 
C 
 
 
 
 
 
 
 
: %,        r7   r   c                   `    e Zd Z ed eed          ddedddd	d
idddd          ZeZdS )r   z<https://download.pytorch.org/models/alexnet-owt-7be5be79.pth   )	crop_sizei(S)?   rG   zUhttps://github.com/pytorch/vision/tree/main/references/classification#alexnet-and-vggzImageNet-1KgA`BL@gNbX9S@)zacc@1zacc@5g+?gX9"m@zz
                These weights reproduce closely the results of the paper using a simplified training recipe.
            )
num_paramsmin_size
categoriesrecipe_metrics_ops
_file_size_docs)url
transformsmetaN)	r=   r>   r?   r   r   r   r   IMAGENET1K_V1DEFAULT r7   r6   r   r   7   s|        GJ7.#>>>" .m##    !
 
  M* GGGr7   r   
pretrained)weightsT)rW   progressrW   rX   kwargsr   c                     t                               |           } | )t          |dt          | j        d                              t          di |}| *|                    |                     |d                     |S )a  AlexNet model architecture from `One weird trick for parallelizing convolutional neural networks <https://arxiv.org/abs/1404.5997>`__.

    .. note::
        AlexNet was originally introduced in the `ImageNet Classification with
        Deep Convolutional Neural Networks
        <https://papers.nips.cc/paper/2012/hash/c399862d3b9d6b76c8436e924a68c45b-Abstract.html>`__
        paper. Our implementation is based instead on the "One weird trick"
        paper above.

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

    .. autoclass:: torchvision.models.AlexNet_Weights
        :members:
    Nr   rJ   T)rX   
check_hashrU   )r   verifyr   lenrR   r   load_state_dictget_state_dict)rW   rX   rY   models       r6   r   r   P   s    : $$W--GfmSl9S5T5TUUUfEg44hSW4XXYYYLr7   )	functoolsr   typingr   r   r:   torch.nnr)   transforms._presetsr   utilsr   _apir
   r   r   _metar   _utilsr   r   __all__Moduler   r   rS   boolr   rU   r7   r6   <module>rl      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 4
3
3# # # # #bi # # #L    k   2 ,0M!NOOO484 % % %1 %D %[^ %cj % % % PO % % %r7   