You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by la...@apache.org on 2019/03/07 18:13:54 UTC

[incubator-mxnet] branch master updated: Optimizer MXKVStoreUpdater bug fix in serializeState method (#14337)

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

lanking 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 12c41e6  Optimizer MXKVStoreUpdater bug fix in serializeState method (#14337)
12c41e6 is described below

commit 12c41e6580da4dc41788a9bd3bed73e9dbb7e3db
Author: Satya Krishna Gorti <sa...@gmail.com>
AuthorDate: Thu Mar 7 13:13:31 2019 -0500

    Optimizer MXKVStoreUpdater bug fix in serializeState method (#14337)
---
 CONTRIBUTORS.md                                          |  1 +
 .../core/src/main/scala/org/apache/mxnet/Optimizer.scala | 16 +++++++---------
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 584940b..4e27189 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -215,6 +215,7 @@ List of Contributors
 * [Zach Boldyga](https://github.com/zboldyga)
 * [Gordon Reid](https://github.com/gordon1992)
 * [Ming Yang](http://ufoym.com)
+* [Satya Krishna Gorti](https://github.com/satyakrishnagorti)
 * [Neo Chien](https://github.com/cchung100m)
 
 Label Bot
diff --git a/scala-package/core/src/main/scala/org/apache/mxnet/Optimizer.scala b/scala-package/core/src/main/scala/org/apache/mxnet/Optimizer.scala
index 1fb634c..da58976 100644
--- a/scala-package/core/src/main/scala/org/apache/mxnet/Optimizer.scala
+++ b/scala-package/core/src/main/scala/org/apache/mxnet/Optimizer.scala
@@ -52,15 +52,13 @@ object Optimizer {
           val out = new ObjectOutputStream(bos)
           out.writeInt(states.size)
           states.foreach { case (k, v) =>
-            if (v != null) {
-              out.writeInt(k)
-              val stateBytes = optimizer.serializeState(v)
-              if (stateBytes == null) {
-                out.writeInt(0)
-              } else {
-                out.writeInt(stateBytes.length)
-                out.write(stateBytes)
-              }
+            out.writeInt(k)
+            val stateBytes = optimizer.serializeState(v)
+            if (stateBytes == null) {
+              out.writeInt(0)
+            } else {
+              out.writeInt(stateBytes.length)
+              out.write(stateBytes)
             }
           }
           out.flush()