This is an automated email from the ASF dual-hosted git repository.

bohan pushed a commit to branch spectrometerHBH-patch-1
in repository https://gitbox.apache.org/repos/asf/tvm.git

commit 6ad7e11f4b8438375f57f5606065bd5ca84761ce
Author: Bohan Hou <[email protected]>
AuthorDate: Tue Mar 11 14:02:02 2025 -0400

    Update ndarray.py
---
 python/tvm/runtime/ndarray.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/python/tvm/runtime/ndarray.py b/python/tvm/runtime/ndarray.py
index 349b7d2d54..d001b671fc 100644
--- a/python/tvm/runtime/ndarray.py
+++ b/python/tvm/runtime/ndarray.py
@@ -233,7 +233,12 @@ class NDArray(NDArrayBase):
         if dtype == "int4":
             dtype = "int8"
         if dtype == "bfloat16":
-            dtype = "uint16"
+            if ml_dtypes is not None:
+                dtype = ml_dtypes.bfloat16
+            else:
+                raise RuntimeError(
+                    "ml_dtypes is not installed, cannot convert bfloat16 array 
to numpy."
+                )
         if dtype == "float8_e4m3fn":
             if ml_dtypes is not None:
                 dtype = ml_dtypes.float8_e4m3fn

Reply via email to