Skip to content

Commit 25f04c7

Browse files
update exercise k
1 parent c3fe92a commit 25f04c7

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

5_Recurrent/5.1-EXE-Recurrent-Neural-Networks.ipynb

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,18 @@
473473
"\n",
474474
"When we are doing language modelling using a cross-entropy loss, we additionally apply the softmax function to the output $o_{t}$:\n",
475475
"\n",
476-
"- $\\hat{y}_t = \\mathrm{softmax}(o_{t})$"
476+
"- $\\hat{y}_t = \\mathrm{softmax}(o_{t})$\n",
477+
"\n",
478+
"\n",
479+
"### Backpropagation through time\n",
480+
"\n",
481+
"We define a loss function\n",
482+
"\n",
483+
"- $E = \\sum_t E_t = \\sum_t E_t(y_t ,\\hat{y}_t ) \\ , $\n",
484+
"\n",
485+
"where $E_t(y_t ,\\hat{y}_t )$ is the cross-entropy function.\n",
486+
"\n",
487+
"Backpropagation through time amounts to computing the gradients of the loss using the same type of clever bookkeeping we applied to the feed-forward network in week 1. This you will do in Exercise D."
477488
]
478489
},
479490
{
@@ -2045,10 +2056,7 @@
20452056
" \n",
20462057
" # Recurrent layer\n",
20472058
" # YOUR CODE HERE!\n",
2048-
" self.lstm = nn.LSTM(input_size=vocab_size,\n",
2049-
" hidden_size=50,\n",
2050-
" num_layers=1,\n",
2051-
" bidirectional=False)\n",
2059+
" self.lstm = \n",
20522060
" \n",
20532061
" # Output layer\n",
20542062
" self.l_out = nn.Linear(in_features=50,\n",

0 commit comments

Comments
 (0)