Skip to content

functional.patch_count / pad_or_crop_to_patches public; nine models and PatchTokenizer import them - #1459

Merged
bruAristimunha merged 3 commits into
braindecode:masterfrom
bruAristimunha:cleanup/t23-patch-helpers
Oct 18, 2026
Merged

bruAristimunha merged 3 commits into
braindecode:masterfrom
bruAristimunha:cleanup/t23-patch-helpers

Conversation

@bruAristimunha

Copy link
Copy Markdown
Collaborator

Part of #1442, Tier 1 (last item). _patch_count, _pad_or_crop_to_patches and _check_on_non_divisible lived in modules/blocks.py as private names imported by nine models, the tests and PatchTokenizer. They move to braindecode/functional/patches.py; patch_count and pad_or_crop_to_patches are public (numpydoc, docs/api.rst), _check_on_non_divisible stays a private validator. modules.blocks keeps _patch_count / _pad_or_crop_to_patches as aliases for anything that imported them from there. Code unchanged (nn.functional.pad → F.pad).

Characterization vs master: BaRISTA, BrainBERT, Brant, CSBrain, DuIN, NeuroRVQ, NeuroRVQTokenizer, REVE, SleepFM have identical state_dict keys, weights and bit-identical outputs. 754 related tests pass.

Copilot AI balanced review requested due to automatic review settings October 17, 2026 21:06

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.83721% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.01%. Comparing base (47912a9) to head (39cfc86).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1459      +/-   ##
==========================================
- Coverage   91.04%   91.01%   -0.03%     
==========================================
  Files         165      167       +2     
  Lines       21653    21621      -32     
==========================================
- Hits        19714    19679      -35     
- Misses       1939     1942       +3     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bruAristimunha

Copy link
Copy Markdown
Collaborator Author

Review pass (two more commits): the private _patch_count/_pad_or_crop_to_patches aliases in modules.blocks had no users and are gone; and the SDPA helper now has one home: every model and modules.attention/dance_modules import functional.scaled_dot_product_attention (the _hpu_* helpers from functional.attention), the private re-exports are removed. 29 touched models re-characterized against master: identical keys, weights and outputs.

@bruAristimunha
bruAristimunha force-pushed the cleanup/t23-patch-helpers branch from 9dc878a to 39cfc86 Compare October 18, 2026 11:16
Copilot AI balanced review requested due to automatic review settings October 18, 2026 11:16

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@bruAristimunha
bruAristimunha merged commit 8c618f1 into braindecode:master Oct 18, 2026
10 checks passed
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