Return entropy=None when entropy hasn't anal form

This commit is contained in:
Quentin Gallouédec 2022-11-29 13:10:41 +01:00
parent 6da012f9ab
commit 2065b7ae60

View file

@ -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: