Skip to content

Update the sync batch norm implementation for sync_bn#66

Closed
renganxu wants to merge 1 commit intofacebookresearch:mainfrom
renganxu:export-D35300913
Closed

Update the sync batch norm implementation for sync_bn#66
renganxu wants to merge 1 commit intofacebookresearch:mainfrom
renganxu:export-D35300913

Conversation

@renganxu
Copy link
Copy Markdown
Contributor

Summary:
The sync_bn batch norm has been using a non-efficient implementation NaiveSyncBatchNorm. This is because in pytorch<=1.5, nn.SyncBatchNorm had incorrect gradient when the batch size on each worker is different, so a NaiveSyncBatchNorm was implemented. This issue has been fixed in pytorch/pytorch#36382. So we change that implementation back to the faster nn.SyncBatchNorm.

Since nn.SyncBatchNorm only has GPU implementation, for the unit tests running with single process on CPU, the original NaiveSyncBatchNorm is used.

Reviewed By: wat3rBro

Differential Revision: D35300913

Summary:
The sync_bn batch norm has been using a non-efficient implementation NaiveSyncBatchNorm. This is because in pytorch<=1.5, nn.SyncBatchNorm had incorrect gradient when the batch size on each worker is different, so a NaiveSyncBatchNorm was implemented. This issue has been fixed in pytorch/pytorch#36382. So we change that implementation back to the faster nn.SyncBatchNorm.

Since nn.SyncBatchNorm only has GPU implementation, for the unit tests running with single process on CPU, the original NaiveSyncBatchNorm is used.

Reviewed By: wat3rBro

Differential Revision: D35300913

fbshipit-source-id: c649f4dfc1ab5b2a0dd91d0187b072ae2de229ff
@facebook-github-bot facebook-github-bot added CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported labels Apr 21, 2022
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D35300913

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants