Repository navigation
REVE: default on_non_divisible crops as in 1.8.1 (FutureWarning when untiled) - #1517
Merged
bruAristimunha merged 2 commits intoNov 2, 2026
Merged
Conversation
…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.
Contributor
There was a problem hiding this comment.
🟡 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=Noneresolve to cropping, with a construction-timeFutureWarningfor 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 Report✅ All modified and coverable lines are covered by tests. 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:
|
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.

#1399 changed REVE's default
on_non_divisiblefrom 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 aFutureWarningwhen 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/modelsandtest/unit_tests/modulesshow no new failures.