Skip to content

REVE: default on_non_divisible crops as in 1.8.1 (FutureWarning when untiled) - #1517

Merged
bruAristimunha merged 2 commits into
braindecode:masterfrom
bruAristimunha:bd2-compat-reve-crop
Nov 2, 2026
Merged

bruAristimunha merged 2 commits into
braindecode:masterfrom
bruAristimunha:bd2-compat-reve-crop

Conversation

@bruAristimunha

Copy link
Copy Markdown
Collaborator

#1399 changed REVE's default on_non_divisible from crop to pad. A REVE built from scratch on a window that patches do not tile then gets one extra zero patch and a bigger head. This broke 5 neuraltrain tests, and the same 1.8.1 config built a different model.

The default is now None, which crops exactly as in 1.8.1 and emits a FutureWarning when the window does not tile. on_non_divisible="pad" stays available. Pretrained REVE is unaffected.

New tests pin the 1.8.1 behaviour. test/unit_tests/models and test/unit_tests/modules show no new failures.

bd2-downstream and others added 2 commits November 2, 2026 12:56
…when untiled)

braindecode#1399 switched REVE from cropping (torch unfold, the reference and braindecode 1.8.1) to zero-padding a window its overlapping patches do not tile. Code built for 1.8.1 got one more patch per channel, a different encoder output and head size: neuraltrain test_reve.py fails 5 tests (2 -> 3 patches for n_times=100, patch 50, overlap 10). Unset now means crop, with a FutureWarning on untiled windows; "pad" stays available.
Copilot AI balanced review requested due to automatic review settings November 2, 2026 13:25
@bruAristimunha
bruAristimunha merged commit dfb8a1e 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.

🟡 Changes recommended

With attention pooling enabled, untiled runtime inputs can be silently cropped without the promised FutureWarning because the warning checks only the construction-time length.

1 open issue
What changed in this PR

Restores REVE’s historical cropping default so existing configurations retain their patch counts and head sizes, while keeping padding available explicitly.

Changes:

  • Makes on_non_divisible=None resolve to cropping, with a construction-time FutureWarning for untiled windows.
  • Adds regression coverage for default cropping, explicit padding, output parity, and tiled windows.
  • Documents the compatibility change in the API description and changelog.
File Description
test/​unit_tests/​models/​test_on_non_divisible.py Adds REVE compatibility and warning regression tests.
docs/​whats_new.rst Records the restored cropping default and explicit padding option.
braindecode/​models/​reve.py Updates the default, warning logic, and parameter documentation.

Review effort: Balanced

known_n_times < patch_size or (known_n_times - patch_size) % step
):
)
if default_mode and untiled:
@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.34%. Comparing base (7c25ac0) to head (a4da68e).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1517      +/-   ##
==========================================
+ Coverage   91.33%   91.34%   +0.01%     
==========================================
  Files         170      170              
  Lines       22100    22106       +6     
==========================================
+ Hits        20184    20193       +9     
+ Misses       1916     1913       -3     
🚀 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