junrushao1994 commented on a change in pull request #14948: [MXNET-1403]
Disable numpy's writability of NDArray once it is zero-copied to MXNet
URL: https://github.com/apache/incubator-mxnet/pull/14948#discussion_r285364812
##########
File path: tests/python/unittest/test_ndarray.py
##########
@@ -1687,8 +1687,10 @@ def test_zero_from_numpy():
mx.test_utils.assert_almost_equal(np_array, mx_array.asnumpy())
np_array = arrays[0]
mx_array = mx.nd.from_numpy(np_array)
- np_array[2, 1] = 0
- mx.test_utils.assert_almost_equal(np_array, mx_array.asnumpy())
+ try:
+ np_array[2, 1] = 0
+ except ValueError:
+ pass
Review comment:
Thanks for the point, i was not aware of this API before :-) In this
testcase, this could be somewhat overkill for this piece of code.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services