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 a0031ac  cast scalar value in invoke to float (#8778)
a0031ac is described below

commit a0031ace5a348091354e61bc17cd6c0d1d8ad610
Author: Chris Olivier <cjolivie...@gmail.com>
AuthorDate: Wed Nov 22 14:35:54 2017 -0800

    cast scalar value in invoke to float (#8778)
---
 python/mxnet/optimizer.py     | 4 ++--
 python/mxnet/symbol/symbol.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/python/mxnet/optimizer.py b/python/mxnet/optimizer.py
index 5eb4f05..0134556 100644
--- a/python/mxnet/optimizer.py
+++ b/python/mxnet/optimizer.py
@@ -793,9 +793,9 @@ class AdaGrad(Optimizer):
             srt = op.sqrt(adjusted_add)
             div = _internal._scatter_elemwise_div(grad, srt)
             retained_weight = sparse.retain(weight, grad.indices)
-            to_add = sparse.elemwise_add(div, 
_internal._mul_scalar(retained_weight, wd))
+            to_add = sparse.elemwise_add(div, 
_internal._mul_scalar(retained_weight, float(wd)))
             assert len(to_add.indices) == grad_indices_count
-            weight[:] = sparse.elemwise_add(weight, 
_internal._mul_scalar(to_add, -lr))
+            weight[:] = sparse.elemwise_add(weight, 
_internal._mul_scalar(to_add, float(-lr)))
             state[:] = history
             assert state.stype == save_history_stype
             assert len(history_indices) == grad_indices_count
diff --git a/python/mxnet/symbol/symbol.py b/python/mxnet/symbol/symbol.py
index e2cf0ec..ce7776d 100644
--- a/python/mxnet/symbol/symbol.py
+++ b/python/mxnet/symbol/symbol.py
@@ -2759,7 +2759,7 @@ def full(shape, val, dtype=None, **kwargs):
     """
     if dtype is None:
         dtype = _numpy.float32
-    return _internal._full(shape=shape, dtype=dtype, value=val, **kwargs)
+    return _internal._full(shape=shape, dtype=dtype, value=float(val), 
**kwargs)
 
 # pylint: disable=redefined-outer-name
 def arange(start, stop=None, step=1.0, repeat=1, name=None, dtype=None):

-- 
To stop receiving notification emails like this one, please contact
['"comm...@mxnet.apache.org" <comm...@mxnet.apache.org>'].

Reply via email to