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

Add epsilon for numerical stability.

parent 58bf0770
No related branches found
No related tags found
No related merge requests found
......@@ -86,7 +86,9 @@ class BernoulliGammaLoss(NaNLoss):
# Gamma contribution
loss += p_true * (torch.log(p_pred + self.epsilon) + (gshape - 1) *
torch.log(y_true + self.epsilon) - (y_true / gscale)
- gshape * torch.log(gscale) - torch.lgamma(gshape))
torch.log(y_true + self.epsilon) -
y_true / (gscale + self.epsilon) -
gshape * torch.log(gscale + self.epsilon) -
torch.lgamma(gshape + self.epsilon))
return - self.reduce(loss)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment