Commit b1dfd39e authored by Myle Ott's avatar Myle Ott
Browse files

Revert `dim` in `F.softmax` for backwards compatibility

parent 42a0150c
Loading
Loading
Loading
Loading
+1 −1
Changes for fairseq/models/fconv.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ class AttentionLayer(nn.Module):

        # softmax over last dim
        sz = x.size()
        x = F.softmax(x.view(sz[0] * sz[1], sz[2]), dim=1)
        x = F.softmax(x.view(sz[0] * sz[1], sz[2]))
        x = x.view(sz)
        attn_scores = x

+1 −1
Changes for fairseq/sequence_generator.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -330,7 +330,7 @@ class SequenceGenerator(object):
                decoder_out, attn = model.decoder.incremental_forward(tokens, encoder_out)
            else:
                decoder_out, attn = model.decoder.forward(tokens, encoder_out)
            probs = F.softmax(decoder_out[:, -1, :], dim=1).data
            probs = F.softmax(decoder_out[:, -1, :]).data
            attn = attn[:, -1, :].data
            if avg_probs is None or avg_attn is None:
                avg_probs = probs