Skip to content

Commit

Permalink
Fix softmaxes
Browse files Browse the repository at this point in the history
  • Loading branch information
srush committed Apr 11, 2018
1 parent 586e147 commit efcfc1c
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 efcfc1c

Please sign in to comment.