File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 23
23
- While ``cpu_tensor.to("cuda", non_blocking=True).mean()`` executes correctly, attempting
24
24
``cuda_tensor.to("cpu", non_blocking=True).mean()`` will result in erroneous outputs.
25
25
26
+ Preamble
27
+ ~~~~~~~~
28
+
29
+ The performance reported in this tutorial are conditioned on the system used to build the tutorial.
30
+ Although the conclusions should be applicable across different systems, the specific observations may vary slightly
31
+ depending on the hardware available.
32
+
26
33
"""
27
34
28
35
import torch
32
39
33
40
######################################################################
34
41
#
42
+ # This tutorial requires tensordict to be installed. If you don't have tensordict in your environment yet, install it
43
+ # by running the following command in a separate cell:
44
+ #
45
+ # .. code-block:: bash
46
+ #
47
+ # # Install tensordict with the following command
48
+ # !pip3 install tensordict
49
+ #
35
50
# We start by outlining the theory surrounding these concepts, and then move to concrete test examples of the features.
36
51
#
37
52
# - :ref:`Background <pinned_memory_background>`
136
151
137
152
import contextlib
138
153
139
- import torch
140
154
from torch .cuda import Stream
141
155
142
156
@@ -589,10 +603,6 @@ def pin_copy_to_device_nonblocking(*tensors):
589
603
# ``pin_memory()`` before proceeding with to ``to(device)``.
590
604
# This approach can further accelerate data transfers, as demonstrated in the following example.
591
605
#
592
- # .. code-block:: bash
593
- #
594
- # # Install tensordict with the following command
595
- # !pip3 install tensordict
596
606
#
597
607
598
608
from tensordict import TensorDict
You can’t perform that action at this time.
0 commit comments