We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e9f6e51 commit b0c83dbCopy full SHA for b0c83db
monai/transforms/utility/array.py
@@ -1075,6 +1075,12 @@ class ToDevice(Transform):
1075
Move PyTorch Tensor to the specified device.
1076
It can help cache data into GPU and execute following logic on GPU directly.
1077
1078
+ Note:
1079
+ If moving data to GPU device in the multi-processing workers of DataLoader, may got below CUDA error:
1080
+ "RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing,
1081
+ you must use the 'spawn' start method."
1082
+ So usually suggest to set `num_workers=0` in the `DataLoader` or `ThreadDataLoader`.
1083
+
1084
"""
1085
1086
def __init__(self, device: Union[torch.device, str], **kwargs) -> None:
0 commit comments