[Feature] Add set_at_, set_, update_ methods to ReplayBuffer#3590
Merged
vmoens merged 1 commit intopytorch:mainfrom Apr 4, 2026
Merged
[Feature] Add set_at_, set_, update_ methods to ReplayBuffer#3590vmoens merged 1 commit intopytorch:mainfrom
vmoens merged 1 commit intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/3590
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New Failures, 1 Cancelled JobAs of commit babe1c9 with merge base e2c8a8d ( NEW FAILURES - The following jobs have failed:
CANCELLED JOB - The following job was cancelled. Please retry:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
buffer[index]["key"] = valuesilently fails because tensor indexing returns a copy, not a view. This adds three in-place write methods toReplayBufferfollowing the TensorDict nomenclature as suggested by @vmoens:set_at_(key, value, index)-- set a key at specific indicesset_(key, value)-- set a key across the entire bufferupdate_(input_dict_or_td)-- batch update multiple keys in-placeAll methods acquire
_replay_lockand write through directly to the underlying storage TensorDict.Changes
set_at_,set_,update_toReplayBufferinreplay_buffers.pyFixes #2810