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 2019/02/27 19:14:20 UTC

[GitHub] eric-haibin-lin opened a new issue #14264: nd.reshape truncate values

eric-haibin-lin opened a new issue #14264: nd.reshape truncate values
URL: https://github.com/apache/incubator-mxnet/issues/14264
 
 
   reshape with a smaller shape truncates the value in the tensor, which is strange and inconsistent with numpy:
   ```
   >>> import mxnet as mx
   >>> a = mx.nd.arange(10)
   >>> a
   
   [0. 1. 2. 3. 4. 5. 6. 7. 8. 9.]
   <NDArray 10 @cpu(0)>
   >>> b = a.reshape((1,2))
   >>> b
   
   [[0. 1.]]
   <NDArray 1x2 @cpu(0)>
   >>>
   ```
   whereas in numpy:
   ```
   >>> import numpy as np
   >>> a = np.arange(10)
   >>> a
   array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
   >>> a.reshape((1,2))
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
   ValueError: cannot reshape array of size 10 into shape (1,2)
   ```
   

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