Skip to content

Commit 3764368

Browse files
kiersten-stokessubramenSvetlana Karslioglu
authored
Fix kernel dimensions for LeNet model code example (#2192)
* Change kernel to 5x5 in 1st Conv2d layer in model init Signed-off-by: Kiersten Stokes <kierstenstokes@gmail.com> * Change kernel to 5x5 in 2nd Conv2d layer in model init * Fix dimensions of 1st Linear layer to match new expected size --------- Signed-off-by: Kiersten Stokes <kierstenstokes@gmail.com> Co-authored-by: Suraj Subramanian <5676233+suraj813@users.noreply.github.com> Co-authored-by: Svetlana Karslioglu <svekars@fb.com>
1 parent 327f259 commit 3764368

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

beginner_source/introyt/introyt1_tutorial.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,12 @@ class LeNet(nn.Module):
176176

177177
def __init__(self):
178178
super(LeNet, self).__init__()
179-
# 1 input image channel (black & white), 6 output channels, 3x3 square convolution
179+
# 1 input image channel (black & white), 6 output channels, 5x5 square convolution
180180
# kernel
181-
self.conv1 = nn.Conv2d(1, 6, 3)
182-
self.conv2 = nn.Conv2d(6, 16, 3)
181+
self.conv1 = nn.Conv2d(1, 6, 5)
182+
self.conv2 = nn.Conv2d(6, 16, 5)
183183
# an affine operation: y = Wx + b
184-
self.fc1 = nn.Linear(16 * 6 * 6, 120) # 6*6 from image dimension
184+
self.fc1 = nn.Linear(16 * 5 * 5, 120) # 5*5 from image dimension
185185
self.fc2 = nn.Linear(120, 84)
186186
self.fc3 = nn.Linear(84, 10)
187187

0 commit comments

Comments
 (0)