Skip to content

Commit

Permalink
refactor: refactor making warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaiejj committed May 2, 2024
1 parent a7e7e8c commit 5bed892
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions omnisafe/adapter/onpolicy_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ def rollout( # pylint: disable=too-many-locals

obs = next_obs
epoch_end = step >= steps_per_epoch - 1
if epoch_end:
num_dones = int(terminated.contiguous().sum())
if num_dones:
logger.log(
f'\nWarning: trajectory cut off when rollout by epoch\
in {num_dones} of {self._env.num_envs} environments.',
)

for idx, (done, time_out) in enumerate(zip(terminated, truncated)):
if epoch_end or done or time_out:
last_value_r = torch.zeros(1)
Expand Down

0 comments on commit 5bed892

Please sign in to comment.