-
Notifications
You must be signed in to change notification settings - Fork 1.5k
InvertD() transform should preserve device of the output #5510
Copy link
Copy link
Closed
Description
MONAI/monai/transforms/post/dictionary.py
Lines 703 to 706 in e44f3b9
| elif isinstance(inverted_data, torch.Tensor): | |
| d[key] = post_func(inverted_data.to(device)) | |
| else: | |
| d[key] = post_func(inverted_data) |
Currently the inverse transform Invertd() always changes the output tensor device to self.device which is cpu (default initialization). And there is no way to preserve the original device (if it's not know in advance).
-
I recommend the default parameter "device=None", which is to do NO device conversion.
-
Also the default option post_func is
post_func = lambda x: x, which is a redundant call. Perhaps we can do post_func = None as default, and skip it in that case
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels