60a342edc8b501802135df44869353cc8604d838,gpytorch/kernels/rbf_kernel.py,RBFKernel,forward,#RBFKernel#Any#Any#,13

Before Change



        x1_squared = torch.bmm(x1.view(n, 1, d), x1.view(n, d, 1))
        x1_squared = x1_squared.view(n, 1).expand(n, m)
        x2_squared = torch.bmm(x2.view(m, 1, d), x2.view(m, d, 1))
        x2_squared = x2_squared.view(1, m).expand(n, m)
        res.sub_(x1_squared).sub_(x2_squared)  // res = -(x - z)^2

        res = res / (self.log_lengthscale.exp() + self.eps)  // res = -(x - z)^2 / lengthscale

After Change


        res = 2 * x1.matmul(x2.transpose(-1, -2))

        x1_squared = torch.matmul(x1.unsqueeze(-2), x1.unsqueeze(-1)).squeeze(-1)
        x2_squared = torch.matmul(x2.unsqueeze(-2), x2.unsqueeze(-1)).squeeze(-1).transpose(-1, -2)
        res.sub_(x1_squared).sub_(x2_squared)  // res = -(x - z)^2

        res = res / (self.log_lengthscale.exp() + self.eps)  // res = -(x - z)^2 / lengthscale
        res.exp_()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: cornellius-gp/gpytorch
Commit Name: 60a342edc8b501802135df44869353cc8604d838
Time: 2018-01-11
Author: gpleiss@gmail.com
File Name: gpytorch/kernels/rbf_kernel.py
Class Name: RBFKernel
Method Name: forward


Project Name: allenai/allennlp
Commit Name: de0d3f7329c9c4f0204d87e76b6a956b0930ef3e
Time: 2018-07-20
Author: markn@allenai.org
File Name: allennlp/modules/matrix_attention/bilinear_matrix_attention.py
Class Name: BilinearMatrixAttention
Method Name: forward


Project Name: OpenNMT/OpenNMT-py
Commit Name: b5486aaea994960688152e91fbab7699dc04e8c1
Time: 2017-08-14
Author: taolei@csail.mit.edu
File Name: onmt/modules/GlobalAttention.py
Class Name: GlobalAttention
Method Name: score