Skip to content

Conversation

@MasterJH5574
Copy link
Contributor

NumPy 2.0 removes the dtype np.float_, which may introduces compatibility issue for TVM.

NumPy 2.0 removes the dtype `np.float_`, which may introduces
compatibility issue for TVM.
@mshr-h
Copy link
Contributor

mshr-h commented Mar 25, 2024

I think this is better.

-    if np.__version__.startswith("1."):
-        NUMPY2STR[np.dtype(np.float_)] = "float64"
+    if hasattr(np, "float_"):
+        NUMPY2STR[np.dtype(np.float_)] = "float64"

@mshr-h
Copy link
Contributor

mshr-h commented Mar 25, 2024

This is more Pythonic?

-    if np.__version__.startswith("1."):
-        NUMPY2STR[np.dtype(np.float_)] = "float64"
+ try:
+     NUMPY2STR[np.dtype(np.float_)] = "float64"
+ except AttributeError:
+     pass

LBYL

@tqchen tqchen merged commit b3981d2 into apache:main Mar 25, 2024
@MasterJH5574
Copy link
Contributor Author

@mshr-h Thank you for the great suggestion! I agree that the way I was doing might not be the best. Feel free to send the change you propose.

thaisacs pushed a commit to thaisacs/tvm that referenced this pull request Apr 3, 2024
NumPy 2.0 removes the dtype `np.float_`, which may introduces
compatibility issue for TVM.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants