ef17941545c6d742de717d9769b2a412d9924e4e,fairseq/sequence_generator.py,SequenceGenerator,_decode,#SequenceGenerator#Any#Any#Any#,495

Before Change


        avg_attn = None

        for model, encoder_out in zip(self.models, encoder_outs):
            with torch.no_grad():
                if incremental_states[model] is not None:
                    decoder_out = list(model.decoder(tokens, encoder_out, incremental_states[model]))
                else:
                    decoder_out = list(model.decoder(tokens, encoder_out))
                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:

After Change



    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
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 5

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: ruotianluo/ImageCaptioning.pytorch
Commit Name: 0be455f86d595c12333541c09f2c5861dd76c2d4
Time: 2019-04-27
Author: rluo@ttic.edu
File Name: eval_utils.py
Class Name:
Method Name: eval_split