44826d877d755e7df1d681d680583911d6d2032e,gpytorch/kernels/kernel.py,Distance,_jit_sq_dist_x1_neq_x2_nobatch,#Distance#Any#Any#Any#,37
Before Change
// @torch.jit.script_method
def _jit_sq_dist_x1_neq_x2_nobatch(self, x1, x2, postprocess):
// Compute squared distance matrix using quadratic expansion
x1_norm = x1.pow(2).sum(dim=-1, keepdim=True)
x2_norm = x2.pow(2).sum(dim=-1, keepdim=True)
res = torch.addmm(x2_norm.transpose(-2, -1), x1, x2.transpose(-2, -1), alpha=-2).add_(x1_norm)
// Zero out negative values
res.clamp_min_(0)
return self._postprocess(res) if bool(postprocess) else res
// @torch.jit.script_method
def _jit_sq_dist_x1_eq_x2(self, x1, postprocess):
After Change
// @torch.jit.script_method
def _jit_sq_dist_x1_neq_x2_nobatch(self, x1, x2, postprocess):
if hasattr(torch, "cdist"): // TODO: Remove lower branch when PyTorch 1.1.0 releases.
res = torch.cdist(x1, x2).pow(2)
else:
// Compute squared distance matrix using quadratic expansion
x1_norm = x1.pow(2).sum(dim=-1, keepdim=True)
x2_norm = x2.pow(2).sum(dim=-1, keepdim=True)
res = torch.addmm(x2_norm.transpose(-2, -1), x1, x2.transpose(-2, -1), alpha=-2).add_(x1_norm)
// Zero out negative values
res.clamp_min_(0)
return self._postprocess(res) if bool(postprocess) else res
// @torch.jit.script_method
def _jit_sq_dist_x1_eq_x2(self, x1, postprocess):
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 11
Instances
Project Name: cornellius-gp/gpytorch
Commit Name: 44826d877d755e7df1d681d680583911d6d2032e
Time: 2019-04-15
Author: balandat@fb.com
File Name: gpytorch/kernels/kernel.py
Class Name: Distance
Method Name: _jit_sq_dist_x1_neq_x2_nobatch
Project Name: cornellius-gp/gpytorch
Commit Name: 44826d877d755e7df1d681d680583911d6d2032e
Time: 2019-04-15
Author: balandat@fb.com
File Name: gpytorch/kernels/kernel.py
Class Name: Distance
Method Name: _jit_sq_dist_x1_eq_x2_nobatch
Project Name: cornellius-gp/gpytorch
Commit Name: 19dafd6933db873817d84b8a0c3a80fd18cd58c0
Time: 2019-04-12
Author: jake.gardner@uber.com
File Name: gpytorch/kernels/kernel.py
Class Name: Distance
Method Name: _jit_sq_dist_x1_neq_x2_nobatch
Project Name: cornellius-gp/gpytorch
Commit Name: 19dafd6933db873817d84b8a0c3a80fd18cd58c0
Time: 2019-04-12
Author: jake.gardner@uber.com
File Name: gpytorch/kernels/kernel.py
Class Name: Distance
Method Name: _jit_sq_dist_x1_eq_x2_nobatch
Project Name: cornellius-gp/gpytorch
Commit Name: 44826d877d755e7df1d681d680583911d6d2032e
Time: 2019-04-15
Author: balandat@fb.com
File Name: gpytorch/kernels/kernel.py
Class Name: Distance
Method Name: _jit_sq_dist_x1_neq_x2_nobatch