From ce84ebbb764bef14e982076b5ca7d8906ac0db78 Mon Sep 17 00:00:00 2001 From: Karan Jeswani <34395853+codewithkaranjeswani@users.noreply.github.com> Date: Tue, 24 Mar 2020 16:54:49 +0530 Subject: [PATCH] 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. --- beginner_source/blitz/neural_networks_tutorial.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/beginner_source/blitz/neural_networks_tutorial.py b/beginner_source/blitz/neural_networks_tutorial.py index 144dd3d144f..3352bef5fbf 100644 --- a/beginner_source/blitz/neural_networks_tutorial.py +++ b/beginner_source/blitz/neural_networks_tutorial.py @@ -48,10 +48,10 @@ def __init__(self): super(Net, self).__init__() # 1 input image channel, 6 output channels, 3x3 square convolution # kernel - self.conv1 = nn.Conv2d(1, 6, 3) - self.conv2 = nn.Conv2d(6, 16, 3) + self.conv1 = nn.Conv2d(1, 6, 5) + self.conv2 = nn.Conv2d(6, 16, 5) # an affine operation: y = Wx + b - self.fc1 = nn.Linear(16 * 6 * 6, 120) # 6*6 from image dimension + self.fc1 = nn.Linear(16 * 5 * 5, 120) # 6*6 from image dimension self.fc2 = nn.Linear(120, 84) self.fc3 = nn.Linear(84, 10) @@ -99,7 +99,7 @@ def num_flat_features(self, x): print(out) ######################################################################## -# Zero the gradient buffers of all parameters and backprops with random +# Zero the gradient buffers of all parameters and backprop with random # gradients: net.zero_grad() out.backward(torch.randn(1, 10))