d794af8ca756cbcf7927701e0c7f85e2767b76f7,test/distributions/test_multivariate_normal.py,TestMultivariateNormal,test_log_prob,#TestMultivariateNormal#,204

Before Change


        diffs = values - mean

        res = MultivariateNormal(mean, DiagLazyTensor(var)).log_prob(values)
        actual = -0.5 * (math.log(math.pi * 2) * 4 + var.log().sum() + (diffs / var * diffs).sum())
        self.assertLess((res - actual).div(res).abs().item(), 1e-2)

        mean = torch.randn(3, 4)
        var = torch.randn(3, 4).abs_()

After Change


        diffs = values - mean

        res = MultivariateNormal(mean, DiagLazyTensor(var)).log_prob(values)
        actual = TMultivariateNormal(mean, var.unsqueeze(-1) * torch.eye(4).repeat(3, 1, 1)).log_prob(values)
        self.assertLess((res - actual).div(res).abs().norm(), 1e-2)

    def test_kl_divergence(self):
        mean0 = torch.randn(4)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: cornellius-gp/gpytorch
Commit Name: d794af8ca756cbcf7927701e0c7f85e2767b76f7
Time: 2018-10-22
Author: jrg365@cornell.edu
File Name: test/distributions/test_multivariate_normal.py
Class Name: TestMultivariateNormal
Method Name: test_log_prob


Project Name: GPflow/GPflow
Commit Name: 3af7b8e9372ea8a5abbc9da68123508a8737fe0f
Time: 2019-11-19
Author: mark@prowler.io
File Name: gpflow/models/sgpr.py
Class Name: SGPRUpperMixin
Method Name: upper_bound


Project Name: cornellius-gp/gpytorch
Commit Name: 4d0a2ab9096fb0ed7b14b327fd2abf79c1e10476
Time: 2019-04-04
Author: eriksson@uber.com
File Name: gpytorch/lazy/added_diag_lazy_tensor.py
Class Name: AddedDiagLazyTensor
Method Name: _preconditioner