torch.init ​​https://pytorch.org/docs/stable/nn.html#torch-nn-init​

1. 均匀分布

​torch.nn.init.uniform_(tensor, a=0, b=1)​

服从~U(a,b)U(a, b)U(a,b)

2. 正太分布

​torch.nn.init.normal_(tensor, mean=0, std=1)​

服从~N(mean,std)N(mean, std)N(mean,std)

3. 初始化为常数

​torch.nn.init.constant_(tensor, val)​

初始化整个矩阵为常数​​val​

4. Xavier

基本思想是通过网络层时,输入和输出的方差相同,包括前向传播和后向传播,相关论文:Understanding the difficulty of training deep feedforward neural networks