Created
February 27, 2019 10:20
-
-
Save dasayan05/9b9cdc4a272500ecbfa648dd54d5fbde to your computer and use it in GitHub Desktop.
Synchronize gradients
This file contains 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
def sync_gradients(model, rank, world_size): | |
for param in model.parameters(): | |
dist.all_reduce(param.grad.data, op=dist.reduce_op.SUM) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment