Handle float128 generically (#10322)

This commit is contained in:
Philip Hyunsu Cho 2024-05-30 05:14:39 -07:00 committed by GitHub
parent 8998733ef4
commit 324f2d4e4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,7 +4,6 @@ import ctypes
import logging import logging
import os import os
import pickle import pickle
import platform
from enum import IntEnum, unique from enum import IntEnum, unique
from typing import Any, Dict, List, Optional from typing import Any, Dict, List, Optional
@ -184,8 +183,10 @@ def _map_dtype(dtype: np.dtype) -> int:
np.dtype("uint32"): 10, np.dtype("uint32"): 10,
np.dtype("uint64"): 11, np.dtype("uint64"): 11,
} }
if platform.system() != "Windows": try:
dtype_map.update({np.dtype("float128"): 3}) dtype_map.update({np.dtype("float128"): 3})
except TypeError: # float128 doesn't exist on the system
pass
if dtype not in dtype_map: if dtype not in dtype_map:
raise TypeError(f"data type {dtype} is not supported on the current platform.") raise TypeError(f"data type {dtype} is not supported on the current platform.")