o
    oi                     @  s^   d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	 G dd deZ
G dd	 d	ejZd
S )zBased from the original code from Meta Platforms, Inc. and affiliates.

https://github.com/facebookresearch/segment-
anything/blob/3518c86b78b3bc9cf4fbe3d18e682fad1c79dc51/segment_anything/modeling/common.py
    )annotations)Any)nn)ModuleTensorc                      s.   e Zd Zejfd fdd	ZdddZ  ZS )MLPBlockembedding_dimintmlp_dimacttype[Module]returnNonec                   s2   t    t||| _t||| _| | _d S N)super__init__r   Linearlin1lin2r   )selfr   r
   r   	__class__ a/home/ubuntu/.local/lib/python3.10/site-packages/kornia/contrib/models/sam/architecture/common.pyr   "   s   
zMLPBlock.__init__xr   c                 C  s   |  | | |S r   )r   r   r   )r   r   r   r   r   forward(   s   zMLPBlock.forward)r   r	   r
   r	   r   r   r   r   )r   r   r   r   )__name__
__module____qualname__r   GELUr   r   __classcell__r   r   r   r   r   !   s    r   c                      s   e Zd Zd fddZ  ZS )		LayerNormargsr   kwargsr   r   c                   s   t  j|i | d| _d S )Ngư>)r   r   eps)r   r"   r#   r   r   r   r   -   s   
zLayerNorm.__init__)r"   r   r#   r   r   r   )r   r   r   r   r    r   r   r   r   r!   ,   s    r!   N)__doc__
__future__r   typingr   torchr   kornia.corer   r   r   r!   r   r   r   r   <module>   s   