[Mlir-commits] [mlir] Support float8_e3m4 and float8_e4m3 in np_to_memref (PR #186453)

Maksim Levental llvmlistbot at llvm.org
Sat Mar 14 18:07:32 PDT 2026


================
@@ -68,15 +88,17 @@ def to_numpy(array):
     if array.dtype == F16:
         return array.view("float16")
     assert not (
-        array.dtype == BF16 and ml_dtypes is None
-    ), f"bfloat16 requires the ml_dtypes package, please run:\n\npip install ml_dtypes\n"
+        array.dtype in ML_DTYPES_REQUIRED and ml_dtypes is None
+    ), f"{array.dtype.__name__} requires the ml_dtypes package, please run:\n\npip install ml_dtypes\n"
----------------
makslevental wrote:

> Thanks for the suggestion. I'm actually unfamiliar with what you are suggesting does

https://docs.python.org/3/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging

> is a little ugly, something like <class Blah>

there's a balance - ugly on the one hand but not a implementation detail/dunder on the other hand 🤷 

https://github.com/llvm/llvm-project/pull/186453


More information about the Mlir-commits mailing list