Skip to content

Commit

Permalink
[Docs] InitTracker cleanup (pytorch#2330)
Browse files Browse the repository at this point in the history
  • Loading branch information
matteobettini authored Jul 29, 2024
1 parent cdcd9f3 commit 8fb55ef
Showing 1 changed file with 5 additions and 3 deletions.
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

0 comments on commit 8fb55ef

Please sign in to comment.