Repository navigation
Center running variance batches along the requested reduction axes - #1221
Open
sylvesterkaczmarek wants to merge 3 commits into
Open
sylvesterkaczmarek wants to merge 3 commits into
sylvesterkaczmarek wants to merge 3 commits into
Conversation
Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
Contributor
|
Disclaimer: This is AI-generated, please review response for accuracy
|
sylvesterkaczmarek
force-pushed
the
fix/running-variance-reduction-axis-broadcast
branch
from
October 4, 2026 00:25
6989031 to
ca230aa
Compare
This branch has not been deployed
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.
Earth2Studio Pull Request
Description
Fixes #1220.
Keep reduced dimensions as singleton axes when centering each running-variance batch, then squeeze only those axes before storing its sum. The dropped-axis mean previously broadcast against the wrong dimensions: reducing time in a 3-by-3 tensor returned variances [17.5, 4, 17.5] instead of [1, 1, 1], while a 2-by-3 tensor raised a shape error. Running standard deviation inherited the same problem.
Preserve the reduced shape of stored sums, output coordinates, weighted normalization, singleton behavior and batch-combination formula. Update the changelog. No public API changes.
Validation
Sixteen parametrized cases extend the existing moments tests. They cover variance/std, float32/float64, square and nonsquare non-leading reductions, multiple-axis layouts, unequal streaming batch sizes, unchanged inputs, coordinate order, weighted centering and single-batch autograd/finite-difference checks. Streamed unweighted results are checked against direct Torch variance/std over all samples seen so far. The weighted control deliberately retains the existing running-weight denominator.
python -m pytest -o addopts='' test/statistics/test_moments.py -k 'not cuda' -q: 36 passed, with 17 CUDA cases deselected.git diff --checkpassed.Testing used Python 3.12.11, PyTorch 2.14.1, on macOS CPU. The complete statistics/repository suites, GPU execution, external datasets and forecasting models were not tested. Existing optional-dependency, configuration and indexing warnings remain. Default batch-count ratios retain their existing float32 arithmetic, so streaming comparisons allow that rounding; the precision policy and weighted-estimator normalization are outside this fix. No dependencies, workflows or existing test expectations change.
Checklist
Dependencies
None.
Based on main at
e916317a7e53ee73cc8cf5cd97064e970cfd723e.