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 2020/08/13 20:55:19 UTC
[GitHub] [incubator-mxnet] sxjscience opened a new issue #18919: [Numpy] Advanced Indexing Bug
sxjscience opened a new issue #18919:
URL: https://github.com/apache/incubator-mxnet/issues/18919
@AntiZpvoh Would you still have time to take a look?
Reproducible example:
```python
import mxnet as mx
mx.npx.set_np()
batch_size = 4
seq_length = 16
num_sel_positions = 5
feature_shape = (16, 32)
data = mx.np.random.uniform(-1, 1, (batch_size, seq_length) + feature_shape, dtype=np.float32)
positions = mx.np.random.randint(0, seq_length, (batch_size, num_sel_positions), dtype=np.int32)
import numpy as np
data = mx.np.random.uniform(-1, 1, (batch_size, seq_length) + feature_shape, dtype=np.float32)
positions = mx.np.random.randint(0, seq_length, (batch_size, num_sel_positions), dtype=np.int32)
out_np = data.asnumpy()[np.expand_dims(np.arange(data.shape[0]).astype(np.int32),
axis=1),
positions.asnumpy()]
out_mx = data[mx.np.expand_dims(mx.npx.arange_like(data, axis=0).astype(np.int32), axis=1), positions]
out_mx.asnumpy()
```
Error:
```
MXNetError: Traceback (most recent call last):
File "../include/mxnet/./tensor_blob.h", line 311
TBlob.get_with_shape: Check failed: this->shape_.Size() == static_cast<size_t>(shape.Size()) (20 vs. 4) : new and old shape do not match total elements
```
----------------------------------------------------------------
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