From 292da40642511e49c598453678f98caef7b49849 Mon Sep 17 00:00:00 2001
From: "Daniel.Frisinghelli" <daniel.frisinghelli@eurac.edu>
Date: Thu, 7 Oct 2021 09:23:37 +0200
Subject: [PATCH] Handle infinite values for Weibull.

---
 climax/core/loss.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/climax/core/loss.py b/climax/core/loss.py
index 43e2f12..4758b46 100644
--- a/climax/core/loss.py
+++ b/climax/core/loss.py
@@ -199,4 +199,5 @@ class BernoulliWeibullLoss(NaNLoss):
                           (gshape - 1) * torch.log(y_true + self.epsilon) -
                           (y_true / (gscale + self.epsilon)) ** gshape)
 
-        return self.reduce(loss)
+        # handle +-infinity values resulting from initialization
+        return self.reduce(loss[torch.isfinite(loss)])
-- 
GitLab