Ishitori commented on issue #10248: python doc error in mxnet.symbol.pick
URL: 
https://github.com/apache/incubator-mxnet/issues/10248#issuecomment-409029724
 
 
   1. While I agree that the documentation of this method should be better, the 
3rd example actually shows an interesting feature of this method:
   
   There is no difference in the result between the input `y= [[1.], [0.], 
[1.]]` and `y= [[1.], [0.], [2.]]`, because of a clipping applied to `y`. Since 
dimensions of `x` are `(3, 2)`, meaning that the last possible index of 
`axis=1` is `1`, the clipping applied to that last element of `y` will change 
`[2.]` to `[1.]`. That's exactly what the documentation means saying:
   
   > By default, if any index mentioned is too large, it is replaced by the 
index that addresses the last element along an axis (the clip mode).
   
   2. I agree, that the last example doesn't show the dimensionality quite 
well. But consider the code below:
   
   ```
   import mxnet as mx
   x = mx.nd.array([
       [[ 1.,  2.], 
        [ 3.,  4.], 
        [ 5.,  6.]],
       [[ 11.,  12.], 
        [ 13.,  14.], 
        [ 15.,  16.]]
   ])
   y = mx.nd.array([[ 1., 1.], [ 0., 0.], [ 1., 0.]])
   
   x.shape # will print: (2, 3, 2)
   y.shape  # will print (3, 2)
   
   mx.nd.pick(x, y, axis=0)
   ```
   
   The output will be:
   ```
   [[ 11.  12.]
    [  3.   4.]
    [ 15.   6.]]
   <NDArray 3x2 @cpu(0)>
   ```
   In this case we use `y` which is one dimension less than `x`. I think that 
was the main point of the documentation.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to