9635ad09053ca10ae88b84adb59c39e87bf70b03,models/CaptionModel.py,CaptionModel,beam_search,#CaptionModel#Any#Any#,34

Before Change


                    if decoding_constraint and t-divm > 0:
                        logprobsf.scatter_(1, beam_seq_table[divm][t-divm-1].unsqueeze(1).cuda(), float("-inf"))
                    if remove_bad_endings and t-divm > 0:
                        logprobsf[torch.from_numpy(np.isin(beam_seq_table[divm][t-divm-1].cpu().numpy(), self.bad_endings_ix).astype("uint8")), 0] = float("-inf")
                    // suppress UNK tokens in the decoding
                    if suppress_UNK and hasattr(self, "vocab") and self.vocab[str(logprobsf.size(1)-1)] == "UNK":
                        logprobsf[:,logprobsf.size(1)-1] = logprobsf[:, logprobsf.size(1)-1] - 1000  
                    // diversity is added here
                    // the function directly modifies the logprobsf values and hence, we need to return
                    // the unaugmented ones for sorting the candidates in the end. // for historical

After Change


                    if decoding_constraint and t-divm > 0:
                        logprobsf.scatter_(1, beam_seq_table[divm][t-divm-1].unsqueeze(1).cuda(), float("-inf"))
                    if remove_bad_endings and t-divm > 0:
                        logprobsf[torch.from_numpy(np.isin(beam_seq_table[divm][t-divm-1].cpu().numpy(), self.bad_endings_ix)), 0] = float("-inf")
                    // suppress UNK tokens in the decoding
                    if suppress_UNK and hasattr(self, "vocab") and self.vocab[str(logprobsf.size(1)-1)] == "UNK":
                        logprobsf[:,logprobsf.size(1)-1] = logprobsf[:, logprobsf.size(1)-1] - 1000  
                    // diversity is added here
                    // the function directly modifies the logprobsf values and hence, we need to return
                    // the unaugmented ones for sorting the candidates in the end. // for historical
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: ruotianluo/self-critical.pytorch
Commit Name: 9635ad09053ca10ae88b84adb59c39e87bf70b03
Time: 2020-01-18
Author: rluo@ttic.edu
File Name: models/CaptionModel.py
Class Name: CaptionModel
Method Name: beam_search


Project Name: Featuretools/featuretools
Commit Name: e59af1f1442e2b3ea6b93ec9ed962bcf95ccb8b7
Time: 2020-07-23
Author: 64278226+tamargrey@users.noreply.github.com
File Name: featuretools/synthesis/encode_features.py
Class Name:
Method Name: encode_features