Loading fairseq/models/fconv.py +1 −1 Changes for fairseq/models/fconv.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -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 Loading fairseq/sequence_generator.py +1 −1 Changes for fairseq/sequence_generator.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -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 Loading Loading
fairseq/models/fconv.py +1 −1 Changes for fairseq/models/fconv.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -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 Loading
fairseq/sequence_generator.py +1 −1 Changes for fairseq/sequence_generator.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -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 Loading