Open tipame opened 1 year ago
No, the defination of addPickDim is aligned with https://mxnet.apache.org/versions/1.6/api/r/docs/api/mx.nd.pick.html. So the output of the code
NDArray target = manager.arange(6).reshape(3, 2);
NDArray pickIndex = manager.create(new long[] {0, 2}, new Shape(1, 2));
NDArray result = target.get(new NDIndex().addPickDim(pickIndex));
should be [[ 0, 5],]
. This feature is not often used though.
To get [[0, 1], [4, 5]]
, you will need the array indexing.
NDArray index = manager.create(new long[] {0, 2});
NDArray ret = target.get(index);
Description
NDArray#get fails with pick index for multidimensional arrays: Executing code:
Expected Behavior
Expect ndarray of shape 2x2 (as described in javadoc for NDIndex#addPickDim): [[0, 1], [4, 5]]
Error Message
java.lang.IllegalArgumentException: expand shape failed! Cannot expand from (2)to (3, 2)