Repository navigation
fix: gradient-breaking mutation, batch bugs - #180
Merged
Merged
Conversation
…ross cells - dense_proj added bias via an in-place mutating loop, which Zygote cannot differentiate through. Since bias=true is the default almost everywhere, this silently broke gradients for essentially every cell in the library. Replaced with a plain broadcast. - RHNCell: state wasn't broadcast across the batch dimension (crashed for batch_size > 1), its couple_carry=true path still computed and paid for an unused carry gate, and its forward loop mixed differently-shaped iterations in one Julia for loop, which breaks Zygote's reverse-mode AD. Fixed all three, added depth validation, and dropped now-stale dead code and TODO comments describing bugs that were already fixed. - MiRU2Cell: a bare `+` instead of `.+` crashed on batched input. - IntersectionRNNCell: requires input_size == hidden_size but never validated or documented it, so mismatched sizes crashed with a cryptic broadcast error. Added validation and a docstring note. - LEMCell, MinimalRNNCell, PeepholeLSTMCell: each had a gate computed from the stale pre-update value of a state the same timestep's equations require to use post-update (silent, no error/shape mismatch). Also applied a few production-julia/SciML-style cleanups: const module globals, using/import grouping, selectdim instead of an isa-branch in ResLSTMCell, Returns instead of a closure in _chunked_bias. Added batched forward+gradient regression tests across all layers. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
test_persistent_tasks spins up a subprocess that does its own fresh package resolution to check for background tasks left running after `using RecurrentLayers`. That resolution is network/registry-state sensitive: it hangs locally in constrained network environments, and fails outright in CI on the Julia prerelease matrix leg with "Unable to locate InverseFunctions, a dependency of LogExpFunctions" inside Aqua's own subprocess. Unrelated to this package's actual code; disabling it the same way ambiguities=false is already disabled for a similar reason. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- RHN used @layer :noexpand without a matching custom Base.show, unlike every other :noexpand layer in the library, so it printed a wall of nested type parameters instead of RHN(3 => 5). Added one. - WMCLSTMCell reused the variable name proj_mh_2 for two different projections (forget-gate, then reassigned for the output-gate). Correct only because of statement order; renamed the second to proj_mh_3 so a future reorder can't silently break it. - Fixed a typo in a comment documenting MUT2Cell's known, deliberate deviation from the original paper. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #180 +/- ##
==========================================
- Coverage 75.65% 75.29% -0.37%
==========================================
Files 40 40
Lines 1787 1789 +2
==========================================
- Hits 1352 1347 -5
- Misses 435 442 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
No description provided.