Snapshot initial observation padding before source buffers are reused - #561
Open
sylvesterkaczmarek wants to merge 1 commit into
Open
sylvesterkaczmarek wants to merge 1 commit into
sylvesterkaczmarek wants to merge 1 commit into
Conversation
Author
|
@saran-t This is current with main, has no failing or pending public checks, and touches the delayed observation-buffer behavior you originally introduced. It snapshots the initial padding value so later reuse/mutation of the source buffer cannot alter already-buffered history, with focused regression coverage. Could you review the current head when convenient? |
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
Fixes #559.
Copy the initial observation before using it for initial-value buffer padding. Those padding entries previously retained the caller's array, so later mutation or reuse of a MuJoCo state view rewrote the apparent initial observations. Regular inserted observations already copy their input.
Keep a single private snapshot for the padding entries. Buffer reads remain independent copies, and zero padding, arrival ordering, later samples and source arrays are unchanged. This also makes delayed scalar/list padding use the same ndarray representation as regular entries. No dynamics, rewards, dependencies or workflows change.
Validation
Added 21 cases covering source reuse, immediate/delayed observations, scalar/list/strided/Fortran inputs, several buffer sizes and numeric dtypes, returned-array independence, delayed arrival controls and zero padding. Two tests run the actual Updater with a native MuJoCo sliding body whose observable returns its live qpos array, with and without mean aggregation.
git diff --check: passed.Based on main at
a04e3e4cf56c12117d2294bb090f9acec21e5c67. Tested on macOS with MuJoCo 3.14.0, NumPy 2.3.2 and SciPy 1.16.1; bindings were generated using the repository's build_mjbindings command. Rendering was disabled. A broader run failed the same three camera-rendering tests on unchanged main and both branches; the CPU selection above excludes camera-related cases only, without modifying repository test settings. The existing axis-angle warning is unchanged. The complete repository suite, rendering, training runs, package builds and other operating systems were not tested. Nested objects in object-dtype arrays are not deep-copied, matching ordinary insertion semantics.Reference: NumPy array copy semantics.
Upstream checks
At submission the CLA passed, the GitHub Actions Scan was queued, and the organization security workflow reported
action_required: https://github.com/google-deepmind/dm_control/actions/runs/36484650446. The test counts above are local results, not completed upstream CI.