From 41c43126ad668bcf62b7ab7cf61046e91b08262d Mon Sep 17 00:00:00 2001 From: Xinyue7777 Date: Sun, 16 Mar 2025 00:28:57 +0300 Subject: [PATCH] Update submission_template04.py --- Deep Learning/submission_template04.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Deep Learning/submission_template04.py b/Deep Learning/submission_template04.py index 498fa3e..4a2113c 100644 --- a/Deep Learning/submission_template04.py +++ b/Deep Learning/submission_template04.py @@ -5,11 +5,18 @@ class ConvNet(nn.Module): def __init__(self): - ... + super(ConvNet, self).__init__() + self.conv1 = nn.Conv2d(1, 16, kernel_size=3, stride=1, padding=1) + self.pool = nn.MaxPool2d(kernel_size=2, stride=2) + self.conv2 = nn.Conv2d(16, 32, kernel_size=3, stride=1, padding=1) + self.fc1 = nn.Linear(32 * 7 * 7, 10) - def forward(self, x): - ... + x = self.pool(F.relu(self.conv1(x))) + x = self.pool(F.relu(self.conv2(x))) + x = x.view(-1, 32 * 7 * 7) + x = self.fc1(x) + return x def create_model(): return ConvNet()