o
    ίi&                  
   @   sz   d dl Z d dlmZ d dlmZ d dlmZmZ d dlZeG dd dZ	de	de
d	ee
 d
eejgejf fddZdS )    N)	dataclass)partial)CallableOptionalc                   @   s6   e Zd ZU dZeed< dZee ed< dZ	eed< dS )InitArgsTuse_gaussianN	coeff_stdFno_init)
__name__
__module____qualname__r   bool__annotations__r   r   floatr	    r   r   >/home/ubuntu/.local/lib/python3.10/site-packages/core/utils.pyr   	   s   
 r   args	input_dim
init_depthreturnc                 C   s   | j rdd S dt| }| jdu r|n| j| }|dur'|td|  }| jr:ttjjj	d|d| d| d	S td| }ttjjj
| |d
S )z
    Init functions.
    c                 S   s   | S )Nr   )xr   r   r   <lambda>   s    zget_init_fn.<locals>.<lambda>   N   g           )meanstdab)r   r   )r	   mathsqrtr   r   r   torchnninittrunc_normal_uniform_)r   r   r   r   boundr   r   r   get_init_fn   s   r(   )r    dataclassesr   	functoolsr   typingr   r   r"   r   intTensorr(   r   r   r   r   <module>   s     