def make_data(cuda=False):
train_x = Variable(torch.linspace(0, 1, 100))
train_y = Variable(torch.sin(train_x.data * (2 * math.pi)))
test_x = Variable(torch.linspace(0, 1, 51))
test_y = Variable(torch.sin(test_x.data * (2 * math.pi)))
if cuda:
train_x = train_x.cuda()
train_y = train_y.cuda()
test_x = test_x.cuda()
test_y = test_y.cuda()
return train_x, train_y, test_x, test_y
# All tests that pass with the exact kernel should pass with the interpolated kernel.
评论列表
文章目录