Skip to content

dpctl.tensor.nonzero returns an incorrect array dtype in dpctl=0.14.6dev1 [win] #1335

Closed
@vlad-perevezentsev

Description

@vlad-perevezentsev

dpctl.tensor.nonzero() in dpctl<=0.14.5 used to return a tuple of arrays with int64 type.
Now in dpctl=0.14.6dev1 nonzero() returns a tuple of arrays with int32 type.
This behavior was found only on windows OS.

# dpctl=0.14.6dev1

import dpctl.tensor as dpt

cond = dpt.asarray([0,1,2,0],dtype='int32')
dpt.nonzero(cond)
> (usm_ndarray([1, 2], dtype=int32),)

cond = dpt.astype(cond, 'int64')
> (usm_ndarray([1, 2, 3], dtype=int32),)

# dpctl 0.14.5

import dpctl.tensor as dpt

cond = dpt.asarray([0,1,2,0],dtype='int32')
dpt.nonzero(cond)
> (usm_ndarray([1, 2]),)
dpt.nonzero(cond)[0].dtype
> dtype('int64')

cond = dpt.astype(cond, 'int64')
dpt.nonzero(cond)[0].dtype
> dtype('int64')

# numpy

import numpy

cond_np = dpt.asnumpy(cond)
numpy.nonzero(cond_np)
> (array([1, 2], dtype=int64),)

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions