Skip to content

Commit

Permalink
[BugFix] Fix typo in weight assignment in PRB (pytorch#2241)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoens authored Jun 20, 2024
1 parent 9b1ebb2 commit 1d729e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torchrl/data/replay_buffers/samplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ def sample(self, storage: Storage, batch_size: int) -> torch.Tensor:
index = torch.where(zero_weight, index - 1, index)
if (index < 0).any():
raise RuntimeError("Failed to find a suitable index")
zero_weight = torch.as_tensor(self._sum_tree[index])
weight = torch.as_tensor(self._sum_tree[index])
zero_weight = weight == 0

# Importance sampling weight formula:
Expand Down

0 comments on commit 1d729e8

Please sign in to comment.