ed40be9f34cfbfa4c3ee0f6864a18f5fa4f733f8,gpytorch/kernels/periodic_kernel.py,PeriodicKernel,forward,#PeriodicKernel#Any#Any#,121

Before Change


    def forward(self, x1, x2, **params):
        x1_ = x1.div(self.period_length)
        x2_ = x2.div(self.period_length)
        x1_, x2_ = self._create_input_grid(x1_, x2_, **params)

        diff = torch.sum((x1_ - x2_).abs(), -1)
        res = torch.sin(diff.mul(math.pi)).pow(2).mul(-2 / self.lengthscale).exp_()
        if diff.ndimension() == 2:
            res = res.squeeze(0)
        return res

After Change


    def forward(self, x1, x2, **params):
        x1_ = x1.div(self.period_length)
        x2_ = x2.div(self.period_length)
        diff = self._covar_sq_dist(x1_, x2_, **params).sqrt_()
        res = torch.sin(diff.mul(math.pi)).pow(2).mul(-2 / self.lengthscale).exp_()
        if diff.ndimension() == 2:
            res = res.squeeze(0)
        return res
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 8

Instances


Project Name: cornellius-gp/gpytorch
Commit Name: ed40be9f34cfbfa4c3ee0f6864a18f5fa4f733f8
Time: 2018-12-17
Author: jrg365@cornell.edu
File Name: gpytorch/kernels/periodic_kernel.py
Class Name: PeriodicKernel
Method Name: forward


Project Name: cornellius-gp/gpytorch
Commit Name: ed40be9f34cfbfa4c3ee0f6864a18f5fa4f733f8
Time: 2018-12-17
Author: jrg365@cornell.edu
File Name: gpytorch/kernels/periodic_kernel.py
Class Name: PeriodicKernel
Method Name: forward


Project Name: cornellius-gp/gpytorch
Commit Name: 9e4d2ba315b6b1269eca5396f2b9224b63207605
Time: 2018-12-19
Author: gardner.jake@gmail.com
File Name: gpytorch/kernels/cosine_kernel.py
Class Name: CosineKernel
Method Name: forward


Project Name: cornellius-gp/gpytorch
Commit Name: ed40be9f34cfbfa4c3ee0f6864a18f5fa4f733f8
Time: 2018-12-17
Author: jrg365@cornell.edu
File Name: gpytorch/kernels/cosine_kernel.py
Class Name: CosineKernel
Method Name: forward


Project Name: cornellius-gp/gpytorch
Commit Name: 9e4d2ba315b6b1269eca5396f2b9224b63207605
Time: 2018-12-19
Author: gardner.jake@gmail.com
File Name: gpytorch/kernels/periodic_kernel.py
Class Name: PeriodicKernel
Method Name: forward