From b894370fdd4509ea5a8fde547675a5d93f8f2616 Mon Sep 17 00:00:00 2001 From: Sergey <125606014+Sergey-Pidenko@users.noreply.github.com> Date: Sat, 7 Oct 2023 14:47:33 +0300 Subject: [PATCH] Update submission_template01.py --- Deep Learning/submission_template01.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Deep Learning/submission_template01.py b/Deep Learning/submission_template01.py index 1a8ded3..653fe8c 100644 --- a/Deep Learning/submission_template01.py +++ b/Deep Learning/submission_template01.py @@ -3,13 +3,19 @@ from torch import nn def create_model(): - # your code here - # return model instance (None is just a placeholder) + model = nn.Sequential(nn.Linear(784, 256), + nn.ReLU(), + nn.Linear(256, 16), + nn.ReLU(), + nn.Linear(16, 10)) - return None + return model def count_parameters(model): - # your code here - # return integer number (None is just a placeholder) - - return None + cnt = 0 + for i in model.parameters(): + if i.requires_grad == False: + continue + cnt += i.numel() + # верните количество параметров модели model + return cnt