Skip to content

Preserve running normalization statistics for empty batches - #399

Merged
Denys88 merged 1 commit into
Denys88:masterfrom
Afloat16:fix/empty-running-normalization-20261112
Nov 21, 2026
Merged

Denys88 merged 1 commit into
Denys88:masterfrom
Afloat16:fix/empty-running-normalization-20261112

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Problem

A training-mode RunningMeanStd call on an empty leading batch computes undefined moments and writes them into the persistent normalization statistics. A later nonempty batch then inherits the damaged state.

Change

Skip the statistics update when input.size(0) is zero while retaining the normal forward/denormalization behavior. Add regressions covering empty inputs and subsequent normalization.

Validation

The regression run on the unchanged base recorded 4 failures and 4 passes. Targeted validation after the change recorded 17 passes.

CPU validation only; no accelerator or full training run is claimed.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@9c0b3a0). Learn more about missing BASE report.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #399   +/-   ##
=========================================
  Coverage          ?   58.21%           
=========================================
  Files             ?       70           
  Lines             ?     8866           
  Branches          ?        0           
=========================================
  Hits              ?     5161           
  Misses            ?     3705           
  Partials          ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Denys88 Denys88 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: small, targeted change with tests. Approving.

@Denys88
Denys88 merged commit 99b4371 into Denys88:master Nov 21, 2026
6 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.

3 participants