From 2065b7ae60e379ae5f6ea8aec20e9f0afe4fba8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Gallou=C3=A9dec?= <45557362+qgallouedec@users.noreply.github.com> Date: Tue, 29 Nov 2022 13:10:41 +0100 Subject: [PATCH] Return entropy=None when entropy hasn't anal form --- stable_baselines3/common/policies.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stable_baselines3/common/policies.py b/stable_baselines3/common/policies.py index c084872..b263a1b 100644 --- a/stable_baselines3/common/policies.py +++ b/stable_baselines3/common/policies.py @@ -628,7 +628,10 @@ class ActorCriticPolicy(BasePolicy): distribution = self._get_action_dist_from_latent(latent_pi) log_prob = distribution.log_prob(actions) values = self.value_net(latent_vf) - entropy = distribution.entropy() + try: + entropy = distribution.entropy() + except NotImplementedError: + entropy = None return values, log_prob, entropy def get_distribution(self, obs: th.Tensor) -> Distribution: