Avoid torch type-error under torch.compile (#1922)

* Avoid torch type-error under torch.compile

* Update changelog and version

* Update stable_baselines3/common/buffers.py

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>

---------

Co-authored-by: Antonin Raffin <antonin.raffin@ensta.org>
This commit is contained in:
Andrew James 2024-05-13 10:28:23 -05:00 committed by GitHub
parent 285e01f64a
commit 766b9e9f7d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 2 deletions

View file

@ -14,6 +14,7 @@ New Features:
Bug Fixes:
^^^^^^^^^^
- Cast type in compute gae method to avoid error when using torch compile (@amjames)
`SB3-Contrib`_
^^^^^^^^^^^^^^

View file

@ -424,7 +424,7 @@ class RolloutBuffer(BaseBuffer):
last_gae_lam = 0
for step in reversed(range(self.buffer_size)):
if step == self.buffer_size - 1:
next_non_terminal = 1.0 - dones
next_non_terminal = 1.0 - dones.astype(np.float32)
next_values = last_values
else:
next_non_terminal = 1.0 - self.episode_starts[step + 1]

View file

@ -1 +1 @@
2.3.2
2.4.0a0