Skip to content

Commit 752b5dc

Browse files
authored
Merge branch 'main' into RC-TEST-2.9
2 parents 93a76c2 + c1903fc commit 752b5dc

File tree

9 files changed

+43
-164
lines changed

9 files changed

+43
-164
lines changed

.ci/docker/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pandocfilters==1.5.1
1616
markdown==3.8.2
1717

1818
# PyTorch Theme
19-
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git@f576ce406429f8ce11475ec096dda346df5b3b71#egg=pytorch_sphinx_theme2
19+
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git@c2e38b37f3c432c610639f06d1d421c6df4c225c#egg=pytorch_sphinx_theme2
2020

2121
# Tutorial dependencies
2222
tqdm==4.66.1

advanced_source/cpp_frontend.rst

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1+
.. _cpp-frontend-tutorial:
2+
13
Using the PyTorch C++ Frontend
24
==============================
35

6+
**Author:** `Peter Goldsborough <https://github.com/goldsborough>`_
7+
8+
.. grid:: 2
9+
10+
.. grid-item-card:: :octicon:`mortar-board;1em;` What you will learn
11+
:class-card: card-prerequisites
12+
13+
* How to build a C++ application that utilizes the PyTorch C++ frontend
14+
* How to define and train neural networks from C++ using PyTorch abstractions
15+
16+
.. grid-item-card:: :octicon:`list-unordered;1em;` Prerequisites
17+
:class-card: card-prerequisites
18+
19+
* PyTorch 1.5 or later
20+
* Basic understanding of C++ programming
21+
* Basic Ubuntu Linux environment with CMake >= 3.5; similar commands will work in a MacOS / Windows environment
22+
* (Optional) A CUDA-based GPU for the GPU training sections
23+
424
The PyTorch C++ frontend is a pure C++ interface to the PyTorch machine learning
525
framework. While the primary interface to PyTorch naturally is Python, this
626
Python API sits atop a substantial C++ codebase providing foundational data
727
structures and functionality such as tensors and automatic differentiation. The
8-
C++ frontend exposes a pure C++11 API that extends this underlying C++ codebase
28+
C++ frontend exposes a pure C++17 API that extends this underlying C++ codebase
929
with tools required for machine learning training and inference. This includes a
1030
built-in collection of common components for neural network modeling; an API to
1131
extend this collection with custom modules; a library of popular optimization
@@ -137,14 +157,14 @@ on we'll use this ``CMakeLists.txt`` file:
137157

138158
.. code-block:: cmake
139159
140-
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
160+
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
141161
project(dcgan)
142162
143163
find_package(Torch REQUIRED)
144164
145165
add_executable(dcgan dcgan.cpp)
146166
target_link_libraries(dcgan "${TORCH_LIBRARIES}")
147-
set_property(TARGET dcgan PROPERTY CXX_STANDARD 14)
167+
set_property(TARGET dcgan PROPERTY CXX_STANDARD 17)
148168
149169
.. note::
150170

@@ -859,7 +879,7 @@ stacks them into a single tensor along the first dimension:
859879
860880
Note that the MNIST dataset should be located in the ``./mnist`` directory
861881
relative to wherever you execute the training binary from. You can use `this
862-
script <https://gist.github.com/goldsborough/6dd52a5e01ed73a642c1e772084bcd03>`_
882+
script <https://gist.github.com/jbschlosser/94347505df6188f8764793ee29fd1bdd>`_
863883
to download the MNIST dataset.
864884
865885
Next, we create a data loader and pass it this dataset. To make a new data

beginner_source/introyt/tensors_deeper_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585

8686

8787
#########################################################################
88-
# The fctory methods all do just what you’d expect - we have a tensor
88+
# The factory methods all do just what you’d expect - we have a tensor
8989
# full of zeros, another full of ones, and another with random values
9090
# between 0 and 1.
9191
#

conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def wrapper(*args, **kwargs):
145145

