Closed
Description
Describe the bug
>>> from monai.utils import convert_to_numpy
>>> import torch
>>> import numpy as np
>>> convert_to_numpy(data=torch.zeros((2,2),dtype=torch.long), dtype=np.uint16)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "monai/utils/type_conversion.py", line 175, in convert_to_numpy
data = data.detach().to(dtype=get_equivalent_dtype(dtype, torch.Tensor), device="cpu").numpy()
File "monai/utils/type_conversion.py", line 79, in get_equivalent_dtype
return dtype_numpy_to_torch(dtype)
File "monai/utils/type_conversion.py", line 58, in dtype_numpy_to_torch
return torch.from_numpy(np.empty([], dtype=dtype)).dtype
TypeError: can't convert np.ndarray of type numpy.uint16. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint8, and bool.
>>>
Metadata
Metadata
Assignees
Labels
No labels