From bf9400e0ed157bb3272e7ad0cdf8466a154fd706 Mon Sep 17 00:00:00 2001 From: Xinyue7777 Date: Sun, 16 Mar 2025 12:55:51 +0300 Subject: [PATCH] Update submission_template04.py --- Deep Learning/submission_template04.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Deep Learning/submission_template04.py b/Deep Learning/submission_template04.py index 498fa3e..f9c59b7 100644 --- a/Deep Learning/submission_template04.py +++ b/Deep Learning/submission_template04.py @@ -5,11 +5,27 @@ class ConvNet(nn.Module): def __init__(self): - ... - + super().__init__() + self.conv1 = nn.Conv2d(in_channels=3, out_channels=3, kernel_size=5) + self.pool1 = nn.MaxPool2d(kernel_size=2) + self.conv2 = nn.Conv2d(in_channels=3, out_channels=5, kernel_size=3) + self.pool2 = nn.MaxPool2d(kernel_size=2) + self.flatten = nn.Flatten() + self.fc1 = nn.Linear(5 * 6 * 6, 100) + self.fc2 = nn.Linear(100, 10) def forward(self, x): - ... + x = self.conv1(x) + x = F.relu(x) + x = self.pool1(x) + x = self.conv2(x) + x = F.relu(x) + x = self.pool2(x) + x = self.flatten(x) + x = self.fc1(x) + x = F.relu(x) + x = self.fc2(x) + return x def create_model(): return ConvNet()