reminisce commented on a change in pull request #9981: [fix issue#9976] The 
assignment problem in NDArray
URL: https://github.com/apache/incubator-mxnet/pull/9981#discussion_r172037661
 
 

 ##########
 File path: tests/python/unittest/test_ndarray.py
 ##########
 @@ -1099,6 +1099,39 @@ def test_assign_float_value_to_ndarray():
     b[0] = a[0]
     assert same(a, b.asnumpy())
 
+@with_seed()
+def test_ndarray_assignment():
+    H, W = 10, 10
+    a_np = np.random.random((H, W))
+    a_nd = mx.nd.array(a_np)
+    a_nd_id = id(a_nd)
+
+    # assign directly
+    a_np[0] = a_np[1]
+    a_nd[0] = a_nd[1]
+    assert np.allclose(a_np, a_nd.asnumpy())
 
 Review comment:
   Use `assert same(a_np, a_nd.asnumpy())`. Same for all others.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to