Skip to content
Merged
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
6 changes: 4 additions & 2 deletions etils/enp/numpy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,15 @@ def is_dtype(self, dtype) -> bool:
)

def as_np_dtype(self, dtype):
if self.is_tf_dtype(dtype):
if self.is_np_dtype(dtype) or self.is_jax_dtype(dtype):
pass
elif self.is_tf_dtype(dtype):
dtype = dtype.as_numpy_dtype
elif self.is_torch_dtype(dtype):
from etils.enp import compat # pylint: disable=g-import-not-at-top

dtype = compat.dtype_torch_to_np(dtype)
elif not self.is_jax_dtype(dtype) and not self.is_np_dtype(dtype):
else:
raise TypeError(f'Invalid dtype: {dtype!r}')
return np.dtype(dtype)

Expand Down
Loading