1
0

make exp3 works but no check

This commit is contained in:
2025-12-06 13:10:02 +08:00
parent 1061780ea5
commit 45b60b269f
9 changed files with 254 additions and 72 deletions

View File

@@ -20,19 +20,6 @@ class Cnn(torch.nn.Module):
self.fc1 = torch.nn.Linear(64 * 3 * 3, 64)
self.fc2 = torch.nn.Linear(64, 10)
# 初始化模型参数
self.__initialize_weights()
def __initialize_weights(self):
# YYC MARK:
# 把两个全连接线性层按tensorflow默认设置初始化
# - kernel_initializer='glorot_uniform'
# - bias_initializer='zeros'
torch.nn.init.xavier_normal_(self.fc1.weight)
torch.nn.init.zeros_(self.fc1.bias)
torch.nn.init.xavier_normal_(self.fc2.weight)
torch.nn.init.zeros_(self.fc2.bias)
def forward(self, x):
x = F.relu(self.conv1(x))
x = self.pool1(x)