Skip to content

Commit 4038dfd

Browse files
committed
Improve CNN visualizations
1 parent 02d1960 commit 4038dfd

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

9 Bytes
Binary file not shown.

‎CNN_pytorch/model/architectures.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ def __init__(self):
3838
)
3939

4040
# fully connected layer, output 10 classes
41-
self.fc1 = nn.Linear(32 * 7 * 7, 10)
42-
41+
self.fc = nn.Sequential(
42+
nn.Linear(32 * 7 * 7, 10)
43+
)
44+
4345
#now let's try a fancier way of initializing weights
4446
nn.init.kaiming_uniform_(self.CNN[0].weight,mode='fan_in', nonlinearity='relu')
4547
nn.init.kaiming_uniform_(self.CNN[3].weight,mode='fan_in', nonlinearity='relu')
@@ -62,7 +64,7 @@ def forward(self, x):
6264
"""
6365
x = self.CNN(x)
6466
x = x.view(x.size(0), -1)
65-
output = self.fc1(x)
67+
output = self.fc(x)
6668
return output, x # return x for visualization
6769

6870
def count_parameters(self):

0 commit comments

Comments
 (0)