Skip to content

Commit

Permalink
Merge pull request OpenNMT#680 from OpenNMT/torch0.4
Browse files Browse the repository at this point in the history
Fix softmaxes
  • Loading branch information
srush authored Apr 13, 2018
2 parents fb82df7 + efcfc1c commit 0ecec8b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion onmt/ModelConstructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def make_base_model(model_opt, fields, gpu, checkpoint=None):
if not model_opt.copy_attn:
generator = nn.Sequential(
nn.Linear(model_opt.rnn_size, len(fields["tgt"].vocab)),
nn.LogSoftmax())
nn.LogSoftmax(dim=-1))
if model_opt.share_decoder_embeddings:
generator[0].weight = decoder.embeddings.word_lut.weight
else:
Expand Down
2 changes: 1 addition & 1 deletion onmt/modules/GlobalAttention.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def __init__(self, dim, coverage=False, attn_type="dot"):
out_bias = self.attn_type == "mlp"
self.linear_out = nn.Linear(dim*2, dim, bias=out_bias)

self.sm = nn.Softmax()
self.sm = nn.Softmax(dim=-1)
self.tanh = nn.Tanh()

if coverage:
Expand Down

0 comments on commit 0ecec8b

Please sign in to comment.