Repository navigation
Add modules.LearnedPositionalEncoding / SinusoidalPositionalEncoding; CTNet, MSCFormer, BIOT, MEDFormer use them - #1463
Merged
bruAristimunha merged 1 commit intoOct 18, 2026
Conversation
bruAristimunha
force-pushed
the
cleanup/t26-posenc
branch
from
October 18, 2026 11:16
da84e46 to
57c9bc9
Compare
Codecov Report❌ Patch coverage is 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:
|
bruAristimunha
force-pushed
the
cleanup/t26-posenc
branch
from
October 18, 2026 17:31
d40ab7d to
efeacd6
Compare
… CTNet, MSCFormer, BIOT, MEDFormer use them (same keys, same outputs)
bruAristimunha
force-pushed
the
cleanup/t26-posenc
branch
from
October 18, 2026 18:03
efeacd6 to
3985684
Compare
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.
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 theencoding ~ N(0, 1)parameter. CTNet and MSCFormer carried the same 50 lines; theirlengthrules (and warnings) move to the model constructors.SinusoidalPositionalEncoding(max_len, dim, drop_prob, persistent=False):dropout(x + pe[:, :seq])overfunctional.sinusoidal_positional_encoding. BIOT and MEDFormer passpersistent=Truebecause their released checkpoints store the table underpe. MEDFormer'sxi + cxt + pe(xi)becomespe(xi + cxt): the same additions in the same order.Characterization vs master: BIOT, CTNet, MSCFormer, MEDFormer: identical state_dict keys (including the
pebuffers), weights and bit-identical outputs. 189 related tests pass, TorchScript included.Not moved: MSVTNet (zero-initialised
peparameter, no dropout: another layout), STEEGFormer (slices the table around a CLS row), the coordinate encoders of SignalJEPA/Guetschel2026/PopT.