Skip to content

FIX EpiNT: z-score the whole window before dropping the samples after the last patch - #1488

Merged
bruAristimunha merged 4 commits into
masterfrom
fix/epint-norm-before-crop
Oct 25, 2026
Merged

bruAristimunha merged 4 commits into
masterfrom
fix/epint-norm-before-crop

Conversation

@julien-gadonneix

Copy link
Copy Markdown
Collaborator

Summary

The reference EpiNT runs InstanceNorm1d on the whole input, and unfold then drops the samples after the last full patch. The port cropped first, so those samples were left out of the normalization statistics. The output differed whenever n_times is not a multiple of patch_size: 24 to 33 % relative difference on the class tokens at 3200 to 3327 samples with the released weights. With the released 3072-sample setting the output is unchanged.

Changes

  • EpiNT.forward normalizes, then crops. The docstring is updated.
  • test_epint_normalizes_the_whole_window: shifting the dropped samples changes the output. It does not on master.

Testing

  • pytest test/unit_tests/models -k "epint or EpiNT": 47 passed, 2 skipped (pydantic not installed; compile runs on master only)
  • pre-commit run --files <changed files>: passed
  • docs/whats_new.rst updated

Notes for reviewers

Conflicts with #1487, which rewrites the same lines. Whichever lands second must keep the norm before the crop.

… the last patch

As in the reference implementation, the instance norm runs on the full input and the remainder past n_patches * patch_size is dropped afterwards. Outputs are unchanged when n_times is a multiple of patch_size (the released 3072-sample checkpoint).
@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.09%. Comparing base (8f0f504) to head (f4c1849).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1488      +/-   ##
==========================================
+ Coverage   91.08%   91.09%   +0.01%     
==========================================
  Files         167      167              
  Lines       21677    21706      +29     
==========================================
+ Hits        19744    19773      +29     
  Misses       1933     1933              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bruAristimunha
bruAristimunha merged commit 19fa784 into master Oct 25, 2026
10 checks passed
@bruAristimunha
bruAristimunha deleted the fix/epint-norm-before-crop branch November 22, 2026 23:02
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