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/03/03 02:34:44 UTC

[GitHub] wkcn opened a new issue #9976: The assignment problem about NDArray

wkcn opened a new issue #9976: The assignment problem about NDArray
URL: https://github.com/apache/incubator-mxnet/issues/9976
 
 
   ## Description
   If `a` is a multi-dims array, it is not available to use `a[0] = a[1]` to assign a row.
   However, it's available to use `a[0, :] = a[1]` or `a[0]=a[1].asnumpy()`
   
   ## Environment info (Required)
   The latest pre-built MXNet has the same problem.
   ```
   ----------Python Info----------
   Version      : 3.6.4
   Compiler     : GCC 7.2.1 20171224
   Build        : ('default', 'Jan  5 2018 02:35:40')
   Arch         : ('64bit', '')
   ------------Pip Info-----------
   Version      : 9.0.1
   Directory    : /usr/lib/python3.6/site-packages/pip
   ----------MXNet Info-----------
   Version      : 1.2.0
   Directory    : /home/wkcn/proj/mxnet/python/mxnet
   Hashtag not found. Not installed from pre-built package.
   ----------System Info----------
   Platform     : Linux-4.15.5-1-ARCH-x86_64-with-arch
   system       : Linux
   node         : MiraiM
   release      : 4.15.5-1-ARCH
   version      : #1 SMP PREEMPT Thu Feb 22 22:15:20 UTC 2018
   ```
   
   Package used (Python/R/Scala/Julia):
   Python
   
   ## Build info (Required if built from source)
   
   Compiler (gcc/clang/mingw/visual studio): gcc 7.2.1
   
   MXNet commit hash:
   17a9c6ad
   
   Build config:
   `make -j4 USE_OPENCV=1 USE_BLAS=openblas `
   
   ## Minimum reproducible example
   ```python
   >>> import mxnet as mx
   >>> import numpy as np
   
   >>> a = mx.nd.array(np.arange(12).reshape((3,4)))
   >>> a
   
   [[ 0.  1.  2.  3.]
    [ 4.  5.  6.  7.]
    [ 8.  9. 10. 11.]]
   <NDArray 3x4 @cpu(0)>
   >>> a[0]=a[1]     #   HERE
   >>> a
   
   [[ 0.  1.  2.  3.]
    [ 4.  5.  6.  7.]
    [ 8.  9. 10. 11.]]
   <NDArray 3x4 @cpu(0)>
   >>> a[0]=[10,11,12,13]
   >>> a
   
   [[10. 11. 12. 13.]
    [ 4.  5.  6.  7.]
    [ 8.  9. 10. 11.]]
   <NDArray 3x4 @cpu(0)>
   >>> a[0]=a[1].asnumpy()
   >>> a
   
   [[ 4.  5.  6.  7.]
    [ 4.  5.  6.  7.]
    [ 8.  9. 10. 11.]]
   <NDArray 3x4 @cpu(0)>
   >>> a[1,:]=a[2]
   >>> a
   
   [[ 4.  5.  6.  7.]
    [ 8.  9. 10. 11.]
    [ 8.  9. 10. 11.]]
   <NDArray 3x4 @cpu(0)>
   ````

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