Skip to content

Commit

Permalink
[Docs] InitTracker cleanup (#2330)
Browse files Browse the repository at this point in the history
  • Loading branch information
matteobettini committed 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

1 comment on commit 8fb55ef

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'CPU Benchmark Results'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 8fb55ef Previous: cdcd9f3 Ratio
benchmarks/test_replaybuffer_benchmark.py::test_rb_populate[TensorDictReplayBuffer-LazyTensorStorage-SamplerWithoutReplacement-400] 316.41327479467583 iter/sec (stddev: 0.01414128001323146) 858.7155775493545 iter/sec (stddev: 0.00029115250341301384) 2.71

This comment was automatically generated by workflow using github-action-benchmark.

CC: @vmoens

Please sign in to comment.