NVIDIA / NVIDIA/apex

SyncBN raise ERROR when count = 1

Open
#262 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9k
Forks
1.5k
Avg merge
2d 4h
Merged PRs (30d)
3

Description

It is right that BN layer in torch.nn raises error when count = 1 (only 1 value per channel).

However, for SyncBN layer, even that count = 1 for one GPU, it should NOT raise the error when mean and var are synchronized across multiple GPUs.

https://github.com/NVIDIA/apex/blob/cd2708ccdb66e15c94564e3f608a44aaa5d6a4ab/apex/parallel/optimized_sync_batchnorm_kernel.py#L29-L30

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the count check at lines 29–30 of apex/parallel/optimized_sync_batchnorm_kernel.py and trace how SyncBN synchronizes mean and variance across GPUs. Reproduce the count=1-per-GPU case, then verify that the error is avoided when the synchronized aggregate has enough values while the single-value case remains rejected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.