Closed as duplicate of#7242
Description
It seems that np.dtype(...)
does not produce consistent hashes and does not equal the hash of the contained dtype. I feel like these should be consistent with each other so that the following will return true:
np.empty(1).dtype in {np.float32, np.float64} # False
Reproducing code example:
In [1]: np.float64 == np.dtype(np.float64)
Out[1]: True
In [2]: np.float64 in {np.dtype(np.float64)}
Out[2]: False
In [3]: hash(np.float64)
Out[3]: 8793996338852
In [4]: hash(np.dtype(np.float64))
Out[4]: 3855163183283070272
hash(np.dtype(np.float64))
returns a different value when called in different runtimes too.
Would this be worth fixing?