Commit 22a83ce
Switch from sin(x) to exp(x) as the target function in polynomial_autograd (pytorch#3597)
Fixes pytorch#3596
This PR branch uses 'exp(x)' instead of 'sin(x)' as the 'y' (target)
variable. The reason for this is faster and clearer convergence, since
exp(x) is well approximated by a Taylor expansion around the origin.
Also, all the derivatives are exp(0)=1, so the polynomial coefficients
are trivially '1/n! '(for the 'n-th' term).
I am also improving the information output to the user inside the
optimization loop.
Finally, I am making the top doc string a raw string, to avoid a python3
warning about it.
cc @albanD @jbschlosser
---------
Co-authored-by: Svetlana Karslioglu <svekars@meta.com>1 parent 20b0775 commit 22a83ce
1 file changed
+12
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
| 30 | + | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
51 | 57 | | |
52 | | - | |
| 58 | + | |
53 | 59 | | |
54 | 60 | | |
55 | 61 | | |
| |||
0 commit comments