Skip to content
Snippets Groups Projects
Commit 58bf0770 authored by Frisinghelli Daniel's avatar Frisinghelli Daniel
Browse files

Add epsilon for numerical stability.

parent 7268c51e
No related branches found
No related tags found
No related merge requests found
......@@ -82,7 +82,7 @@ class BernoulliGammaLoss(NaNLoss):
# negative log-likelihood function of Bernoulli-Gamma distribution
# Bernoulli contribution
loss = (1 - p_true) * torch.log(1 - p_pred)
loss = (1 - p_true) * torch.log(1 - p_pred + self.epsilon)
# Gamma contribution
loss += p_true * (torch.log(p_pred + self.epsilon) + (gshape - 1) *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment