Skip to content

dpnp.partition fails on 2D array of complex dtype #2762

Description

@antonwolfy

The following example sporadically failed:

import dpnp as np

np.__version__
# Out: '0.20.0dev2+27.ga759850e0ab'

a = np.array([[4, 2, 3], [3, 4, 1]], dtype=np.complex64, device='cpu')
kth = 1

for _ in range(10**4):
    p = np.partition(a, kth)
    assert (p[..., 0:kth] <= p[..., kth : kth + 1]).all()

# it might cause:
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
Cell In[10], line 3
      1 for _ in range(10**4):
      2     p = np.partition(a, kth)
----> 3     assert (p[..., 0:kth] <= p[..., kth : kth + 1]).all()

AssertionError:

# the result array seems corrupted:
p
# Out:
# array([[2.+0.j, 3.+0.j, 4.+0.j],
#        [4.+0.j, 3.+0.j, 3.+0.j]], dtype=complex64)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions