o
    €o™i¹  ã                   @   s.   d Z ddlZddlmZ G dd„ dejƒZdS )z/Module containing utilities for classification.é    N)Únnc                       sF   e Zd ZdZddededdf‡ fdd	„Zd
ejdejfdd„Z‡  Z	S )ÚClassificationHeadan  Module to be used as a classification head.

    Args:
        embed_size: the logits tensor coming from the networks.
        num_classes: an integer representing the numbers of classes to classify.

    Example:
        >>> feat = torch.rand(1, 256, 256)
        >>> head = ClassificationHead(256, 10)
        >>> head(feat).shape
        torch.Size([1, 10])

    é   é
   Ú
embed_sizeÚnum_classesÚreturnNc                    s(   t ƒ  ¡  t |¡| _t ||¡| _d S )N)ÚsuperÚ__init__r   Ú	LayerNormÚnormÚLinearÚlinear)Úselfr   r   ©Ú	__class__© úQ/home/ubuntu/.local/lib/python3.10/site-packages/kornia/contrib/classification.pyr
   '   s   
zClassificationHead.__init__Úxc                 C   s   |  d¡}|  |  |¡¡S )Néþÿÿÿ)Úmeanr   r   )r   r   Úoutr   r   r   Úforward,   s   
zClassificationHead.forward)r   r   )
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úintr
   ÚtorchÚTensorr   Ú__classcell__r   r   r   r   r      s    r   )r   r   r   ÚModuler   r   r   r   r   Ú<module>   s   