Skip to content

[Bug]: Advanced Indexing wrong with one element #1816

@Berkant03

Description

@Berkant03

What happened?

when using advanced indexing on a distributed array, where the list for indexing only contains one element, it will return an empty array, even if it should in theory work. When adding another element to the index array it returns the expected two values.

When not distributed it return the expected behaviour.

Code snippet triggering the error

import heat as ht


arr = ht.arange(25, split=0)
rank = arr.comm.rank
print(rank, arr[4])
if rank == 0:  # ignore rank 1 as those indices are only on rank 0
    print(rank, arr[4].larray)
    print(rank, arr[[4]].larray)
    print(rank, arr[(4,)].larray)
    print(rank, arr[[3, 4]].larray)
arr.comm.Barrier()

Error message or erroneous outcome

0 DNDarray(4, dtype=ht.int32, device=cpu:0, split=None)
1 
0 tensor(4, dtype=torch.int32)
0 tensor([], dtype=torch.int32)
0 tensor(4, dtype=torch.int32)
0 tensor([3, 4], dtype=torch.int32)

Version

features/1789

Python version

3.11

PyTorch version

2.5.1+cu124

MPI version

mpirun (Open MPI) 4.1.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingindexing

    Type

    No fields configured for Bug.

    Projects

    Status
    In Progress

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions