Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ml_dtypes/_finfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ def float_to_str(f):
obj.machep = 0
obj.negep = -1
obj.max = float8_e8m0fnu(max_)
obj.min = float8_e8m0fnu(tiny)
obj.min = float8_e8m0fnu(tiny) # e8m0 has no zero, so min is tiny
obj.nexp = 8
obj.nmant = 0
obj.iexp = obj.nexp
Expand All @@ -685,6 +685,10 @@ def float_to_str(f):
# pylint: enable=protected-access
return obj

@staticmethod
def _complex32_finfo():
return np.finfo(np.float16)

_finfo_type_map = {
_bfloat16_dtype: _bfloat16_finfo,
_float4_e2m1fn_dtype: _float4_e2m1fn_finfo,
Expand All @@ -699,6 +703,7 @@ def float_to_str(f):
_float8_e5m2fnuz_dtype: _float8_e5m2fnuz_finfo,
_float8_e8m0fnu_dtype: _float8_e8m0fnu_finfo,
_bcomplex32_dtype: _bfloat16_finfo,
_complex32_dtype: _complex32_finfo,
}
_finfo_name_map = {t.name: t for t in _finfo_type_map}
_finfo_cache = {
Expand Down
5 changes: 5 additions & 0 deletions ml_dtypes/_iinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ def __init__(self, int_type):
# the Python Array API standard.
if hasattr(int_type, "dtype") and isinstance(int_type.dtype, np.dtype):
int_type = int_type.dtype
else:
try:
int_type = np.dtype(int_type)
except TypeError:
int_type = np.dtype(type(int_type))

if int_type == _int1_dtype:
self.dtype = _int1_dtype
Expand Down
4 changes: 2 additions & 2 deletions ml_dtypes/_src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ limitations under the License.

#include <Python.h>

#include <complex> //NOLINT
#include <memory> //NOLINT
#include <complex> // NOLINT
#include <memory> // NOLINT

#include "Eigen/Core"

Expand Down
Loading
Loading