Skip to content

numpy.__array_namespace_info__().dtypes()["float64"] == None is True but numpy.float64 == None is False #359

@34j

Description

@34j

In my understanding, dtype can be any Python object in array API specification, and therefore may be None depending on the library. If the device is somewhat set to None while using numpy backend in array API compatible code, the above specification (numpy/numpy#18434) causes various problems when working with dtypes.

> from array_api_compat import numpy as np
> np.__array_namespace_info__().dtypes()["float64"]
dtype('float64')
> np.float64
<class 'numpy.float64'>
> np.__array_namespace_info__().dtypes()["float64"] == np.float64
True
> np.__array_namespace_info__().dtypes()["float64"] == None
True
> np.float64 == None
False

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