Skip to content

Using of Boolean scalar for slicing usm_ndarray needs work #1135

Closed

Description

@oleksandr-pavlyk

Slicing in dpctl.tensor behaves differently than in NumPy:

In [15]: x = dpt.arange(4)

In [16]: x[True]
Out[16]: usm_ndarray(1)

In [17]: import numpy as n

In [18]: x_np = np.arange(5)

In [19]: x_np[True]
Out[19]: array([[0, 1, 2, 3, 4]])

Moreover, x[dpt.asarray(True)] raises ValueError instead of behaving like Python object.

Slicing high dimensional arrays also runs into similar problems. x_2d[True] behaves like x_2d[1] unlike in NumPy, and x_2d[dpt.asarray(True)] raises ValueError.

Activity

  1. added
    bug
    on Mar 22, 2023
  2. added a commit that references this issue on Mar 23, 2023
    eccd026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugtensor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions