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
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 6
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: PIQuIL/QuCumber
Commit Name: 088b7601d2a21eb092150ae5f4070a8ab52306f3
Time: 2018-08-18
Author: emerali@users.noreply.github.com
File Name: qucumber/observables/pauli.py
Class Name: SigmaX
Method Name: apply
Project Name: tensorflow/mesh
Commit Name: 6121d55cb3b5817dfe8a6e6d6698940d68d455ef
Time: 2019-07-29
Author: no-reply@google.com
File Name: mesh_tensorflow/simd_mesh_impl.py
Class Name: SimdMeshImpl
Method Name: receive
Project Name: dmlc/gluon-nlp
Commit Name: 4e6f3c26ada09786a1fa97ee174668af588cdd76
Time: 2018-08-16
Author: linhaibin.eric@gmail.com
File Name: gluonnlp/model/sampled_block.py
Class Name: _SampledLogitsHelper
Method Name: hybrid_forward