Skip to content

Commit

Permalink
fix abisee#4 nan during training
Browse files Browse the repository at this point in the history
  • Loading branch information
falcondai committed Jul 28, 2017
1 parent f7a23a4 commit 65e2f9b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion model.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def _calc_final_dist(self, vocab_dists, attn_dists):
# Add the vocab distributions and the copy distributions together to get the final distributions
# final_dists is a list length max_dec_steps; each entry is a tensor shape (batch_size, extended_vsize) giving the final distribution for that decoder timestep
# Note that for decoder timesteps and examples corresponding to a [PAD] token, this is junk - ignore.
final_dists = [vocab_dist + copy_dist for (vocab_dist,copy_dist) in zip(vocab_dists_extended, attn_dists_projected)]
final_dists = [vocab_dist + copy_dist + 1e-12 for (vocab_dist,copy_dist) in zip(vocab_dists_extended, attn_dists_projected)]

return final_dists

Expand Down

0 comments on commit 65e2f9b

Please sign in to comment.