[Pytorch] Initializer (torch.nn.init)
2021. 6. 15. 15:22ㆍDeep Learning/framework
728x90
torch.nn.init의 간단한 initializer들을 살펴보겠다
xavier같은 초기화기법들은 따로 다루기
1.
torch.nn.init.normal_(tensor, mean=0.0, std=1.0)
input tensor을 N(mean, std^2)의 normal distribution(정규분포)에 따라 초기화
2.
torch.nn.init.uniform_(tensor, a=0.0, b=1.0)
input tensor을 U(a, b)의 uniform distribution에 따라 초기화
* uniform distribution ? [a, b]의 범위에서 모든 값의 확률이 동일한 분포

3.
torch.nn.init.constant_(tensor, val)
input tensor를 특정 값 val로 채움
4.
torch.nn.init.ones_(tensor)
torch.nn.init.zeros_(tensor)
1로 초기화
0으로 초기화
728x90
'Deep Learning > framework' 카테고리의 다른 글
[pytorch] nn.Upsample (0) | 2021.06.16 |
---|---|
[Pytorch] nn.ReflectionPad2d (0) | 2021.06.16 |
[Pytorch] Tensor 의 .view()메소드 / .reshape()메소드 (0) | 2021.05.24 |
[Pytorch] torch.sort (0) | 2021.05.22 |
[Pytorch] torch.no_grad (0) | 2021.05.22 |