o
    æS™iK  ã                   @   s>   d Z ddlZddlZddlZddlmZ G dd„ dejƒZdS )zNormalization modules.é    N)Únnc                       sF   e Zd ZdZdejeeje ej	f f‡ fdd„Z
‡ fdd„Z‡  ZS )ÚConvLayerNormzª
    Convolution-friendly LayerNorm that moves channels to last dimensions
    before running the normalization and moves them back to original position right after.
    Únormalized_shapec                    s   t ƒ j|fi |¤Ž d S )N)ÚsuperÚ__init__)Úselfr   Úkwargs©Ú	__class__© úH/home/ubuntu/.local/lib/python3.10/site-packages/encodec/modules/norm.pyr      s   zConvLayerNorm.__init__c                    s(   t  |d¡}tƒ  |¡}t  |d¡}d S )Nzb ... t -> b t ...zb t ... -> b ... t)ÚeinopsÚ	rearranger   Úforward)r   Úxr	   r   r   r      s   zConvLayerNorm.forward)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚtpÚUnionÚintÚListÚtorchÚSizer   r   Ú__classcell__r   r   r	   r   r      s    &r   )r   Útypingr   r   r   r   Ú	LayerNormr   r   r   r   r   Ú<module>   s   