File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 33
33
34
34
In the process, we will touch three crucial components of TorchRL:
35
35
36
- * `environments <https://pytorch.org/rl/reference/envs.html>`__
37
- * `transforms <https://pytorch.org/rl/reference/envs.html#transforms>`__
38
- * `models (policy and value function) <https://pytorch.org/rl/reference/modules.html>`__
36
+ * `environments <https://pytorch.org/rl/stable/ reference/envs.html>`__
37
+ * `transforms <https://pytorch.org/rl/stable/ reference/envs.html#transforms>`__
38
+ * `models (policy and value function) <https://pytorch.org/rl/stable/ reference/modules.html>`__
39
39
40
40
"""
41
41
@@ -384,7 +384,7 @@ def _reset(self, tensordict):
384
384
# convenient shortcuts to the content of the output and input spec containers.
385
385
#
386
386
# TorchRL offers multiple :class:`~torchrl.data.TensorSpec`
387
- # `subclasses <https://pytorch.org/rl/reference/data.html#tensorspec>`_ to
387
+ # `subclasses <https://pytorch.org/rl/stable/ reference/data.html#tensorspec>`_ to
388
388
# encode the environment's input and output characteristics.
389
389
#
390
390
# Specs shape
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ the following template.
47
47
""" run.py:"""
48
48
# !/usr/bin/env python
49
49
import os
50
+ import sys
50
51
import torch
51
52
import torch.distributed as dist
52
53
import torch.multiprocessing as mp
@@ -66,8 +67,12 @@ the following template.
66
67
if __name__ == " __main__" :
67
68
world_size = 2
68
69
processes = []
69
- mp.set_start_method(" spawn" )
70
- for rank in range (world_size):
70
+ if " google.colab" in sys.modules:
71
+ print (" Running in Google Colab" )
72
+ mp.get_context(" spawn" )
73
+ else :
74
+ mp.set_start_method(" spawn" )
75
+ for rank in range (size):
71
76
p = mp.Process(target = init_process, args = (rank, world_size, run))
72
77
p.start()
73
78
processes.append(p)
@@ -156,7 +161,8 @@ we should not modify the sent tensor nor access the received tensor before ``req
156
161
In other words,
157
162
158
163
- writing to ``tensor `` after ``dist.isend() `` will result in undefined behaviour.
159
- - reading from ``tensor `` after ``dist.irecv() `` will result in undefined behaviour.
164
+ - reading from ``tensor `` after ``dist.irecv() `` will result in undefined
165
+ behaviour, until ``req.wait() `` has been executed.
160
166
161
167
However, after ``req.wait() ``
162
168
has been executed we are guaranteed that the communication took place,
You can’t perform that action at this time.
0 commit comments