Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Commit

Permalink
Merge pull request #89 from tejaslodaya/master
Browse files Browse the repository at this point in the history
Fix NLL_loss error
  • Loading branch information
spro committed Jul 24, 2018
2 parents 1168c93 + a87890c commit a3e220f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions seq2seq-translation/seq2seq-translation.ipynb
Expand Up @@ -823,14 +823,14 @@
" # Teacher forcing: Use the ground-truth target as the next input\n",
" for di in range(target_length):\n",
" decoder_output, decoder_context, decoder_hidden, decoder_attention = decoder(decoder_input, decoder_context, decoder_hidden, encoder_outputs)\n",
" loss += criterion(decoder_output[0], target_variable[di])\n",
" loss += criterion(decoder_output, target_variable[di])\n",
" decoder_input = target_variable[di] # Next target is next input\n",
"\n",
" else:\n",
" # Without teacher forcing: use network's own prediction as the next input\n",
" for di in range(target_length):\n",
" decoder_output, decoder_context, decoder_hidden, decoder_attention = decoder(decoder_input, decoder_context, decoder_hidden, encoder_outputs)\n",
" loss += criterion(decoder_output[0], target_variable[di])\n",
" loss += criterion(decoder_output, target_variable[di])\n",
" \n",
" # Get most likely word index (highest value) from output\n",
" topv, topi = decoder_output.data.topk(1)\n",
Expand Down

0 comments on commit a3e220f

Please sign in to comment.