Skip to content

Add modules.LearnedPositionalEncoding / SinusoidalPositionalEncoding; CTNet, MSCFormer, BIOT, MEDFormer use them - #1463

Merged
bruAristimunha merged 1 commit into
braindecode:masterfrom
bruAristimunha:cleanup/t26-posenc
Oct 18, 2026
Merged

bruAristimunha merged 1 commit into
braindecode:masterfrom
bruAristimunha:cleanup/t26-posenc

Conversation

@bruAristimunha

Copy link
Copy Markdown
Collaborator

Part of #1442, Tier 2 (last item). Stacked on #1462 (chain #1455 → #1462); the commit of this PR is the last one.

  • LearnedPositionalEncoding(length, dim, drop_prob): dropout(x + encoding[:, :seq]) with the encoding ~ N(0, 1) parameter. CTNet and MSCFormer carried the same 50 lines; their length rules (and warnings) move to the model constructors.
  • SinusoidalPositionalEncoding(max_len, dim, drop_prob, persistent=False): dropout(x + pe[:, :seq]) over functional.sinusoidal_positional_encoding. BIOT and MEDFormer pass persistent=True because their released checkpoints store the table under pe. MEDFormer's xi + cxt + pe(xi) becomes pe(xi + cxt): the same additions in the same order.

Characterization vs master: BIOT, CTNet, MSCFormer, MEDFormer: identical state_dict keys (including the pe buffers), weights and bit-identical outputs. 189 related tests pass, TorchScript included.

Not moved: MSVTNet (zero-initialised pe parameter, no dropout: another layout), STEEGFormer (slices the table around a CLS row), the coordinate encoders of SignalJEPA/Guetschel2026/PopT.

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

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.

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.

Copilot AI balanced review requested due to automatic review settings October 18, 2026 12:02

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 94.73684% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.01%. Comparing base (bc0fdff) to head (3985684).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1463      +/-   ##
==========================================
- Coverage   91.03%   91.01%   -0.03%     
==========================================
  Files         167      167              
  Lines       21601    21546      -55     
==========================================
- Hits        19665    19610      -55     
  Misses       1936     1936              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI balanced review requested due to automatic review settings October 18, 2026 12:28

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.

Copilot AI balanced review requested due to automatic review settings October 18, 2026 17:31

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.

… CTNet, MSCFormer, BIOT, MEDFormer use them (same keys, same outputs)
@bruAristimunha
bruAristimunha merged commit 5b0a618 into braindecode:master Oct 18, 2026
9 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