cc8880d39c4a97ed5af943e623d6d02e26f1ebad,models/AttModel.py,AttModel,_sample,#AttModel#Any#Any#Any#Any#,194

Before Change


                else:
                    // scale logprobs by temperature
                    prob_prev = torch.exp(torch.div(logprobs.data, temperature))
                it = torch.multinomial(prob_prev, 1)
                sampleLogprobs = logprobs.gather(1, it) // gather the logprobs at sampled positions
                it = it.view(-1).long() // and flatten indices for downstream processing

            // stop when all finished

After Change


                sampleLogprobs, it = torch.max(logprobs.data, 1)
                it = it.view(-1).long()
            else:
                logprobs = logprobs / temperature
                it = torch.distributions.Categorical(logits=logprobs.detach()).sample()
                sampleLogprobs = logprobs.gather(1, it.unsqueeze(1)) // gather the logprobs at sampled positions

            // stop when all finished
            if t == 0:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: ruotianluo/self-critical.pytorch
Commit Name: cc8880d39c4a97ed5af943e623d6d02e26f1ebad
Time: 2019-04-18
Author: rluo@ttic.edu
File Name: models/AttModel.py
Class Name: AttModel
Method Name: _sample


Project Name: cornellius-gp/gpytorch
Commit Name: a78d17ccb29c93a413daf98565af7eeedf45e6c9
Time: 2018-01-10
Author: gpleiss@gmail.com
File Name: gpytorch/random_variables/categorical_random_variable.py
Class Name: CategoricalRandomVariable
Method Name: sample