Skip to content

Commit ce84ebb

Browse files
Incorrect dimensions in layers
The dimensions in the tutorial don't match with the image. The first and second convolution layers have incorrect dimensions. The tutorial code has the correct thing.
1 parent d7a19a9 commit ce84ebb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

beginner_source/blitz/neural_networks_tutorial.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ def __init__(self):
4848
super(Net, self).__init__()
4949
# 1 input image channel, 6 output channels, 3x3 square convolution
5050
# kernel
51-
self.conv1 = nn.Conv2d(1, 6, 3)
52-
self.conv2 = nn.Conv2d(6, 16, 3)
51+
self.conv1 = nn.Conv2d(1, 6, 5)
52+
self.conv2 = nn.Conv2d(6, 16, 5)
5353
# an affine operation: y = Wx + b
54-
self.fc1 = nn.Linear(16 * 6 * 6, 120) # 6*6 from image dimension
54+
self.fc1 = nn.Linear(16 * 5 * 5, 120) # 6*6 from image dimension
5555
self.fc2 = nn.Linear(120, 84)
5656
self.fc3 = nn.Linear(84, 10)
5757

@@ -99,7 +99,7 @@ def num_flat_features(self, x):
9999
print(out)
100100

101101
########################################################################
102-
# Zero the gradient buffers of all parameters and backprops with random
102+
# Zero the gradient buffers of all parameters and backprop with random
103103
# gradients:
104104
net.zero_grad()
105105
out.backward(torch.randn(1, 10))

0 commit comments

Comments
 (0)