-
Notifications
You must be signed in to change notification settings - Fork 27.7k
Empty batch support for SyncBatchNorm #36530
Copy link
Copy link
Closed
Labels
enhancementNot as big of a feature, but technically not a bug. Should be easy to fixNot as big of a feature, but technically not a bug. Should be easy to fixmodule: nnRelated to torch.nnRelated to torch.nntriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Metadata
Metadata
Assignees
Labels
enhancementNot as big of a feature, but technically not a bug. Should be easy to fixNot as big of a feature, but technically not a bug. Should be easy to fixmodule: nnRelated to torch.nnRelated to torch.nntriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
🚀 Feature
Support empty batches in SyncBatchNorm.
Motivation
#36382 has fixed SyncBatchNorm for cases where different workers have different batch sizes. But when some worker or all workers have zero batch size, the behavior is still unexpected.
Similar to how BatchNorm supports empty batch sizes now (in #12013 (comment)), the expected behavior for SyncBatchNorm should be:
However, currently using SyncBatchNorm with empty batch produces this error:
Alternatives
We implement it here but it's a python-based inefficient implementation.
cc @jjsjann123