Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

dpt.nonzero returns array of int32 dtype #1322

Copy link
Copy link
@antonwolfy

Description

@antonwolfy
Issue body actions

After merging #1300, the result array type of dpt.nonzero is changed:

a = dpt.ones(10, dtype="i8")
dpt.nonzero(a)[0].dtype
# Out: dtype('int32')

The result dtype depends now on array size and may vary between int32 and int64 on the same platform:

sz = numpy.iinfo("i4").max
a = dpt.ones(sz, dtype="i8")
dpt.nonzero(a)[0].dtype
# Out: dtype('int32')

sz = numpy.iinfo("i4").max + 1
a = dpt.ones(sz, dtype="i8")
dpt.nonzero(a)[0].dtype
# Out: dtype('int64')

The python array API states that:

The returned array must have the default array index data type.

and here is about the default array index type:

a default array index data type (either int32 or int64).
...
The default array index data type may be int32 on 32-bit platforms, but the default should be int64 otherwise.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.