From aed7ef00da32c3fe985e1e554781e985040db69e Mon Sep 17 00:00:00 2001 From: k-gorbenko <164647543+k-gorbenko@users.noreply.github.com> Date: Thu, 31 Oct 2024 21:39:03 +0300 Subject: [PATCH] Update submission_template04.py --- Deep Learning/submission_template04.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Deep Learning/submission_template04.py b/Deep Learning/submission_template04.py index 498fa3e..38ba55d 100644 --- a/Deep Learning/submission_template04.py +++ b/Deep Learning/submission_template04.py @@ -5,11 +5,33 @@ class ConvNet(nn.Module): def __init__(self): - ... + super().__init__() + + self.conv1 = nn.Conv2d(in_channels=3, out_channels=3, kernel_size=(5, 5)) + self.pool1 = nn.MaxPool2d(kernel_size=(2, 2)) + self.conv2 = nn.Conv2d(in_channels=3, out_channels=5, kernel_size=(3, 3)) + self.pool2 = nn.MaxPool2d(kernel_size=(2, 2)) + + self.flatten = nn.Flatten() + + self.fc1 = nn.Linear(in_features=5 * 6 * 6, out_features=100) + self.fc2 = nn.Linear(in_features=100, out_features=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()