Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 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 Expand Up @@ -2118,7 +2118,7 @@
],
"source": [
"sns.lineplot(x='epoch', y='val Accuracy', data=batch_one_train, label='RNN: Batch=1')\n",
"sns.lineplot(x='epoch', y='val Accuracy', data=packed_train, label='RNN:Pakced Input')"
"sns.lineplot(x='epoch', y='val Accuracy', data=packed_train, label='RNN:Packed Input')"
]
},
{
Expand Down Expand Up @@ -2157,7 +2157,7 @@
],
"source": [
"sns.lineplot(x='total time', y='val Accuracy', data=batch_one_train, label='RNN: Batch=1')\n",
"sns.lineplot(x='total time', y='val Accuracy', data=packed_train, label='RNN:Pakced Input')"
"sns.lineplot(x='total time', y='val Accuracy', data=packed_train, label='RNN:Packed Input')"
]
},
{
Expand Down
Loading