diff --git a/monai/utils/type_conversion.py b/monai/utils/type_conversion.py index c5dd3a797c..463871b75a 100644 --- a/monai/utils/type_conversion.py +++ b/monai/utils/type_conversion.py @@ -45,7 +45,7 @@ def get_numpy_dtype_from_string(dtype: str) -> np.dtype: """Get a numpy dtype (e.g., `np.float32`) from its string (e.g., `"float32"`).""" - return np.empty([], dtype=dtype).dtype + return np.empty([], dtype=str(dtype).split('.')[-1]).dtype def get_torch_dtype_from_string(dtype: str) -> torch.dtype: