szha commented on a change in pull request #18562:
URL: https://github.com/apache/incubator-mxnet/pull/18562#discussion_r440479917



##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -148,10 +148,10 @@ def _reshape_view(a, *shape):  # pylint: 
disable=redefined-outer-name
 
 def _as_mx_np_array(object, ctx=None):
     """Convert object to mxnet.numpy.ndarray."""
-    if isinstance(object, _np.ndarray):
-        if not object.flags['C_CONTIGUOUS']:
-            object = _np.ascontiguousarray(object, dtype=object.dtype)

Review comment:
       I'm changing it to make a copy of the numpy array so it's already 
handled by the usage of `array()`. The reason for not using zero-copy 
`from_numpy` is that `from_numpy` changes the original array to be read-only, 
because mxnet execution is asynchronous and thus mutation from numpy side on 
the same buffer will result in undefined behavior.




----------------------------------------------------------------
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]


Reply via email to