This is an automated email from the ASF dual-hosted git repository.

jxie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new f3c01d5  ensure kv store is initialized when saving states (#10559)
f3c01d5 is described below

commit f3c01d55427bdf16d6478855acbece5009916e10
Author: Moshe Looks <mo...@apprente.com>
AuthorDate: Sun Apr 15 20:58:31 2018 -0700

    ensure kv store is initialized when saving states (#10559)
    
    * ensure kv store is initialized when saving states
    
    Currently, if you call `save_states()` on newly created trainer:
    ```
    >       if self._update_on_kvstore:
    E       AttributeError: 'Trainer' object has no attribute 
'_update_on_kvstore'
    ```
    
    * zap trailing whitespace
---
 python/mxnet/gluon/trainer.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/python/mxnet/gluon/trainer.py b/python/mxnet/gluon/trainer.py
index e730fd7..5ae0e46 100644
--- a/python/mxnet/gluon/trainer.py
+++ b/python/mxnet/gluon/trainer.py
@@ -210,6 +210,9 @@ class Trainer(object):
         """
         assert self._optimizer is not None
 
+        if not self._kv_initialized:
+            self._init_kvstore()
+
         if self._update_on_kvstore:
             self._kvstore.save_optimizer_states(fname, dump_optimizer=True)
         else:

-- 
To stop receiving notification emails like this one, please contact
j...@apache.org.

Reply via email to