You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/05/19 06:53:41 UTC

[GitHub] haojin2 commented on a change in pull request #11001: [MXNET-374] handle row_sparse weight in parameter and trainer

haojin2 commented on a change in pull request #11001: [MXNET-374] handle row_sparse weight in parameter and trainer
URL: https://github.com/apache/incubator-mxnet/pull/11001#discussion_r189427272
 
 

 ##########
 File path: tests/python/unittest/test_gluon.py
 ##########
 @@ -39,33 +38,115 @@ def test_parameter():
     assert p.data(mx.cpu(0)).shape == (10, 10)
     assert p.var().name == 'weight'
     assert p.grad(mx.cpu(0)).stype == 'default'
+    assert p.data().stype == 'default'
 
     p.reset_ctx(ctx=[mx.cpu(1), mx.cpu(2)])
     assert p.list_ctx() == [mx.cpu(1), mx.cpu(2)]
 
 @with_seed()
 def test_sparse_parameter():
-    p = gluon.Parameter('weight', shape=(10, 10), grad_stype='row_sparse')
+    p = gluon.Parameter('weight', shape=(10, 10), stype='row_sparse', grad_stype='row_sparse')
     p.initialize(init='xavier', ctx=[mx.cpu(0), mx.cpu(1)])
 
 Review comment:
   Seems like constraining the contexts to cpu is causing test failures on GPU, is this a necessary thing?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services