Skip to content

unique_all doesn't specify that indices should be a flattened index #588

Closed
@asmeurer

Description

@asmeurer

unique_all:

second element must have the field name indices and must be an array containing the indices (first occurrences) of x that result in values. The array must have the same shape as values and must have the default array index data type.

This is under specified because it isn't clear that the indices are for a flattened x, e.g.:

>>> import numpy.array_api as xp
<stdin>:1: UserWarning: The numpy.array_api submodule is still experimental. See NEP 47.
>>> x = xp.asarray([[1, 0, 1], [0, 2, 1]])
>>> xp.unique_all(x)
UniqueAllResult(values=Array([0, 1, 2], dtype=int64), indices=Array([1, 0, 4], dtype=int64), inverse_indices=Array([[1, 0, 1],
       [0, 2, 1]], dtype=int64), counts=Array([2, 3, 1], dtype=int64))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions