boxes.utils module

boxes.utils.log1mexp(x: torch.Tensor, split_point=- 0.6931471805599453, exp_zero_eps=1e-07) → torch.Tensor

Computes log(1 - exp(x)).

Splits at x=log(1/2) for x in (-inf, 0] i.e. at -x=log(2) for -x in [0, inf).

= log1p(-exp(x)) when x <= log(1/2) or = log(-expm1(x)) when log(1/2) < x <= 0

For details, see

https://cran.r-project.org/web/packages/Rmpfr/vignettes/log1mexp-note.pdf

https://github.com/visinf/n3net/commit/31968bd49c7d638cef5f5656eb62793c46b41d76

boxes.utils.log1pexp(x: torch.Tensor)

Computes log(1+exp(x))

see: Page 7, eqn 10 of https://cran.r-project.org/web/packages/Rmpfr/vignettes/log1mexp-note.pdf also see: https://github.com/SurajGupta/r-source/blob/master/src/nmath/plogis.c