Skip to content

Commit

Permalink
Add split to dtype string for unwanted prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
liamchalcroft committed Apr 6, 2023
1 parent 77c41a8 commit 7dd6146
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion monai/utils/type_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 7dd6146

Please sign in to comment.