Skip to content

Commit bb89827

Browse files
ssnlfacebook-github-bot
authored andcommitted
Update cuda pinned memory note to include tensor.to (#20977)
Summary: separate bits of changes from #19228 Pull Request resolved: #20977 Differential Revision: D15511919 Pulled By: soumith fbshipit-source-id: 5015a29cdac6d6e160388c493182c330f0da63ec
1 parent 1e8f129 commit bb89827

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/source/notes/cuda.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,9 @@ memory. CPU tensors and storages expose a :meth:`~torch.Tensor.pin_memory`
277277
method, that returns a copy of the object, with data put in a pinned region.
278278

279279
Also, once you pin a tensor or storage, you can use asynchronous GPU copies.
280-
Just pass an additional ``non_blocking=True`` argument to a :meth:`~torch.Tensor.cuda`
281-
call. This can be used to overlap data transfers with computation.
280+
Just pass an additional ``non_blocking=True`` argument to a
281+
:meth:`~torch.Tensor.to` or a :meth:`~torch.Tensor.cuda` call. This can be used
282+
to overlap data transfers with computation.
282283

283284
You can make the :class:`~torch.utils.data.DataLoader` return batches placed in
284285
pinned memory by passing ``pin_memory=True`` to its constructor.

0 commit comments

Comments
 (0)