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
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: bbfbfce5c8c18b39d541d912ffb11182f7d06dfd
Time: 2017-08-06
Author: markn@allenai.org
File Name: allennlp/modules/similarity_functions/linear.py
Class Name: LinearSimilarity
Method Name: forward


Project Name: rusty1s/pytorch_geometric
Commit Name: 69bfedd2f29edb4da64334b13bb95c5aab403a89
Time: 2019-07-11
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/nn/conv/gmm_conv.py
Class Name: GMMConv
Method Name: forward