146146
intersphinx_mapping = {
147147
"torch": ("https://docs.pytorch.org/docs/stable/", None),
148-
"tensordict": ("https://docs.pytorch.github.io/tensordict/stable", None),
148+
"tensordict": ("https://docs.pytorch.org/tensordict/stable", None),
149149
"torchrl": ("https://docs.pytorch.org/rl/stable", None),
150150
"torchaudio": ("https://docs.pytorch.org/audio/stable/", None),
151151
"torchtext": ("https://docs.pytorch.org/text/stable/", None),
@@ -236,6 +236,7 @@ def wrapper(*args, **kwargs):
236236
"navbar_center": "navbar-nav",
237237
"display_version": True,
238238
"pytorch_project": "tutorials",
239+
"canonical_url": "https://docs.pytorch.org/tutorials/",
239240
}
240241

241242
theme_variables = pytorch_sphinx_theme2.get_theme_variables()

intermediate_source/neural_tangent_kernels.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
.. note::
1515
16-
This tutorial requires PyTorch 2.0.0 or later.
16+
This tutorial requires PyTorch 2.6.0 or later.
1717
1818
Setup
1919
-----
@@ -24,7 +24,12 @@
2424
import torch
2525
import torch.nn as nn
2626
from torch.func import functional_call, vmap, vjp, jvp, jacrev
27-
device = 'cuda' if torch.cuda.device_count() > 0 else 'cpu'
27+
28+
if torch.accelerator.is_available() and torch.accelerator.device_count() > 0:
29+
device = torch.accelerator.current_accelerator()
30+
else:
31+
device = torch.device("cpu")
32+
2833

2934
class CNN(nn.Module):
3035
def __init__(self):

intermediate_source/reinforcement_ppo.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
2626
We will cover six crucial components of TorchRL:
2727
28-
* `environments <https://pytorch.org/rl/reference/envs.html>`__
29-
* `transforms <https://pytorch.org/rl/reference/envs.html#transforms>`__
30-
* `models (policy and value function) <https://pytorch.org/rl/reference/modules.html>`__
31-
* `loss modules <https://pytorch.org/rl/reference/objectives.html>`__
32-
* `data collectors <https://pytorch.org/rl/reference/collectors.html>`__
33-
* `replay buffers <https://pytorch.org/rl/reference/data.html#replay-buffers>`__
28+
* `environments <https://docs.pytorch.org/rl/stable/reference/envs.html>`__
29+
* `transforms <https://docs.pytorch.org/rl/stable/reference/envs.html#transforms>`__
30+
* `models (policy and value function) <https://docs.pytorch.org/rl/stable/reference/modules.html>`__
31+
* `loss modules <https://docs.pytorch.org/rl/stable/reference/objectives.html>`__
32+
* `data collectors <https://docs.pytorch.org/rl/stable/reference/collectors.html>`__
33+
* `replay buffers <https://docs.pytorch.org/rl/stable/reference/data.html#replay-buffers>`__
3434
3535
"""
3636

@@ -466,7 +466,7 @@
466466
# Data collector
467467
# --------------
468468
#
469-
# TorchRL provides a set of `DataCollector classes <https://pytorch.org/rl/reference/collectors.html>`__.
469+
# TorchRL provides a set of `DataCollector classes <https://docs.pytorch.org/rl/stable/reference/collectors.html>`__.
470470
# Briefly, these classes execute three operations: reset an environment,
471471
# compute an action given the latest observation, execute a step in the environment,
472472
# and repeat the last two steps until the environment signals a stop (or reaches

recipes_index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ from our full-length tutorials.
367367
recipes/recipes/timer_quick_start
368368
recipes/torch_compile_backend_ipex
369369
recipes/zero_redundancy_optimizer
370-
recipes/cuda_rpc
371370
recipes/distributed_comm_debug_mode
372371
recipes/torch_export_challenges_solutions
373372
recipes/recipes/benchmark

recipes_source/cuda_rpc.rst

Lines changed: 0 additions & 147 deletions
This file was deleted.

redirects.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"prototype/pt2e_quantizer.html": "https://docs.pytorch.org/ao/main/tutorials_source/pt2e_quantizer.html",
3232
"prototype/quantization_in_pytorch_2_0_export_tutorial.html": "../index.html",
3333
"prototype/torchscript_freezing.html": "../index.html",
34+
"recipes_source/cuda_rpc.rst": "../index.html",
3435
"receipes/fuse.html": "../index.html",
3536
"receipes/quantization.html": "../index.html",
3637
"receipes/receipes/dynamic_quantization.html": "../index.html",

0 commit comments

Comments
 (0)