Skip to content

Keep LUNA.initialize_weights as a deprecated alias - #1515

Merged
bruAristimunha merged 2 commits into
braindecode:masterfrom
bruAristimunha:bd2-fix-luna-initialize-weights
Nov 2, 2026
Merged

bruAristimunha merged 2 commits into
braindecode:masterfrom
bruAristimunha:bd2-fix-luna-initialize-weights

Conversation

@bruAristimunha

Copy link
Copy Markdown
Collaborator

LUNA.initialize_weights() was renamed to the private _init_parameters() in #1452 with no alias, so 1.8.1 code raised AttributeError. This keeps initialize_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.

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().
Copilot AI balanced review requested due to automatic review settings November 2, 2026 13:25
@bruAristimunha
bruAristimunha merged commit 657d8e8 into braindecode:master Nov 2, 2026
4 of 7 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

codecov Bot commented Nov 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.33%. Comparing base (7c25ac0) to head (d92754c).
⚠️ Report is 5 commits behind head on master.

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants