Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multi-device loss scaling #7594

Merged
merged 3 commits into from Aug 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions chainer/optimizer.py
Expand Up @@ -243,6 +243,10 @@ def update(self, param):

self.t += 1

with chainer.using_device(param.device):
hvy marked this conversation as resolved.
Show resolved Hide resolved
self.__update(param)

def __update(self, param):
try:
param_dtype = param.dtype
except RuntimeError:
Expand Down
4 changes: 0 additions & 4 deletions tests/chainer_tests/test_optimizer.py
Expand Up @@ -635,10 +635,6 @@ def setUp(self):
self.optimizer = chainer.optimizers.SGD(lr)

def test_update(self, backend_config):
if backend_config.device.name == '@cupy:1':
# TODO(niboshi): Fix it
raise unittest.SkipTest(
'Loss scale does not work with cupy multi-device.')
target = self.target
optimizer = self.optimizer
target.to_device(backend_config.device)
Expand Down