Skip to content

Commit 2c977f5

Browse files
authored
[DeprecationWarning] Addressing warning related to Tensor.pin_memory() argument (pyg-team#9617)
This PR resolves the following sets of warnings: ``` test/loader/test_prefetch.py: 10 warnings /usr/local/lib/python3.10/dist-packages/torch_geometric/loader/prefetch.py:76: DeprecationWarning: The argument 'device' of Tensor.pin_memory() is deprecated. Please do not pass this argument. (Triggered internally at /opt/pytorch/pytorch/aten/src/ATen/native/Memory.cpp:46.) batch = batch.pin_memory(self.device_helper.device) test/loader/test_prefetch.py: 10 warnings /usr/local/lib/python3.10/dist-packages/torch_geometric/loader/prefetch.py:76: DeprecationWarning: The argument 'device' of Tensor.is_pinned() is deprecated. Please do not pass this argument. (Triggered internally at /opt/pytorch/pytorch/aten/src/ATen/native/Memory.cpp:31.) batch = batch.pin_memory(self.device_helper.device) ```
1 parent aa025f9 commit 2c977f5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torch_geometric/loader/prefetch.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def non_blocking_transfer(self, batch: Any) -> Any:
7373
if isinstance(batch, dict):
7474
return {k: self.non_blocking_transfer(v) for k, v in batch.items()}
7575

76-
batch = batch.pin_memory(self.device_helper.device)
76+
batch = batch.pin_memory()
7777
return batch.to(self.device_helper.device, non_blocking=True)
7878

7979
def __iter__(self) -> Any:

0 commit comments

Comments
 (0)