o
    #ÕjC  ã                   @   s.   d dl Z d dl mZ g ZG dd„ dejƒZdS )é    N)Únnc                       s*   e Zd ZdZd‡ fdd„	Zdd„ Z‡  ZS )ÚLeNetaœ  LeNet model from
    `"Gradient-based learning applied to document recognition" <https://ieeexplore.ieee.org/document/726791>`_.

    Args:
        num_classes (int, optional): Output dim of last fc layer. If num_classes <= 0, last fc layer
            will not be defined. Default: 10.

    Returns:
        :ref:`api_paddle_nn_Layer`. An instance of LeNet model.

    Examples:
        .. code-block:: python

            >>> import paddle
            >>> from paddle.vision.models import LeNet

            >>> model = LeNet()

            >>> x = paddle.rand([1, 1, 28, 28])
            >>> out = model(x)

            >>> print(out.shape)
            [1, 10]
    é
   c                    s–   t ƒ  ¡  || _t tjddddddt ¡ t dd¡tjddddddt ¡ t dd¡¡| _|dkrIt t 	d	d
¡t 	d
d¡t 	d|¡¡| _
d S d S )Né   é   é   )ZstrideÚpaddingé   é   é   r   i  éx   éT   )ÚsuperÚ__init__Únum_classesr   Z
SequentialZConv2DZReLUZ	MaxPool2DÚfeaturesZLinearÚfc)Úselfr   ©Ú	__class__© ú[/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/paddle/vision/models/lenet.pyr   /   s"   


ú	



ýÿzLeNet.__init__c                 C   s.   |   |¡}| jdkrt |d¡}|  |¡}|S )Nr   r   )r   r   ÚpaddleÚflattenr   )r   ZinputsÚxr   r   r   ÚforwardB   s
   


zLeNet.forward)r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Ú__classcell__r   r   r   r   r      s    r   )r   r   Ú__all__ZLayerr   r   r   r   r   Ú<module>   s   