From b560fff7a976e599b91dd8710e20914d6929fb56 Mon Sep 17 00:00:00 2001 From: Kiersten Stokes Date: Wed, 1 Feb 2023 13:09:35 -0600 Subject: [PATCH 1/3] Change kernel to 5x5 in 1st Conv2d layer in model init Signed-off-by: Kiersten Stokes --- beginner_source/introyt/introyt1_tutorial.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beginner_source/introyt/introyt1_tutorial.py b/beginner_source/introyt/introyt1_tutorial.py index 801f8a21cf6..1d470417f96 100644 --- a/beginner_source/introyt/introyt1_tutorial.py +++ b/beginner_source/introyt/introyt1_tutorial.py @@ -176,9 +176,9 @@ class LeNet(nn.Module): def __init__(self): super(LeNet, self).__init__() - # 1 input image channel (black & white), 6 output channels, 3x3 square convolution + # 1 input image channel (black & white), 6 output channels, 5x5 square convolution # kernel - self.conv1 = nn.Conv2d(1, 6, 3) + self.conv1 = nn.Conv2d(1, 6, 5) self.conv2 = nn.Conv2d(6, 16, 3) # an affine operation: y = Wx + b self.fc1 = nn.Linear(16 * 6 * 6, 120) # 6*6 from image dimension From fe3ab3ab2c0ca8bec018da17a5670f62883f5b68 Mon Sep 17 00:00:00 2001 From: Kiersten Stokes Date: Mon, 6 Feb 2023 10:54:31 -0600 Subject: [PATCH 2/3] Change kernel to 5x5 in 2nd Conv2d layer in model init --- beginner_source/introyt/introyt1_tutorial.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beginner_source/introyt/introyt1_tutorial.py b/beginner_source/introyt/introyt1_tutorial.py index 1d470417f96..7c0c6a7f43d 100644 --- a/beginner_source/introyt/introyt1_tutorial.py +++ b/beginner_source/introyt/introyt1_tutorial.py @@ -179,7 +179,7 @@ def __init__(self): # 1 input image channel (black & white), 6 output channels, 5x5 square convolution # kernel self.conv1 = nn.Conv2d(1, 6, 5) - self.conv2 = nn.Conv2d(6, 16, 3) + 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.fc2 = nn.Linear(120, 84) From 15b0170ec46609d16e0fc1acc4916adb514638aa Mon Sep 17 00:00:00 2001 From: Kiersten Stokes Date: Mon, 6 Feb 2023 17:36:57 -0600 Subject: [PATCH 3/3] Fix dimensions of 1st Linear layer to match new expected size --- beginner_source/introyt/introyt1_tutorial.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beginner_source/introyt/introyt1_tutorial.py b/beginner_source/introyt/introyt1_tutorial.py index 7c0c6a7f43d..f52c3902c03 100644 --- a/beginner_source/introyt/introyt1_tutorial.py +++ b/beginner_source/introyt/introyt1_tutorial.py @@ -181,7 +181,7 @@ def __init__(self): 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) # 5*5 from image dimension self.fc2 = nn.Linear(120, 84) self.fc3 = nn.Linear(84, 10)