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] pin-mem all rb outputs #2411

Merged
merged 1 commit into from
Sep 2, 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
3 changes: 2 additions & 1 deletion torchrl/data/replay_buffers/replay_buffers.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,6 @@ def update_priority(
with self._replay_lock, self._write_lock:
self._sampler.update_priority(index, priority, storage=self.storage)

@pin_memory_output
def _sample(self, batch_size: int) -> Tuple[Any, dict]:
with self._replay_lock:
index, info = self._sampler.sample(self._storage, batch_size)
Expand All @@ -675,6 +674,7 @@ def empty(self):
self._sampler._empty()
self._storage._empty()

@pin_memory_output
def sample(self, batch_size: int | None = None, return_info: bool = False) -> Any:
"""Samples a batch of data from the replay buffer.

Expand Down Expand Up @@ -1262,6 +1262,7 @@ def update_tensordict_priority(self, data: TensorDictBase) -> None:
index = index[..., 0]
return self.update_priority(index, priority)

@pin_memory_output
def sample(
self,
batch_size: int | None = None,
Expand Down
Loading