-
-
Notifications
You must be signed in to change notification settings - Fork 984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a SoftLaplace distribution #2791
Conversation
if self._validate_args: | ||
self._validate_sample(value) | ||
z = (value - self.loc) / self.scale | ||
return math.log(2 / math.pi) - self.scale.log() - torch.logaddexp(z, -z) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make senses to me: logaddexp(z, -z) ~ |z|
in the tail and wolfram alpha shows the correct normalization factor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! It would be nice to include some gradient tests, which you taught me previously, but let's do it when more distributions need the test.
Thanks for reviewing @fehiepsi ! |
From the docs:
Tested