f81c70c85ca6a2cbf9adb31d26ccc49007d5a335,pyro/distributions/torch.py,Binomial,sample,#Binomial#Any#,58

Before Change


                    shift = (mean - variance).round()
                    result = torch.poisson(variance.expand(shape))
                    result = torch.min(result + shift, self.total_count)
                    return torch.where(p < q, result, self.total_count - result)
        return super().sample(sample_shape)


// This overloads .log_prob() and .enumerate_support() to speed up evaluating

After Change


                    shift = (mean - variance).round()
                    result = torch.poisson(variance.expand(shape))
                    result = torch.min(result + shift, self.total_count)
                    sample = torch.where(p < q, result, self.total_count - result)
                // Draw exact samples for remaining items.
                if exact.any():
                    total_count = torch.where(exact, self.total_count,
                                              torch.zeros_like(self.total_count))
                    exact_sample = torch.distributions.Binomial(
                        total_count, self.probs, validate_args=False).sample(sample_shape)
                    sample = torch.where(exact, exact_sample, sample)
                return sample
        return super().sample(sample_shape)


// This overloads .log_prob() and .enumerate_support() to speed up evaluating
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: uber/pyro
Commit Name: f81c70c85ca6a2cbf9adb31d26ccc49007d5a335
Time: 2020-05-19
Author: fritzo@uber.com
File Name: pyro/distributions/torch.py
Class Name: Binomial
Method Name: sample


Project Name: reinforceio/tensorforce
Commit Name: f19c4f5cfecdccd65a65f298fd26f17b9d21ad52
Time: 2019-06-13
Author: alexkuhnle@t-online.de
File Name: tensorforce/core/distributions/gaussian.py
Class Name: Gaussian
Method Name: tf_sample


Project Name: reinforceio/tensorforce
Commit Name: a3fe8bdf1c484e390dfe3947cc395372c0187589
Time: 2019-02-06
Author: alexkuhnle@t-online.de
File Name: tensorforce/core/distributions/beta.py
Class Name: Beta
Method Name: tf_sample