Skip to content

ndarray.dtype check fails erroneously leading to performance degradation #667

@budylin

Description

@budylin

if data.dtype is not np.ubyte:

It looks like, ndarray.dtype cant be checked using "is" or "is not", it should be compared using == operator:

In [1]: import numpy as np

In [2]: np.array([1,2], dtype=np.ubyte)
Out[2]: array([1, 2], dtype=uint8)

In [3]: x = _

In [4]: x.dtype
Out[4]: dtype('uint8')

In [5]: x.dtype is not np.ubyte
Out[5]: True

In [6]: x.dtype == np.ubyte
Out[6]: True

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions