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
9 changes: 8 additions & 1 deletion monai/utils/type_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,14 @@ def convert_data_type(
Returns:
modified data, orig_type, orig_device
"""
orig_type = type(data)
orig_type: Any
if isinstance(data, torch.Tensor):
orig_type = torch.Tensor
elif isinstance(data, np.ndarray):
orig_type = np.ndarray
else:
orig_type = type(data)

orig_device = data.device if isinstance(data, torch.Tensor) else None

output_type = output_type or orig_type
Expand Down