Repository navigation
Clear frame history when an environment automatically resets - #377
Open
sylvesterkaczmarek wants to merge 2 commits into
Open
sylvesterkaczmarek wants to merge 2 commits into
sylvesterkaczmarek wants to merge 2 commits into
Conversation
Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
This was referenced Nov 13, 2026
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 #376.
Reset each frame stacker when processing a FIRST timestep, covering both explicit resets and the dm_env automatic-reset path. Continuing-episode histories remain intact. The old implementation appended a new episode's initial observation to the previous episode's frames. Default zero fill, flattening, nested structure, metadata and observation specs are unchanged.
Validation
python -m pytest -q acme/wrappers/frame_stacking_reset_test.py20 focused tests passed, including eight new non-zero-LAST-discount variants prompted by community review. Of the original 12, six fail on unchanged upstream and six are controls. Coverage includes zero-discount terminations and non-zero-discount time-limit truncations, nested dict/tuple observations, flattened and unflattened stacks, one/multiple frames, float32/uint8, explicit resets, step-after-LAST and step on a fresh environment. Tests check observations against independently constructed stacks and validate their specs.
The local macOS launcher supplies an empty
launchpadmodule only to satisfy Acme's unrelated top-level signal-handler import. No Launchpad function is called, and the shim is outside the patch. The wrapper, NumPy operations, dm_env classes and test environment all execute normally. The attempted existing frame-stacking suite cannot collect becauseacme.testing.fakesimports unavailable Reverb. Those tests, distributed execution and training are not claimed as run.The additional time-limit cases use real
dm_env.truncationtimesteps. All 20 focused cases passed on Python 3.12/macOS CPU with the production Acme wrapper/spec modules, real NumPy, dm_env and dm-tree, and an isolated package-import shim (no model or distributed execution). Scoped Ruff correctness, Python syntax andgit diff --checkpass. No dependency or workflow changes.