teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

修正

2021/12/09 13:13

投稿

tiitoi
tiitoi

スコア21960

answer CHANGED
@@ -1,5 +1,9 @@
1
1
  以下のようにすれば、モデルの FC 層の重みをすべて0にできます。
2
2
 
3
+ [Pytorch - 重みの初期化手法と各モジュールのデフォルトの初期化方法](https://pystyle.info/pytorch-parameters-initialization/)
4
+
5
+
6
+
3
7
  ```python
4
8
  import torch.nn as nn
5
9
 
@@ -7,6 +11,4 @@
7
11
  if isinstance(m, nn.Linear):
8
12
  nn.init.zeros_(m.weight)
9
13
  nn.init.zeros_(m.bias)
10
- ```
14
+ ```
11
-
12
- [Pytorch - 重みの初期化手法と各モジュールのデフォルトの初期化方法](https://pystyle.info/pytorch-parameters-initialization/)

1

修正

2021/12/09 13:13

投稿

tiitoi
tiitoi

スコア21960

answer CHANGED
@@ -7,4 +7,6 @@
7
7
  if isinstance(m, nn.Linear):
8
8
  nn.init.zeros_(m.weight)
9
9
  nn.init.zeros_(m.bias)
10
- ```
10
+ ```
11
+
12
+ [Pytorch - 重みの初期化手法と各モジュールのデフォルトの初期化方法](https://pystyle.info/pytorch-parameters-initialization/)