Skip to content

Advanced indexing with boolean masks on CUDA can be incorrect #7341

@TwentyPast4

Description

@TwentyPast4

Checklist

Describe the issue

Slices of boolean mask tensors are not converted to indices correctly when using advanced indexing.
See PR #7340

Steps to reproduce the bug

Tensor a = Tensor::Zeros({20}, core::Int64, Device("CUDA:0"));
a.SetItem(core::TensorKey::Slice(0, 5, 1), Tensor::Init<int64_t>(1, a.GetDevice()));
a.SetItem(core::TensorKey::Slice(10, 15, 1), Tensor::Init<int64_t>(1, a.GetDevice()));
Tensor mask = a.Gt(0);

Tensor subRangeofMask = mask.Slice(0, 10, 20);
Tensor maskedFullRange = a.IndexGet({mask});
Tensor maskedSubRange = a.Slice(0, 10, 20).IndexGet({subRangeOfMask});

EXPECT_EQ(maskedFullRange.Slice(0, 10, 20), maskedSubRange); // this fails!

Error message

No response

Expected behavior

The boolean mask should be converted to the index list by using the correct data pointer (offset by potential slicing)

Open3D, Python and System information

- Operating system: Ubuntu 24.04
- Python version: Python 3.8
- Open3D version: latest main (fb7088ceebef38d54c575b47935e568979b50954)
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: build from source
- Compiler version (if built from source): gcc 13.3

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugNot a build issue, this is likely a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions