Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] step_mdp nested keys #1339

Merged
merged 17 commits into from
Jun 30, 2023
Prev Previous commit
Next Next commit
excluded iteratively
Signed-off-by: Matteo Bettini <matbet@meta.com>
  • Loading branch information
matteobettini committed Jun 30, 2023
commit ba0d59376ff8d649455677a6a1666fa304938984
9 changes: 5 additions & 4 deletions torchrl/envs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,11 @@ def step_mdp(
)

# Set the keys from next
excluded = {
done_key if exclude_done else None,
reward_key if exclude_reward else None,
}
excluded = set()
if exclude_done:
excluded.add(done_key)
if exclude_reward:
excluded.add(reward_key)
for key in td_next_keys:
if key not in excluded:
_set_key(dest=out, source=td_next, key=key)
Expand Down