Skip to content

Commit 70d2f23

Browse files
Atcoldapaszke
authored andcommitted
Add math explanation
1 parent 6a6e0a3 commit 70d2f23

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Deep Learning with PyTorch.ipynb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,15 @@
420420
"x.grad"
421421
]
422422
},
423+
{
424+
"cell_type": "markdown",
425+
"metadata": {},
426+
"source": [
427+
"You should have got a matrix of `4.5`.\n",
428+
"Let's call the `out` *Variable* \"$o$\". \n",
429+
"We have that $o = \\frac{1}{4}\\sum_i z_i$, $z_i = 3(x_i+2)^2$ and $z_i\\bigr\\rvert_{x_i=1} = 27$. Therefore, $\\frac{\\partial o}{\\partial x_i} = \\frac{3}{2}(x_i+2)$, hence $\\frac{\\partial o}{\\partial x_i}\\bigr\\rvert_{x_i=1} = \\frac{9}{2} = 4.5$."
430+
]
431+
},
423432
{
424433
"cell_type": "markdown",
425434
"metadata": {},

0 commit comments

Comments
 (0)