Skip to content

InvertD() transform should preserve device of the output #5510

@myron

Description

@myron

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions