diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 584940b3e850..4e2718970e99 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 1fb634cebb26..da58976f9aae 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()