a
    þdD  ã                   @   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                       s@   e Zd ZdZdeeddœ‡ fdd„Zejejdœd	d
„Z‡  Z	S )ÚClassificationHeadam  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])
    é   é
   N)Ú
embed_sizeÚnum_classesÚreturnc                    s(   t ƒ  ¡  t |¡| _t ||¡| _d S )N)ÚsuperÚ__init__r   Z	LayerNormÚnormZLinearÚlinear)Úselfr   r   ©Ú	__class__© úf/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/kornia/contrib/classification.pyr
      s    
zClassificationHead.__init__)Úxr   c                 C   s   |  d¡}|  |  |¡¡S )Néþÿÿÿ)Úmeanr   r   )r   r   Úoutr   r   r   Úforward   s    
zClassificationHead.forward)r   r   )
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úintr
   ÚtorchZTensorr   Ú__classcell__r   r   r   r   r      s   r   )r   r   r   ÚModuler   r   r   r   r   Ú<module>   s   