From 4d61174922917f675b1f04eda9181e62172e66e8 Mon Sep 17 00:00:00 2001 From: louisPoulain Date: Fri, 13 Sep 2024 11:16:51 +0200 Subject: [PATCH] Fix - tf.log does not exist --- mlpp_lib/probabilistic_layers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mlpp_lib/probabilistic_layers.py b/mlpp_lib/probabilistic_layers.py index 77eb5fb..c6904b9 100644 --- a/mlpp_lib/probabilistic_layers.py +++ b/mlpp_lib/probabilistic_layers.py @@ -391,9 +391,9 @@ def _log_prob(self, value): cdf = lambda x: tfd.Normal(0, 1).cdf(x) pdf = lambda x: tfd.Normal(0, 1).prob(x) - logprob_left = lambda x: tf.log(cdf(-mu / sigma) + 1e-3) + logprob_left = lambda x: tf.math.log(cdf(-mu / sigma) + 1e-3) logprob_middle = lambda x: self.normal.log_prob(x) - logprob_right = lambda x: tf.log(1 - cdf((1 - mu) / sigma) + 1e-3) + logprob_right = lambda x: tf.math.log(1 - cdf((1 - mu) / sigma) + 1e-3) return logprob_left(value) + logprob_middle(value) + logprob_right(value)