From 2dd6872e7c920dc9faec4b122e83a136d6369059 Mon Sep 17 00:00:00 2001 From: chenguowei01 Date: Thu, 30 Jul 2020 20:33:28 +0800 Subject: [PATCH] update train.py --- dygraph/core/train.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dygraph/core/train.py b/dygraph/core/train.py index 0bbcabf1..9563f0c3 100644 --- a/dygraph/core/train.py +++ b/dygraph/core/train.py @@ -87,6 +87,7 @@ def train(model, labels = data[1].astype('int64') if nranks > 1: loss = ddp_model(images, labels) + # apply_collective_grads sum grads over multiple gpus. loss = ddp_model.scale_loss(loss) loss.backward() ddp_model.apply_collective_grads() -- GitLab