02b3976d1c39e5f08b5ec560691b6abd796d415b,onmt/translate/translator.py,Translator,sample_with_temperature,#Translator#Any#Any#Any#,286

Before Change


                top_values, top_indices = torch.topk(logits, keep_topk, dim=1)
                kth_best = top_values[:, -1].view([-1, 1])
                kth_best = kth_best.repeat([1, logits.shape[1]])
                kth_best = kth_best.type(torch.cuda.FloatTensor)

                // Set all logits that are not in the top-k to -1000.
                // This puts the probabilities close to 0.
                keep = torch.ge(logits, kth_best).type(torch.cuda.FloatTensor)

After Change


            if keep_topk > 0:
                top_values, top_indices = torch.topk(logits, keep_topk, dim=1)
                kth_best = top_values[:, -1].view([-1, 1])
                kth_best = kth_best.repeat([1, logits.shape[1]]).float()

                // Set all logits that are not in the top-k to -1000.
                // This puts the probabilities close to 0.
                keep = torch.ge(logits, kth_best).float()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: OpenNMT/OpenNMT-py
Commit Name: 02b3976d1c39e5f08b5ec560691b6abd796d415b
Time: 2019-01-14
Author: daphneipp@gmail.com
File Name: onmt/translate/translator.py
Class Name: Translator
Method Name: sample_with_temperature


Project Name: tsurumeso/waifu2x-chainer
Commit Name: 055c61d73514d471158ee36b83762802c8d4e3d4
Time: 2018-07-14
Author: tsurumeso@gmail.com
File Name: lib/loss/clipped_weighted_huber_loss.py
Class Name: ClippedWeightedHuberLoss
Method Name: backward


Project Name: lcswillems/torch-rl
Commit Name: 4bc24901700d09102a380ef93ba79578f44d274e
Time: 2018-04-11
Author: lcswillems@gmail.com
File Name: core/common.py
Class Name:
Method Name: estimate_advantages