Repository navigation
TST scripted lfilter: float64 rounding instead of bit-equality on torchaudio < 2.11 (torch 2.6 floor) - #1527
Merged
bruAristimunha merged 1 commit intoNov 2, 2026
Conversation
bruAristimunha
added a commit
to bruAristimunha/braindecode
that referenced
this pull request
Nov 2, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The float64 assertion’s default tolerances could allow float32-level precision regressions to pass, so explicit tolerances calibrated to the observed discrepancies are needed.
1 open issue
What changed in this PR
This test-only change restores compatibility with the supported PyTorch/torchaudio 2.6 floor while retaining strict equality checks on current torchaudio. Library behavior is unchanged.
Changes:
- Allow numerically close scripted filter outputs on torchaudio versions below 2.11.
- Preserve bit-for-bit checks on newer versions and for the eager wrapper.
- Document the compatibility adjustment in the changelog.
| File | Description |
|---|---|
test/unit_tests/models/test_modules.py |
Adds a version-aware comparison helper for scripted filter tests. |
docs/whats_new.rst |
Records the test compatibility fix for the PyTorch 2.6 floor. |
Review effort: Balanced
|
|
||
| version = tuple(int(p) for p in torchaudio.__version__.split("+")[0].split(".")[:2]) | ||
| assert version < (2, 11), "scripted lfilter is no longer bit-equal to torchaudio" | ||
| torch.testing.assert_close(actual, expected) |
…chaudio < 2.11 On the torch/torchaudio 2.6 floor, torchaudio's eager IIR recursion rounds differently from the ops of its scripted path, so the bit-for-bit check failed there (2 failures in the minimum-versions run). Current torchaudio stays bit-for-bit.
bruAristimunha
force-pushed
the
bd2deep/lfilter-test-torch26
branch
from
November 2, 2026 17:18
59f0bc0 to
1e25a46
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1527 +/- ##
=======================================
Coverage 91.34% 91.34%
=======================================
Files 170 170
Lines 22105 22105
=======================================
Hits 20192 20192
Misses 1913 1913 🚀 New features to boost your workflow:
|
Merged
bruAristimunha
added a commit
that referenced
this pull request
Nov 2, 2026
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.

test_scripted_lfilter_equals_torchaudio(from #1501) fails on the supported floor, torch/torchaudio 2.6. The 2.0 release audit ran the suite against the installed wheel with every declared floor, and this test gave 2 failures. torchaudio 2.6 rounds its eager IIR recursion differently from the ops that its own scripted path runs, which braindecode's scriptedlfilterreproduces. The outputs agree to float64 rounding.The test keeps the bit-for-bit check on current torchaudio. Below torchaudio 2.11, it accepts
torch.testing.assert_close. If a future torchaudio is no longer bit-equal, the assert says so. Library code is unchanged.Verified in Voyager Jobs:
pre-commit run --filesexits 0.test_modules.py -k "lfilter or filter_bank"gives 145 passed on torch 2.15 / torchaudio 2.11.1, and 145 passed on torch 2.6.0 / torchaudio 2.6.0.The same test change is in the prepared 1.8.2 backport branch.