Repository navigation
Keep LUNA.initialize_weights as a deprecated alias - #1515
Merged
bruAristimunha merged 2 commits intoNov 2, 2026
Merged
bruAristimunha merged 2 commits into
bruAristimunha merged 2 commits into
Conversation
braindecode#1452 renamed the public LUNA.initialize_weights() to the private _init_parameters() without a deprecation or a whats_new entry, so 1.8.1 code calling it raises AttributeError in 2.0. Restore it as an alias that emits a DeprecationWarning pointing to reset_parameters().
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the deprecated initialize_weights() compatibility alias.
No open issues 🎉
What changed in this PR
Restores compatibility for callers of LUNA.initialize_weights() after its rename in #1452, while directing users to the public reset_parameters() API.
Changes:
- Adds a deprecated
initialize_weights()alias that warns callers and delegates to_init_parameters(). - Adds regression tests for the warning, exact initialization equivalence, and weight changes.
| File | Description |
|---|---|
test/unit_tests/models/test_luna_initialize_weights.py |
Tests the deprecated alias and its initialization behavior. |
braindecode/models/luna.py |
Restores the alias with a deprecation warning and migration guidance. |
Review effort: Balanced
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1515 +/- ##
=======================================
Coverage 91.33% 91.33%
=======================================
Files 170 170
Lines 22100 22104 +4
=======================================
+ Hits 20184 20188 +4
Misses 1916 1916 🚀 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.
LUNA.initialize_weights()was renamed to the private_init_parameters()in #1452 with no alias, so 1.8.1 code raisedAttributeError. This keepsinitialize_weights()as a deprecated alias (DeprecationWarning) that calls the new method.The new test fails on master and passes here; the LUNA tests pass (80 passed, 0 failed).
Found by the v1.8.1 → master compatibility audit for the 2.0 release.