Skip to content

Commit b3981d2

Browse files
authored
[Fix] Fix numpy dtype map (#16780)
NumPy 2.0 removes the dtype `np.float_`, which may introduces compatibility issue for TVM.
1 parent 9899f9c commit b3981d2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

python/tvm/_ffi/runtime_ctypes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ class DataType(ctypes.Structure):
9595
np.dtype(np.float16): "float16",
9696
np.dtype(np.float32): "float32",
9797
np.dtype(np.float64): "float64",
98-
np.dtype(np.float_): "float64",
9998
}
99+
if np.__version__.startswith("1."):
100+
NUMPY2STR[np.dtype(np.float_)] = "float64"
100101
STR2DTYPE = {
101102
"void": {"type_code": DataTypeCode.HANDLE, "bits": 0, "lanes": 0},
102103
"bool": {"type_code": DataTypeCode.UINT, "bits": 1, "lanes": 1},

0 commit comments

Comments
 (0)