ef17941545c6d742de717d9769b2a412d9924e4e,fairseq/sequence_generator.py,SequenceGenerator,_decode,#SequenceGenerator#Any#Any#Any#,495
Before Change
decoder_out[0] = decoder_out[0][:, -1, :]
attn = decoder_out[1]
probs = model.get_normalized_probs(decoder_out, log_probs=False).data
if avg_probs is None:
avg_probs = probs
else:
avg_probs.add_(probs)
After Change
return finalized
def _decode(self, tokens, encoder_outs, incremental_states):
if len(self.models) == 1:
return self._decode_one(tokens, self.models[0], encoder_outs[0], incremental_states, log_probs=True)
avg_probs = None
avg_attn = None
for model, encoder_out in zip(self.models, encoder_outs):
probs, attn = self._decode_one(tokens, model, encoder_out, incremental_states, log_probs=False)
if avg_probs is None:
avg_probs = probs
else:
avg_probs.add_(probs)
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 6
Instances
Project Name: elbayadm/attn2d
Commit Name: ef17941545c6d742de717d9769b2a412d9924e4e
Time: 2018-06-15
Author: myleott@fb.com
File Name: fairseq/sequence_generator.py
Class Name: SequenceGenerator
Method Name: _decode
Project Name: elbayadm/attn2d
Commit Name: d3795d6cd1c66ac05dc0f4861ce69ab4680bff3d
Time: 2018-04-02
Author: myleott@fb.com
File Name: fairseq/sequence_generator.py
Class Name: SequenceGenerator
Method Name: _decode