Skip to content

Fix test_batch_norm to check module attributes instead of relying on string representation#10657

Merged
puririshi98 merged 7 commits intopyg-team:masterfrom
drivanov:batch_norm
Apr 8, 2026
Merged

Fix test_batch_norm to check module attributes instead of relying on string representation#10657
puririshi98 merged 7 commits intopyg-team:masterfrom
drivanov:batch_norm

Conversation

@drivanov
Copy link
Copy Markdown
Contributor

@drivanov drivanov commented Apr 3, 2026

The test_batch_norm was recently changed in PR#10647 (Fix CI failing with PyTorch 2.12+), but it still fails with some PyTorh 2.12 versions, and torch-2.12.0a0+0291f960b6.nvinternal.main.46693258 is one of them.

Current PR:

  • Replaces brittle str(norm) checks with direct assertions on num_features, eps, momentum, affine, track_running_stats, weight, and bias.
  • Removes dependence on WITH_PT212 flag.
  • Works correctly with both PyG wrapper BatchNorm and native torch.nn.BatchNorm1d.
  • Version-agnostic and future-proof across PyTorch builds.

The fix was tested with :

  • torch-2.12.0a0+0291f960b6.nvinternal.main.46693258
  • torch 2.10.0a0+a36e1d39eb.nv26.1.42222806

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.18%. Comparing base (c211214) to head (5ba5638).
⚠️ Report is 194 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10657      +/-   ##
==========================================
- Coverage   86.11%   84.18%   -1.93%     
==========================================
  Files         496      510      +14     
  Lines       33655    36022    +2367     
==========================================
+ Hits        28981    30325    +1344     
- Misses       4674     5697    +1023     

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Copy Markdown
Contributor

@puririshi98 puririshi98 left a comment

Choose a reason for hiding this comment

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

LGTM

drivanov and others added 3 commits April 6, 2026 14:20
Co-authored-by: Akihiro Nitta <akihiro@kumo.ai>
Co-authored-by: Akihiro Nitta <akihiro@kumo.ai>
@puririshi98 puririshi98 enabled auto-merge (squash) April 7, 2026 16:11
auto-merge was automatically disabled April 7, 2026 16:20

Invalid email address

@puririshi98 puririshi98 merged commit c9c18c9 into pyg-team:master Apr 8, 2026
18 checks passed
@drivanov drivanov deleted the batch_norm branch April 9, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants