Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Chapter_4.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1052,9 +1052,9 @@
" super(LastTimeStep, self).__init__()\n",
" self.rnn_layers = rnn_layers\n",
" if bidirectional:\n",
" self.num_driections = 2\n",
" self.num_directions = 2\n",
" else:\n",
" self.num_driections = 1 \n",
" self.num_directions = 1 \n",
" \n",
" def forward(self, input):\n",
" #Result is either a tupe (out, h_t)\n",
Expand All @@ -1065,7 +1065,7 @@
" last_step = last_step[0]#then h_t is the first item in the tuple\n",
" batch_size = last_step.shape[1] #per docs, shape is: '(num_layers * num_directions, batch, hidden_size)'\n",
" #reshaping so that everything is separate \n",
" last_step = last_step.view(self.rnn_layers, self.num_driections, batch_size, -1)\n",
" last_step = last_step.view(self.rnn_layers, self.num_directions, batch_size, -1)\n",
" #We want the last layer's results\n",
" last_step = last_step[self.rnn_layers-1] \n",
" #Re order so batch comes first\n",
Expand Down