Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Fixes for trainer with update_on_kvstore=False #13721

Merged
merged 13 commits into from
Dec 29, 2018
Prev Previous commit
Next Next commit
fix merge conflict
  • Loading branch information
Ubuntu committed Dec 23, 2018
commit cc29f425d130e0b137d408362c2ca1ef4ba40013
5 changes: 3 additions & 2 deletions tests/python/unittest/test_gluon_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ def dict_equ(a, b):
if trainer._update_on_kvstore:
dict_equ(trainer._kvstore._updater.states, states)
assert trainer._optimizers[0] == trainer._kvstore._updater.optimizer
# invalid usage of update and allreduce_grads if update_on_kvstore
assert_raises(AssertionError, trainer.update, 1)
assert_raises(AssertionError, trainer.allreduce_grads)
else:
for updater in trainer._updaters:
dict_equ(updater.states, states)
assert trainer._optimizers[0] == trainer._updaters[0].optimizer
assert_raises(AssertionError, trainer.update, 1)
assert_raises(AssertionError, trainer.allreduce_grads)

x = gluon.Parameter('x', shape=(10,))
x.initialize(ctx=[mx.cpu(0), mx.cpu(1)], init='zeros')
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.