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/03/14 17:27:36 UTC

[GitHub] [incubator-mxnet] anirudh2290 commented on issue #14105: nd.slice errors out when end=-1 and step=-1

anirudh2290 commented on issue #14105: nd.slice errors out when end=-1 and step=-1
URL: https://github.com/apache/incubator-mxnet/issues/14105#issuecomment-472976693
 
 
   @reminisce numpy behavior seems to be inconsistent . For example
   ```
   >>> data = np.random.uniform(size=(4,))
   >>> data
   array([0.6677262 , 0.29855998, 0.32659663, 0.15015646])
   >>> data[2:0:-1]
   array([0.32659663, 0.29855998])
   >>> data[2:-1:-1]
   array([], dtype=float64)
   >>>
   ```
   end = 0 returns the two element array till index 1. end = -1 instead of returning 3 element array returns empty array. Ideally it should return the three element array. Otherwise there is no way to include the 0th index with negative step.

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


With regards,
Apache Git Services