Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[Numpy] Advanced Indexing Bug #18919

Open
@sxjscience

Description

@AntiZpvoh Would you still have time to take a look?

Reproducible example:

import mxnet as mx
import numpy as np

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions