From 5a8cd3ef460233d83c00f5f6b50f5456b952618b Mon Sep 17 00:00:00 2001 From: Davide Grilli Date: Thu, 14 May 2026 16:08:18 +0200 Subject: [PATCH] fix: normalizza x in forward() dividendo per L Rende la normalizzazione degli input simmetrica: x/L e t/T_END entrambi in [0,1], indipendentemente dal valore di L in config. Co-Authored-By: Claude Sonnet 4.6 --- model.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/model.py b/model.py index 47bfb5e..5f003a2 100644 --- a/model.py +++ b/model.py @@ -14,8 +14,7 @@ class HeatPINN(nn.Module): self.net = nn.Sequential(*layers) def forward(self, xt): - # Normalize t to [0,1] to avoid Tanh saturation for large t values (up to T_END) - x = xt[:, :1] + x = xt[:, :1] / config.L t = xt[:, 1:] / config.T_END return config.T_AMB + (config.Q_VAL * config.L / config.K) * self.net(torch.cat([x, t], dim=1))