From 66dc9e2ec715ff652a7689af9ee83b5eeaa44995 Mon Sep 17 00:00:00 2001
From: Yandi <yandirzm@gmail.com>
Date: Sat, 4 Feb 2023 14:12:41 +0100
Subject: [PATCH] adding relu at the end of lstm to avoid NaN

---
 logs/main_unit_test.log | 15 +++++++++++++++
 model.py                |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/logs/main_unit_test.log b/logs/main_unit_test.log
index be53f85..01a62c2 100644
--- a/logs/main_unit_test.log
+++ b/logs/main_unit_test.log
@@ -2527,3 +2527,18 @@ INFO:root:The loaded dataset contains 25 latitudes, 37 longitudes, 28 depths and
 INFO:root:Loading the index from sub_2CMEMS-MEDSEA-2010-2016-training.nc.bin_index.idx
 INFO:root:  - The train fold has 541893 samples
 INFO:root:  - The valid fold has 135267 samples
+INFO:root:= Dataloaders
+INFO:root:  - Dataset creation
+INFO:root:The loaded dataset contains 25 latitudes, 37 longitudes, 28 depths and 2222 time points
+INFO:root:Generating the index
+INFO:root:Loading the index from sub_2CMEMS-MEDSEA-2010-2016-training.nc.bin_index.idx
+INFO:root:  - Loaded a dataset with 677160 samples
+INFO:root:  - Splitting the data in training and validation sets
+INFO:root:Generating the subset files from 677160 samples
+INFO:root:  - Subset dataset
+INFO:root:The loaded dataset contains 25 latitudes, 37 longitudes, 28 depths and 2222 time points
+INFO:root:Loading the index from sub_2CMEMS-MEDSEA-2010-2016-training.nc.bin_index.idx
+INFO:root:The loaded dataset contains 25 latitudes, 37 longitudes, 28 depths and 2222 time points
+INFO:root:Loading the index from sub_2CMEMS-MEDSEA-2010-2016-training.nc.bin_index.idx
+INFO:root:  - The train fold has 541719 samples
+INFO:root:  - The valid fold has 135441 samples
diff --git a/model.py b/model.py
index a16c567..e9e91ef 100644
--- a/model.py
+++ b/model.py
@@ -112,6 +112,8 @@ class BidirectionalLSTM(nn.Module):
         out, (hidden_state, cell_state) = self.lstm(x, (h0, c0))
 
         result = self.fc(out)
+        
+        result = nn.ReLU()(result)
         return result
 
 
-- 
GitLab