From 39666197ba6ae08599eb7ad0d8e96b084bd96298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=BChle=2C=20Laura=20Christine=20=28lakue103=29?= <laura.kuehle@uni-duesseldorf.de> Date: Wed, 7 Apr 2021 21:10:43 +0200 Subject: [PATCH] Changed layer naming temporarily for consistency with older models. --- ANN_Model.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ANN_Model.py b/ANN_Model.py index 59821a3..ab25ee9 100644 --- a/ANN_Model.py +++ b/ANN_Model.py @@ -3,6 +3,7 @@ @author: Laura C. Kühle, Soraya Terrab (sorayaterrab) TODO: Combine all ThreeLayerNet classes in one class -> Done +TODO: Change naming temporarily for consistency with older models -> Done (later) INFO: /home/laura/anaconda3/lib/python3.7/site-packages/torch/nn/modules @@ -30,15 +31,15 @@ class ThreeLayerReLu(torch.nn.Module): self._name = self.__class__.__name__ + '_' + str(first_hidden_size) + '_' + str(second_hidden_size) + '_'\ + activation_function - self._input_layer = torch.nn.Linear(input_size, first_hidden_size) - self._first_hidden_layer = torch.nn.Linear(first_hidden_size, second_hidden_size) - self._second_hidden_layer = torch.nn.Linear(second_hidden_size, output_size) + self.input_linear = torch.nn.Linear(input_size, first_hidden_size) + self.middle_linear = torch.nn.Linear(first_hidden_size, second_hidden_size) + self.output_linear = torch.nn.Linear(second_hidden_size, output_size) self._output_layer = getattr(torch.nn.modules.activation, activation_function)(**activation_config) def forward(self, input_data): - prediction = self._input_layer(input_data).clamp(min=0) - prediction = self._first_hidden_layer(prediction).clamp(min=0) - prediction = self._second_hidden_layer(prediction) + prediction = self.input_linear(input_data).clamp(min=0) + prediction = self.middle_linear(prediction).clamp(min=0) + prediction = self.output_linear(prediction) prediction = self._output_layer(prediction) return prediction -- GitLab