Add numerically stable log1mexp = log(1 - exp(-|x|)) function #39242
Labels
enhancement
Not as big of a feature, but technically not a bug. Should be easy to fix
function request
A request for a new function or the addition of new arguments/modes to an existing function.
module: numerical-stability
Problems related to numerical stability of operations
triaged
This issue has been looked at a team member, and triaged and prioritized into an appropriate module
馃殌 Feature
Add the implementation for a numerically stable
log(1 - exp(-|x|))
function.See https://cran.r-project.org/web/packages/Rmpfr/vignettes/log1mexp-note.pdf
Ref https://www.rdocumentation.org/packages/VGAM/versions/1.1-3/topics/log1mexp
Motivation
The function can be implemented using other pytorch functions but it might be tricky to get it right.
Some implementations found on GitHub:
@wouterkool/estimating-gradients-without-replacement/blob/9d8bf8b/bernoulli/gumbel.py#L7-L11
@visinf/n3net/blob/5d5883a/src_denoising/models/non_local.py#L94-L108
cc: @wouterkool @visinf
The text was updated successfully, but these errors were encountered: