Skip to content

Commit

Permalink
Use the build in function
Browse files Browse the repository at this point in the history
  • Loading branch information
Pau Riba committed Nov 6, 2024
1 parent 4cc9ab0 commit ef794c7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torchrl/objectives/ppo.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ def reset(self) -> None:
def get_entropy_bonus(self, dist: d.Distribution) -> torch.Tensor:
try:
entropy = dist.entropy()
if isinstance(entropy, TensorDict) and hasattr(dist, "entropy_key"):
if is_tensor_collection(entropy) and hasattr(dist, "entropy_key"):
entropy = entropy.get(dist.entropy_key).unsqueeze(-1)
except NotImplementedError:
x = dist.rsample((self.samples_mc_entropy,))
Expand Down

0 comments on commit ef794c7

Please sign in to comment.