Fix dimensions of periodic kernel parameters
@@ -27,7 +27,7 @@ class PeriodicKernel(Kernel):
self.eps = eps
self.register_parameter(
'log_period_length',
- nn.Parameter(torch.zeros(1, 1)),
+ nn.Parameter(torch.zeros(1, 1, 1)),
bounds=log_period_length_bounds,
)
@@ -36,4 +36,4 @@ class PeriodicKernel(Kernel):
period_length = (self.log_period_length.exp() + self.eps).sqrt_()
diff = torch.sum((x1.unsqueeze(2) - x2.unsqueeze(1)).abs(), -1)
res = - 2 * torch.sin(math.pi * diff / period_length).pow(2) / lengthscale
- return res.exp().unsqueeze(1)
+ return res.exp()
