Skip to content

Commit b08b70d

Browse files
authored
Merge branch 'main' into 2.6-RC-TEST
2 parents de1cb75 + f7d06b6 commit b08b70d

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

advanced_source/cpp_custom_ops.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Custom C++ and CUDA Operators
1919
* PyTorch 2.4 or later
2020
* Basic understanding of C++ and CUDA programming
2121

22+
.. note::
23+
24+
This tutorial will also work on AMD ROCm with no additional modifications.
25+
2226
PyTorch offers a large library of operators that work on Tensors (e.g. torch.add, torch.sum, etc).
2327
However, you may wish to bring a new custom operator to PyTorch. This tutorial demonstrates the
2428
blessed path to authoring a custom operator written in C++/CUDA.

advanced_source/pendulum.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
3434
In the process, we will touch three crucial components of TorchRL:
3535
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>`__
3939
4040
"""
4141

@@ -384,7 +384,7 @@ def _reset(self, tensordict):
384384
# convenient shortcuts to the content of the output and input spec containers.
385385
#
386386
# 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
388388
# encode the environment's input and output characteristics.
389389
#
390390
# Specs shape

beginner_source/blitz/autograd_tutorial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,15 @@
191191
# .. math::
192192
#
193193
#
194-
# J^{T}\cdot \vec{v} = m \cdot \left(\begin{array}{ccc}
194+
# J^{T}\cdot \vec{v} = \left(\begin{array}{ccc}
195195
# \frac{\partial y_{1}}{\partial x_{1}} & \cdots & \frac{\partial y_{m}}{\partial x_{1}}\\
196196
# \vdots & \ddots & \vdots\\
197197
# \frac{\partial y_{1}}{\partial x_{n}} & \cdots & \frac{\partial y_{m}}{\partial x_{n}}
198198
# \end{array}\right)\left(\begin{array}{c}
199199
# \frac{\partial l}{\partial y_{1}}\\
200200
# \vdots\\
201201
# \frac{\partial l}{\partial y_{m}}
202-
# \end{array}\right) = m \cdot \left(\begin{array}{c}
202+
# \end{array}\right) = \left(\begin{array}{c}
203203
# \frac{\partial l}{\partial x_{1}}\\
204204
# \vdots\\
205205
# \frac{\partial l}{\partial x_{n}}

intermediate_source/dist_tuto.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ the following template.
4747
"""run.py:"""
4848
#!/usr/bin/env python
4949
import os
50+
import sys
5051
import torch
5152
import torch.distributed as dist
5253
import torch.multiprocessing as mp
@@ -66,8 +67,12 @@ the following template.
6667
if __name__ == "__main__":
6768
world_size = 2
6869
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):
7176
p = mp.Process(target=init_process, args=(rank, world_size, run))
7277
p.start()
7378
processes.append(p)
@@ -156,7 +161,8 @@ we should not modify the sent tensor nor access the received tensor before ``req
156161
In other words,
157162

158163
- 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.
160166

161167
However, after ``req.wait()``
162168
has been executed we are guaranteed that the communication took place,

0 commit comments

Comments
 (0)