Skip to content

[dpnp.array] Indexing issue #2461

Open
Open
@abagusetty

Description

@abagusetty

I was trying to port a CUPY snippet for ALCF Aurora and was experiencing issue with DPNP array indexing with np.array, etc. Does someone have any suggestions. I could flatten the indexing-array but prefer not to since the usage is at several places. Appreciate any pointers.

Reproducer:

import dpnp as dp
import numpy as np

# Create a 2D dpnp array
sorted_mat = dp.arange(9).reshape(3, 3)

# Simulate a fancy index like your reshaped AO index
idx = np.array([2, 0, 1])
fancy_index = [idx.reshape(-1, 1), np.arange(3).reshape(1, -1)]

# Try to apply NumPy-style fancy indexing
try:
    mat = dp.empty_like(sorted_mat)
    mat[fancy_index[0], fancy_index[1]] = sorted_mat
except Exception as e:
    print("Expected failure:")
    print(type(e).__name__ + ":", e)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions