Skip to content

Commit

Permalink
Use expm1 instead of exp - 1
Browse files Browse the repository at this point in the history
  • Loading branch information
kit1980 committed Dec 24, 2024
1 parent 7715ff4 commit c300c83
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion botorch/test_functions/multi_objective.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ def penicillin_vectorized(cls, X_input: Tensor) -> Tensor:
F_loss = (
V[active]
* cls.lambd
* (torch.exp(5 * ((T[active] - cls.T_o) / (cls.T_v - cls.T_o))) - 1)
* torch.special.expm1(5 * ((T[active] - cls.T_o) / (cls.T_v - cls.T_o)))
)
dV_dt = F[active] - F_loss
mu = (
Expand Down
2 changes: 1 addition & 1 deletion test/models/transforms/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_norm_to_lognorm(self):
mu_ln_expected = torch.tensor(
[1.0, 2.0, 3.0], device=self.device, dtype=dtype
)
var_ln_expected = (torch.exp(var) - 1) * mu_ln_expected**2
var_ln_expected = torch.special.expm1(var) * mu_ln_expected**2
self.assertAllClose(mu_ln, mu_ln_expected)
self.assertAllClose(var_ln, var_ln_expected)

Expand Down

0 comments on commit c300c83

Please sign in to comment.