Skip to content

Commit 742808b

Browse files
committed
Fix polynomial_autograd documentation to match implementation
The tutorial code uses exp(x) but the documentation incorrectly stated it was learning sin(x). This fix updates the documentation to correctly describe what the code does: - Changed documentation from sin(x) from -π to π - To exp(x) from -1 to 1 - Added explanation about Taylor expansion of exponential function The code remains unchanged and continues to demonstrate fitting a polynomial to the exponential function using PyTorch autograd.
1 parent f99e9e8 commit 742808b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

beginner_source/examples_autograd/polynomial_autograd.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
PyTorch: Tensors and autograd
33
-------------------------------
44
5-
A third order polynomial, trained to predict :math:`y=\sin(x)` from :math:`-\pi`
6-
to :math:`\pi` by minimizing squared Euclidean distance.
5+
A third order polynomial, trained to predict :math:`y=e^x` from :math:`-1`
6+
to :math:`1` by minimizing squared Euclidean distance. The exponential function
7+
can be approximated by its Taylor expansion: :math:`e^x \approx 1 + x + \frac{x^2}{2} + \frac{x^3}{6} + \ldots`
78
89
This implementation computes the forward pass using operations on PyTorch
910
Tensors, and uses PyTorch autograd to compute gradients.

0 commit comments

Comments
 (0)