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

[Docs] InitTracker cleanup #2330

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Changes from all commits
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
8 changes: 5 additions & 3 deletions torchrl/envs/transforms/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6420,6 +6420,7 @@ class InitTracker(Transform):
Args:
init_key (NestedKey, optional): the key to be used for the tracker entry.
In case of multiple _reset flags, this key is used as the leaf replacement for each.
Examples:
>>> from torchrl.envs.libs.gym import GymEnv
Expand All @@ -6433,11 +6434,12 @@ class InitTracker(Transform):
"""

def __init__(self, init_key: NestedKey = "is_init"):
def __init__(self, init_key: str = "is_init"):
if not isinstance(init_key, str):
raise ValueError("init_key can only be of type str.")
raise ValueError(
"init_key can only be of type str as it will be the leaf key associated to each reset flag."
)
self.init_key = init_key
self.reset_key = "_reset"
super().__init__()

def set_container(self, container: Union[Transform, EnvBase]) -> None:
Expand Down
Loading