Closed
Description
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.
Metadata
Metadata
Assignees
Labels
No labels