Skip to content

Commit efcfc1c

Browse files
committed
Fix softmaxes
1 parent 586e147 commit efcfc1c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

onmt/ModelConstructor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def make_base_model(model_opt, fields, gpu, checkpoint=None):
191191
if not model_opt.copy_attn:
192192
generator = nn.Sequential(
193193
nn.Linear(model_opt.rnn_size, len(fields["tgt"].vocab)),
194-
nn.LogSoftmax())
194+
nn.LogSoftmax(dim=-1))
195195
if model_opt.share_decoder_embeddings:
196196
generator[0].weight = decoder.embeddings.word_lut.weight
197197
else:

onmt/modules/GlobalAttention.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def __init__(self, dim, coverage=False, attn_type="dot"):
7676
out_bias = self.attn_type == "mlp"
7777
self.linear_out = nn.Linear(dim*2, dim, bias=out_bias)
7878

79-
self.sm = nn.Softmax()
79+
self.sm = nn.Softmax(dim=-1)
8080
self.tanh = nn.Tanh()
8181

8282
if coverage:

0 commit comments

Comments
 (0)