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] Fixes to RenameTransform #2442

Merged
merged 4 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rewording of docstring
  • Loading branch information
thomasbbrunner committed Sep 19, 2024
commit 3f620a809569ec6ecda2764893164f5ae1b841f4
1 change: 0 additions & 1 deletion test/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9046,7 +9046,6 @@ def test_single_trans_env_check(self, create_copy, compose):
if compose:
t = Compose(t)
env = TransformedEnv(ContinuousActionVecMockEnv(), t)

check_env_specs(env)

def test_serial_trans_env_check(self, create_copy):
Expand Down
13 changes: 7 additions & 6 deletions torchrl/envs/transforms/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6634,15 +6634,16 @@ def forward(self, tensordict: TensorDictBase) -> TensorDictBase:


class RenameTransform(Transform):
"""A transform to rename entries in the output tensordict.
"""A transform to rename entries in the output tensordict (or input tensordict
via the inverse keys).

Args:
in_keys (sequence of NestedKey): the entries to rename
in_keys (sequence of NestedKey): the entries to rename.
out_keys (sequence of NestedKey): the name of the entries after renaming.
in_keys_inv (sequence of NestedKey, optional): the entries to rename before
passing the input tensordict to :meth:`EnvBase._step`.
out_keys_inv (sequence of NestedKey, optional): the names of the renamed
entries passed to :meth:`EnvBase._step`.
in_keys_inv (sequence of NestedKey, optional): the entries to rename
in the input tensordict, which will be passed to :meth:`EnvBase._step`.
out_keys_inv (sequence of NestedKey, optional): the names of the entries
in the input tensordict after renaming.
create_copy (bool, optional): if ``True``, the entries will be copied
with a different name rather than being renamed. This allows for
renaming immutable entries such as ``"reward"`` and ``"done"``.
Expand Down
Loading