Remove variable from test
@@ -11,7 +11,6 @@ import torch
import unittest
import gpytorch
from torch import optim
-from torch.autograd import Variable
from gpytorch.kernels import RBFKernel, AdditiveGridInterpolationKernel
from gpytorch.likelihoods import GaussianLikelihood
from gpytorch.means import ZeroMean
@@ -26,10 +25,7 @@ for i in range(n):
for j in range(n):
train_x[i * n + j][0] = float(i) / (n - 1)
train_x[i * n + j][1] = float(j) / (n - 1)
-train_x = Variable(train_x)
-train_y = Variable(
- (torch.sin(train_x.data[:, 0]) + torch.cos(train_x.data[:, 1])) * (2 * pi)
-)
+train_y = (torch.sin(train_x.data[:, 0]) + torch.cos(train_x.data[:, 1])) * (2 * pi)
m = 10
test_x = torch.zeros(pow(m, 2), 2)
@@ -37,10 +33,7 @@ for i in range(m):
for j in range(m):
test_x[i * m + j][0] = float(i) / (m - 1)
test_x[i * m + j][1] = float(j) / (m - 1)
-test_x = Variable(test_x)
-test_y = Variable(
- (torch.sin(test_x.data[:, 0]) + torch.cos(test_x.data[:, 1])) * (2 * pi)
-)
+test_y = (torch.sin(test_x.data[:, 0]) + torch.cos(test_x.data[:, 1])) * (2 * pi)
# All tests that pass with the exact kernel should pass with the interpolated kernel.
