Skip to content

Commit 387be4c

Browse files
authored
Learning PyTorch with Examples Audit (#3600)
Fixes [T237454989](https://www.internalfb.com/intern/tasks/?t=237454989). Ran and verified that these examples work: beginner_source/examples_tensor/polynomial_numpy.py beginner_source/examples_tensor/polynomial_tensor.py beginner_source/examples_autograd/polynomial_autograd.py beginner_source/examples_autograd/polynomial_custom_function.py beginner_source/examples_nn/dynamic_net.py beginner_source/examples_nn/polynomial_module.py beginner_source/examples_nn/polynomial_module.py beginner_source/examples_nn/polynomial_optim.py
1 parent f526f25 commit 387be4c

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

beginner_source/examples_nn/polynomial_nn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-----------
55
66
A third order polynomial, trained to predict :math:`y=\sin(x)` from :math:`-\pi`
7-
to :math:`pi` by minimizing squared Euclidean distance.
7+
to :math:`\pi` by minimizing squared Euclidean distance.
88
99
This implementation uses the nn package from PyTorch to build the network.
1010
PyTorch autograd makes it easy to define computational graphs and take gradients,

beginner_source/examples_nn/polynomial_optim.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
--------------
55
66
A third order polynomial, trained to predict :math:`y=\sin(x)` from :math:`-\pi`
7-
to :math:`pi` by minimizing squared Euclidean distance.
7+
to :math:`\pi` by minimizing squared Euclidean distance.
88
99
This implementation uses the nn package from PyTorch to build the network.
1010

beginner_source/examples_tensor/polynomial_numpy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
--------------
55
66
A third order polynomial, trained to predict :math:`y=\sin(x)` from :math:`-\pi`
7-
to :math:`pi` by minimizing squared Euclidean distance.
7+
to :math:`\pi` by minimizing squared Euclidean distance.
88
99
This implementation uses numpy to manually compute the forward pass, loss, and
1010
backward pass.

beginner_source/examples_tensor/polynomial_tensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
----------------
55
66
A third order polynomial, trained to predict :math:`y=\sin(x)` from :math:`-\pi`
7-
to :math:`pi` by minimizing squared Euclidean distance.
7+
to :math:`\pi` by minimizing squared Euclidean distance.
88
99
This implementation uses PyTorch tensors to manually compute the forward pass,
1010
loss, and backward pass.

beginner_source/pytorch_with_examples.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ between the network output and the true output.
2626
You can browse the individual examples at the
2727
:ref:`end of this page <examples-download>`.
2828

29+
To run the tutorials below, make sure you have the `torch`_
30+
and `numpy`_ packages installed.
31+
32+
.. _torch: https://github.com/pytorch/pytorch
33+
.. _numpy: https://github.com/numpy/numpy
34+
2935
.. contents:: Table of Contents
3036
:local:
3137

@@ -217,6 +223,8 @@ We can easily implement this model as a Module subclass:
217223
.. includenodoc:: /beginner/examples_nn/dynamic_net.py
218224

219225

226+
227+
220228
.. _examples-download:
221229

222230
Examples
@@ -229,7 +237,6 @@ Tensors
229237

230238
.. toctree::
231239
:maxdepth: 2
232-
:hidden:
233240

234241
/beginner/examples_tensor/polynomial_numpy
235242
/beginner/examples_tensor/polynomial_tensor
@@ -247,7 +254,6 @@ Autograd
247254

248255
.. toctree::
249256
:maxdepth: 2
250-
:hidden:
251257

252258
/beginner/examples_autograd/polynomial_autograd
253259
/beginner/examples_autograd/polynomial_custom_function
@@ -266,7 +272,6 @@ Autograd
266272

267273
.. toctree::
268274
:maxdepth: 2
269-
:hidden:
270275

271276
/beginner/examples_nn/polynomial_nn
272277
/beginner/examples_nn/polynomial_optim
@@ -284,4 +289,4 @@ Autograd
284289

285290
.. raw:: html
286291

287-
<div style='clear:both'></div>
292+
<div style='clear:both'></div>

0 commit comments

Comments
 (0)