Repository navigation
fix: ngrc rmn resetcarry - #562
Open
MartinuzziFrancesco wants to merge 5 commits into
Open
MartinuzziFrancesco wants to merge 5 commits into
MartinuzziFrancesco wants to merge 5 commits into
Conversation
…ps multi-state carries NGRC's resetcarry! warned that the model has no internal state and returned the states unchanged, but the DelayLayer history and clock carry over from train into predict. It now clears the history (rebuilt from init_delay on the next call) or sets it to init_carry(rng, in_dims, num_delays), and restarts the clock. Readout and state-modifier states are kept. The generic resetcarry! built a one-state carry and read the cell's out_dims, which broke RMNESN and RMNResESN (RMNCell holds a hidden and a memory state and has no out_dims field). It now calls init_carry once per state, with sizes from the existing carry or from __carry_dimensions(cell). The docstring now names st′.reservoir.carry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
resetcarry! with an init_carry function threw a FieldError on ContinuousESN, LSM and SciMLProblemReservoir models, which have no StatefulLayer. The carry is now the ODE state vector: out_dims for ContinuousESN, length(prob.u0) in eltype(prob.u0) for SciMLProblemReservoir, and for LSM init_carry sets the membrane potentials with the rest of the state zero. DelayLayer histories in input_delay, state_modifiers (also inside Extend and ReservoirChain), DeepESN and DeepReservoir per-layer modifiers, and NGRC modifiers survived resetcarry!, so the previous sequence leaked into the next one. They are now cleared (init_carry=nothing) or set to init_carry(rng, in_dims, num_delays), with the clock at zero. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since every LocalInformationFlow window replays from a cached start_states and an input buffer, resetcarry! on LIFESN only replaced the carry, which the windows ignore, so the next sequence continued as if no reset happened. The generic resetcarry! and the DeepReservoir reset now clear the input buffer and set start_states to the new carry: nothing re-samples both lazily, and an init_carry function sets start_states to the same states as the carry. The lazy initialization no longer stores the advanced rng copy, so a re-initialization draws the same start_states and buffer as a fresh setup. Every window starts from start_states, so a different random start would change every output and no longer fit the trained readout. Runs without a reset are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
Add any other context about the problem here.