o
    ß¥µi  ã                   @   s"   d dl mZ G dd„ dejƒZdS )é    Nc                       s*   e Zd ZdZd‡ fdd„	Zdd„ Z‡  ZS )ÚClassifierHeadzòThe implementation of classification head.

    Attributes:
        dim: An integer indicating the hidden dimension.
        num_classes: A string indicating the number of class.
        dropout_rate: A float indicating the dropout rate.
    r   c                    s<   t ƒ  ¡  || _|| _|dkrt |¡| _t ||¡| _d S )Ng        )	ÚsuperÚ__init__ÚdimÚnum_classesÚnnÚDropoutÚdropoutÚLinearÚfc)Úselfr   r   Údropout_rate©Ú	__class__© úe/home/ubuntu/.local/lib/python3.10/site-packages/modelscope/models/cv/vision_efficient_tuning/head.pyr      s   
zClassifierHead.__init__c                 C   s   t | dƒr
|  |¡}|  |¡S )Nr	   )Úhasattrr	   r   )r   Úxr   r   r   Úforward   s   


zClassifierHead.forward)r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Ú__classcell__r   r   r   r   r      s    r   )Útorch.nnr   ÚModuler   r   r   r   r   Ú<module>   s   